%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/samba/gp/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/samba/gp/__pycache__/gp_sec_ext.cpython-312.pyc

�

�I�d�#���ddlZddlmZddlmZddlmZ	ddlm	Z	ddl
mZddl
mZd�Zd	�Zd
�ZGd�de�ZGd
�de�Zy#e$rY�-wxYw)�N)�
gp_inf_ext)�system_session)�
get_string)�LdbError)�SamDB)�logc�$�dt|�dzzS)N�%d�<��int��vals �5/usr/lib/python3/dist-packages/samba/gp/gp_sec_ext.py�
mins_to_hoursr����3�s�8�b�=�!�!�c�$�dt|�dzzS)Nr
�rrs r�
days_to_hoursr rrc�X�d}d}d}d}t|�}t||z|z|z|z�S)Nrri���)r
�str)r�seconds�minutes�hours�sam_adds     r�days2rel_nttimer#s@���G��G��E��G�

�c�(�C���w���(�5�0�7�:�;�<�<rc�6�eZdZdddd�Zd�Zd�Zd�Zd�Zd	�Zy
)�
gp_krb_ext�kdc:user_ticket_lifetime�kdc:service_ticket_lifetime�kdc:renewal_lifetime)�MaxTicketAge�
MaxServiceAge�MaxRenewAgec	��|jjd�dk7ryd}|D]�\}}|jj|�|j	�D]t}|t|�k(s�||j
�D]M\}}|j||�|jj||�|jj��O�v��|D�]'}	|	js�|jj|	j�tjj|	j|�}
|j|
�}|s�t|j!�D]�}|t|�k(s�|j
|�D]|\}}|t"j$vr�t"j$|}|j'�j|�}
|j||
|��|jj��~����*y�Nzserver rolez"active directory domain controllerz0MACHINE/Microsoft/Windows NT/SecEdit/GptTmpl.inf)�lp�get�gp_db�set_guid�keysr�items�set_kdc_tdb�delete�commit�
file_sys_path�name�os�path�join�parse�sectionsr�	apply_map�mapper)�self�deleted_gpo_list�changed_gpo_list�inf_file�guid�settings�section�att�value�gpor4�inf_conf�key�
value_funcs              r�process_group_policyzgp_krb_ext.process_group_policy/s����7�7�;�;�}�%�)M�M��E��.�	,�N�D�(��J�J����%�#�=�=�?�
,���c�$�i�'�&.�w�&7�&=�&=�&?�,�
��U��(�(��e�4��
�
�)�)�'�3�7��
�
�)�)�+�,�
,�	,�$�	0�C�� � ��
�
�#�#�C�H�H�-��w�w�|�|�C�$5�$5�x�@���:�:�d�+����'�0�0�2�0�G��#�d�)�+�*2�.�.��*A�0�J�C��"�*�*>�*>�>� (�",�"6�"6�s�";�C�)-����):�):�3�)?�J� �,�,�S�*�U�2C�D� �J�J�-�-�/�
0�0�	0rc���|jjj|�}tj|�d|�d|���|�h|jjj|t
|��|jjt|�||rt
|��yd�y|jjj|�|jjt|�|�y)Nz was changed from � to )	r*�gpostorer)r�info�storerrr/�r:�	attributer�old_vals    rr.zgp_krb_ext.set_kdc_tdbMs����*�*�%�%�)�)�)�4�����9�g�s�K�L��?��J�J���%�%�i��C��A��J�J���S��Y�	��4>�g�3F�
*�$(�
*�
�J�J���&�&�y�1��J�J���c�$�i��3rc� �d�ttd�S)Nc��|S�N�rs r�<lambda>z#gp_krb_ext.mapper.<locals>.<lambda>Ys���r)r r!r")rr�r:s rr9zgp_krb_ext.mapperXs��,;�/<�(5��	rc��y)NzKerberos PolicyrSrUs r�__str__zgp_krb_ext.__str__^s�� rc���i}|jjd�dk7r|Sd}|jr�tjj|j|�}|j
|�}|s|St|�|j�vrRt|�}|j|�D��cic]'\}}tjj|�r||��)c}}||<|Scc}}wr')r(r)r1r3r4r5r6rr7r-rr8�	r:rC�outputr=r4rDr@�k�vs	         r�rsopzgp_krb_ext.rsopas������7�7�;�;�}�%�)M�M��M�E������7�7�<�<�� 1� 1�8�<�D��z�z�$�'�H���
��4�y�H�-�-�/�/��d�)��4<�N�N�7�4K�#F�D�A�q�)3�)=�)=�)A�)A�!�)D�$%�a�4�#F��w���
��#F��*,CN)	�__name__�
__module__�__qualname__r8rGr.r9rWr]rSrrrr+s+��#=�#@�#9�<�I�0�<	4��!�rrc�T�eZdZdZd�Zddddd�Zd�Zd	�Zd
�Zd�Z	d�Z
d
�Zd�Zd�Z
y)�
gp_access_extz�This class takes the .inf file parameter (essentially a GPO file mapped
    to a GUID), hashmaps it to the Samba parameter, which then uses an ldb
    object to update the parameter to Samba4. Not registry oriented whatsoever.
    c���	t|jj�t�|j|j��|_y#ttf$rtd��wxYw)N)�session_info�credentialsr(z/Failed to load SamDB for assigning Group Policy)	rr(�	samdb_urlr�creds�ldb�	NameErrorr�	ExceptionrUs r�load_ldbzgp_access_ext.load_ldbxs[��	O��T�W�W�.�.�0�*8�*:�)-��� $���)�D�H���8�$�	O��M�N�N�	O�s�AA�A&�	minPwdAge�	maxPwdAge�minPwdLength�
