File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/win_lgpo_auditpol.cpython-310.pyc
Back
o ;j0i � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddlm Z ddlm Z ddlZddlmZ e�e�ZdZi Zg d�Zdd d dd�ZdZd Zd Zd ZdZd Zg d�ZG dd� dej �Z!G dd� dej �Z"G dd� dej �Z#G dd� dej �Z$G dd� dej �Z%dd� Z&da'dd� Z(d<d!d"�Z)d=d&d'�Z*ej+d(d)� �Z,d*d+� Z-g d,�Z.d-d.� Z/d/d0� Z0d>d2d3�Z1d4d5� Z2d6d7� Z3d8d9� Z4d:d;� Z5dS )?u� A salt util for modifying the audit policies on the machine. This util is used by the ``win_auditpol`` and ``win_lgpo`` modules. Though this utility does not set group policy for auditing, it displays how all auditing configuration is applied on the machine, either set directly or via local or domain group policy. .. versionadded:: 2018.3.4 .. versionadded:: 2019.2.1 Audit policy is read and written using the Windows ``advapi32`` APIs (``AuditQuerySystemPolicy`` / ``AuditSetSystemPolicy``) with a static subcategory GUID to English name map, so behavior is consistent regardless of the host OS display language. This util allows you to view and modify the audit settings as they are applied on the machine. The audit settings are broken down into nine categories: - Account Logon - Account Management - Detailed Tracking - DS Access - Logon/Logoff - Object Access - Policy Change - Privilege Use - System The ``get_settings`` function will return the subcategories for all nine of the above categories in one dictionary along with their auditing status. Subcategory names are **canonical English** strings (they match the names Salt and LGPO use, not the host OS localized ``auditpol`` display names). To modify a setting you only need to specify the subcategory name and the value you wish to set. Valid settings are: - No Auditing - Success - Failure - Success and Failure The module constant ``settings`` maps those English labels to the integer **auditing bitmask** passed to ``AuditSetSystemPolicy`` (``0``–``3``, aligned with LGPO ``audit.csv`` ``Setting Value``). Execution modules should keep using the string labels; callers should not rely on ``settings`` values being ``auditpol.exe`` switch strings. LGPO loads defaults via :func:`get_advaudit_policy_rows`; :func:`get_auditpol_dump` serializes the same data as UTF-8 CSV lines for backward compatibility. Usage: .. code-block:: python import salt.utils.win_lgpo_auditpol # Get current state of all audit settings salt.utils.win_lgpo_auditpol.get_settings() # Get the current state of all audit settings in the "Account Logon" # category salt.utils.win_lgpo_auditpol.get_settings(category="Account Logon") # Get current state of the "Credential Validation" setting salt.utils.win_lgpo_auditpol.get_setting(name='Credential Validation') # Set the state of the "Credential Validation" setting to Success and # Failure salt.utils.win_lgpo_auditpol.set_setting(name='Credential Validation', value='Success and Failure') # Set the state of the "Credential Validation" setting to No Auditing salt.utils.win_lgpo_auditpol.set_setting(name='Credential Validation', value='No Auditing') � )�annotationsN)�wintypes)�SimpleNamespace)�CommandExecutionErrorZauditpol) � Account Logon�Account Management�Detailed Tracking� DS Access�Logon/Logoff� Object Access� Policy Change� Privilege Use�System� � � )�No Auditing�Success�Failure�Success and Failure� � �zMachine Namez Policy TargetZSubcategoryzSubcategory GUIDzInclusion SettingzExclusion Settingz Setting Valuec @ s8 e Zd ZdZdejfdejfdejfdejd fgZdS )�_GUIDzAWin32 ``GUID`` layout (``Data1``..``Data4``) for ``Audit*`` APIs.�Data1�Data2�Data3�Data4r N) �__name__� __module__�__qualname__�__doc__�w�DWORDZWORDZBYTE�_fields_� r% r% �P/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/win_lgpo_auditpol.pyr � s �r c @ s( e Zd ZdZdefdejfdefgZdS )�_AUDIT_POLICY_INFORMATIONzH``AUDIT_POLICY_INFORMATION`` from ntsecapi / advapi32 (per subcategory).�AuditSubcategoryGuid�AuditingInformation�AuditCategoryGuidN)r r r r! r r"