pwdProperties)�MinimumPasswordAge�MaximumPasswordAge�MinimumPasswordLength�PasswordComplexityc	�>�|jjd�dk7ry|j�d}|D]�\}}|jj	|�|j�D]�}|t
|�k(s�||j�D]f\}}|j�j|�\}	}
|	||�|jj||�|jj��h����|D�]!}|js�|jj	|j�tjj|j|�}|j!|�}
|
s�t|
j#�D]�}|t
|�k(s�|
j|�D]v\}}|t$j&vr�t$j&|}|j�j|�\}	}|	|||��|jj��x����$yr')r(r)rlr*r+r,rr-r9r/r0r1r2r3r4r5r6r7rcr8)r:r;r<r=r>r?r@rArB�update_samba�_rCr4rDrErFs                rrGz"gp_access_ext.process_group_policy�s����7�7�;�;�}�%�)M�M���
�
��E��.�	,�N�D�(��J�J����%�#�=�=�?�
,���c�$�i�'�&.�w�&7�&=�&=�&?�,�
��U�*.�+�+�-�*;�*;�C�*@���a�$�S�%�0��
�
�)�)�'�3�7��
�
�)�)�+�	,�
,�	,�$�	0�C�� � ��
�
�#�#�C�H�H�-��w�w�|�|�C�$5�$5�x�@���:�:�d�+����'�0�0�2�0�G��#�d�)�+�*2�.�.��*A�0�J�C��"�-�*A�*A�A� (�"/�"9�"9�#�">�C�9=����9J�9J�3�9O�6�\�:�(��j��.?�@� �J�J�-�-�/�
0�0�	0rc��|jj�}tjd|�d|���|jjt
|�|t
|��|jj|�y)Nz*KDC Minimum Password age was changed from rI)ri�
get_minPwdAgerrKr*rLr�
set_minPwdAgerMs    r�ch_minPwdAgezgp_access_ext.ch_minPwdAge��Z���(�(�(�(�*������S�"�	#��
�
����T��I�s�7�|�<������s�#rc��|jj�}tjd|�d|���|jjt
|�|t
|��|jj|�y)Nz*KDC Maximum Password age was changed from rI)ri�
get_maxPwdAgerrKr*rLr�
set_maxPwdAgerMs    r�ch_maxPwdAgezgp_access_ext.ch_maxPwdAge�r|rc��|jj�}tjd|�d|���|jjt
|�|t
|��|jj|�y)Nz-KDC Minimum Password length was changed from rI)ri�get_minPwdLengthrrKr*rLr�set_minPwdLengthrMs    r�ch_minPwdLengthzgp_access_ext.ch_minPwdLength�sZ���(�(�+�+�-������S�"�	#��
�
����T��I�s�7�|�<����!�!�#�&rc��|jj�}tjd|�d|���|jjt
|�|t
|��|jj|�y)Nz*KDC Password Properties were changed from rI)ri�get_pwdPropertiesrrKr*rLr�set_pwdPropertiesrMs    r�ch_pwdPropertieszgp_access_ext.ch_pwdProperties�sZ���(�(�,�,�.������c�#�	$��
�
����T��I�s�7�|�<����"�"�3�'rc��|jtf|jtf|jd�f|jd�fd�S)zldap value : samba setterc��|SrRrSrs rrTz&gp_access_ext.mapper.<locals>.<lambda>�s��3�rc��|SrRrSrs rrTz&gp_access_ext.mapper.<locals>.<lambda>�s��S�r)rmrnrorp)r{rr�r�r�rUs rr9zgp_access_ext.mapper�sF��"�/�/��A�"�/�/��A�"&�!5�!5�� G�"&�"7�"7��!I��	rc��y)Nz
System AccessrSrUs rrWzgp_access_ext.__str__�s��rc���i}|jjd�dk7r|Sd}|jr�tjj|j|�}|j
|�}|s|St|�|j�vrRt|�}|j|�D��cic]'\}}tjj|�r||��)c}}||<|Scc}}wr')r(r)r1r3r4r5r6rr7r-rcr8rYs	         rr]zgp_access_ext.rsop�s������7�7�;�;�}�%�)M�M��M�E������7�7�<�<�� 1� 1�8�<�D��z�z�$�'�H���
��4�y�H�-�-�/�/��d�)��4<�N�N�7�4K�#I�D�A�q�)6�)@�)@�)D�)D�Q�)G�$%�a�4�#I��w���
��#Ir^N)r_r`ra�__doc__rlr8rGr{r�r�r�r9rWr]rSrrrcrcrsK���
O�-8�,7�,:�,;�>�I�0�@$�$�'�(�	��rrc)�os.pathr3�samba.gp.gpclassr�
samba.authr�samba.commonrrir�samba.samdbr�ImportError�samba.gp.util.loggingrrrrrrcrSrr�<module>r�sd��$�'�%�#�	��!�&�"�"�=�D��D�Nk�J�k��s�	��	�s�A
�
A�A

Zerion Mini Shell 1.0