Mini Shell

Direktori : /usr/share/cagefs/__pycache__/
Upload File :
Current File : //usr/share/cagefs/__pycache__/cagefshooks.cpython-311.pyc

�

�Kt�CK��<�dZddlmZddlmZddlmZddlmZddlmZej��ddl	Tddl
Z
dd	lmZdd
l
mZmZmZddlmZdZd
ZdZdZdZdZdZdZedzezdzezZdZddiddiddiddid�Zd�Zd(d�Zd �Z d!�Z!d"�Z"d#�Z#d$�Z$d%�Z%d&�Z&d'�Z'dS))zr
Now this package only cleans up old files and does not install new.
All new hooks must be installed using cllib.
�)�absolute_import)�division)�print_function)�unicode_literals)�standard_library)�*N)�print_error)�	getCPName�
PLESK_NAME�DIRECTADMIN_NAME)�"remove_hook_by_str_id_and_locationz#USERDEL_CMD /usr/bin/userdel.cagefsz/usr/share/cagefs-plugins/hookszuser_create_post.shzuser_restore_post.shzuser_destroy_post.shz?/usr/share/cagefs-plugins/hooks/directadmin/user_create_post.shz@/usr/share/cagefs-plugins/hooks/directadmin/user_restore_post.shz@/usr/share/cagefs-plugins/hooks/directadmin/user_destroy_post.shz
/directadmin/�/z%/usr/share/cagefs-plugins/hooks/plesk�SCRIPT_FILEzcagefs_plesk_hs_created.shzcagefs_plesk_hs_updated.shzcagefs_plesk_hs_deleted.shzcagefs_plesk_dm_updated.sh)�phys_hosting_create�phys_hosting_update�phys_hosting_delete�
domain_updatec�v�t|d��}|���}|���|S)N�r)�open�	readlines�close)�	file_name�f�contents   �_/builddir/build/BUILDROOT/cagefs-7.6.19-1.el9.cloudlinux.x86_64/usr/share/cagefs/cagefshooks.py�get_file_contentr3s0���Y����A��k�k�m�m�G��G�G�I�I�I��N��wc��d�|��}t||��}|�|��|���dS)N�)�joinr�writer)rr�open_methodrs    r�write_file_contentr%;sE���g�g�g���G��Y��$�$�A��G�G�G�����G�G�I�I�I�I�Irc��	tdd��}|���}|���d}d}d}|D]c}|�d��r||}tdz||<n6|�d��r|�d��dkr|}|d	z
}�d|�t��s�|dkr(t
|��dkr||}tdz||<t
|��dkrtd|��|�d��sV|�t��dkr:td
|�dd���	����dSdSdStddtzdzd��dSdS#ttf$r(}tdt|����Yd}~dSd}~wwxYw)
N�/etc/login.defsrrr!����USERDEL_CMD�
�#��/etc/cagefs/userdel.old�az#Failed to install USERDEL_CMD hook:)rrr�
startswith�USERDEL_COMMAND�find�lenr%�replace�strip�OSError�IOErrorr	�str)rr�i�userdel_cmd_old�
na_userdel�line�es       r�user_del_hook_installr=Cs(��C��"�C�(�(���+�+�-�-��	���	�	�	�
�����
��	�	�D����}�-�-�
�")�!�*��,�t�3���
������s�#�#�
��	�	�-�(@�(@�B�(F�(F��
�
��F�A�A��)�)�/�:�:�	Z��R���C��$8�$8�A�$=�$=�")�*�"5��&5��&<��
�#��?�#�#�q�(�(�"�#4�g�>�>�>�'�2�2�3�7�7�v�o�>R�>R�Sb�>c�>c�gi�>i�>i�&�'@�/�BY�BY�Zg�ik�Bl�Bl�Br�Br�Bt�Bt�u�u�u�u�u�v�v�>i�>i�#�#4�d�_�6L�t�6S�UX�Y�Y�Y�Y�Y�	Z�	Z��
�W��C�C�C��9�3�q�6�6�B�B�B�B�B�B�B�B�B�����C���s�E8F �F � G�1G�Gc�f�	tdd��}|���}|���d|z}n#t$rd}YnwxYw	t	jd��n#t$rYnwxYw	tdd��}|���}|���d}|D]/}|�t��dkr
|dz||<n|d	z
}�0td|��dS#ttf$r(}td
t|����Yd}~dSd}~wwxYw)Nr-rzUSERDEL_CMD r!r'rr(r*r,z&Failed to remove hook for DirectAdmin:)
r�readrr6�os�remover5rr1r0r%r	r7)rr9rr8r;r<s      r�user_del_hook_removerBgs{����*�C�0�0���&�&�(�(��	���	�	�	�(�?�:����������������
�
�	�+�,�,�,�,���
�
�
���
����
F��"�C�(�(���+�+�-�-��	���	�	�	�
���	�	�D��y�y��)�)�R�/�/�,�t�3���
���
��F�A�A��,�g�6�6�6�6�6���W��F�F�F��<�c�!�f�f�E�E�E�E�E�E�E�E�E�����F���s<�=A�A�A�A(�(
A5�4A5�9A<C7�7D0�D+�+D0c�x�ddlm}|tt��|tt
��|tt��	tj	�
t��sdStt��}d}d}g}|D]\}|�
d��dkrd}|s|�||��|�
d��dkr|rd}|dz
}�]tt|��dS#t t"f$r(}t%d	t'|����Yd}~dSd}~wwxYw)
Nr)�remove_da_hookFz9/usr/sbin/cagefsctl --set-default-user-status "$username"r(T�fir,z*Failed to remove old hook for DirectAdmin:)�(clcommon.public_hooks.bundle.directadminrD�DA_CREATE_USER_HOOK_FILENAME�DA_CREATE_USER_HOOK_CMD�DA_REMOVE_USER_HOOK_FILENAME�DA_REMOVE_USER_HOOK_CMD�DA_RESTORE_USER_HOOK_FILENAME�DA_RESTORE_USER_HOOK_CMDr@�path�isfile�DA_HOOK_DESTrr1�appendr%r5r6r	r7)rDrr8�start_delete�new_contentr;r<s       r�da_hooks_removerS�sk��G�G�G�G�G�G��N�/�1H�I�I�I��N�/�1H�I�I�I��N�0�2J�K�K�K�J��w�~�~�l�+�+�	��F�"�<�0�0��
�������
	�
	�D��y�y�T�U�U�Y[�[�[�#���
/��"�"�7�1�:�.�.�.��	�	�$���2�%�%�<�%�$��
��F�A�A��<��5�5�5�5�5���W��J�J�J��@�#�a�&�&�I�I�I�I�I�I�I�I�I�����J���s�
$D�0BD�D9�D4�4D9c�F�tD]}t|t����dS)z;
    Remove all Plesk hooks installed by this package.
    )�bin_dirN)�_OLD_CAGEFS_PLESK_HOOKSr
�_OLD_CAGEFS_PLESK_HOOKS_DIR)�hooks r�plesk_hooks_removerY�s8��(�V�V��*�4�9T�U�U�U�U�U�V�Vrc�
�	tj�|��sdSd}|�ddddt	t|����g��dz}t
|d��}|���}|���d}tt|����D�]�}||���}|�d	���sb|�
��}	t|	��}
|
d
k�r8|	ddk�r+|
d
kr+|dzt	t|����z}|dz||<n�|
d
kr+|dzt	t|����z}|dz||<n�|
dkr�	t|	d
��}n#t$r|||<d}Yn�wxYw|t|��kr}|�|	d|	d|	d|	d
t	t|����g��}|
dkr#||z|�|	dd���z}|dz||<d}n���|r@t
|d��}|D]}|�|���|���dSt
|d��}|�|��|���dS#t t"f$r+}t%d|zt	|����Yd}~dSd}~wwxYw)Nz      �session�requiredz
pam_lve.so�500r*rFr+��z      500     �z     �Trr,�rr.z!configure_pam_lve error for file )r@rMrNr"r7�intrrr�ranger2r4r/�split�
ValueErrorr#r6r5r	)
�
configfile�enable�SPACE�DEFAULTr�lines�foundr8r;�s�l�vr<s
             r�configure_pam_lverp�s��-N��w�~�~�j�)�)�	��F����*�*�i��\�5�#�c�RX�k�k�JZ�JZ�[�\�\�_c�c����S�!�!�����
�
��	���	�	�	����s�5�z�z�"�"�	�	�A���8�>�>�#�#�D��?�?�3�'�'�
��J�J�L�L����F�F����F�F��1���!5�!5��A�v�v�#�&6�6��S��[�[�9I�9I�I��#'�$�;��a����a���#�g�~��C��K�K�0@�0@�@��#'�$�;��a����a���"� #�A�a�D�	�	�A�A��)�"�"�"�'.�E�!�H�$(�E�!�E�E�"������F���+�+�#(�:�:�q��t�Q�q�T�1�Q�4��1��s�3�v�;�;�GW�GW�.X�#Y�#Y�D� �A�v�v�'+�e�|�e�j�j��1�2�2��6G�6G�'G��'+�d�{�E�!�H� �E��E���	��Z��%�%�A��
�
������
�
�
�
�
�G�G�I�I�I�I�I��Z��%�%�A�
�G�G�G����
�G�G�I�I�I�I�I���W��N�N�N��7�*�D�c�!�f�f�M�M�M�M�M�M�M�M�M�����N���sH�K�E!K�F�K�F0�,K�/F0�0CK�9K�L� K=�=Lc�$�td|��td|��tj�d��rtd|��n/tj�d��rtd|��td|��dS)Nz/etc/pam.d/sshdz
/etc/pam.d/suz/etc/pam.d/crondz/etc/pam.d/cronz/etc/pam.d/atd)rpr@rMrN)rhs r�configure_pam_lve_for_cagefsrr�s����'��0�0�0��o�v�.�.�.�	�w�~�~�(�)�)�5��,�f�5�5�5�5�	����)�	*�	*�5��+�V�4�4�4��&��/�/�/�/�/rc���t��td��t��}|tkrt	��|t
krt
��dSdS)NT)r=rrr
rrSrrY)�cp_names r�HooksInstallru�sd������ ��&�&�&��k�k�G��"�"�"������*����������rc�@�t��td��dS)NF)rBrr�rr�HooksRemoverx�s"������ ��'�'�'�'�'r)r)(�__doc__�
__future__rrrr�futurer�install_aliases�builtinsr@�secureior	�clcommon.cpapir
rr�"clcommon.public_hooks.bundle.pleskr
r0�SOURCE_HOOKS_DIRrGrKrIrHrLrJrOrWrVrr%r=rBrSrYrprrrurxrwrr�<module>r�s����'�&�&�&�&�&�������%�%�%�%�%�%�'�'�'�'�'�'�#�#�#�#�#�#� �� �"�"�"�����	�	�	�	� � � � � � �B�B�B�B�B�B�B�B�B�B�Q�Q�Q�Q�Q�Q�8��4�� 5�� 6��5��[��]��\���/�1�4P�P�SV�V�Yu�u��F��)�+G�H�)�+G�H�)�+G�H�)�+G�H�	���������� C� C� C�HF�F�F�>J�J�J�@V�V�V�.N�.N�.N�b0�0�0�	�	�	�(�(�(�(�(r

Zerion Mini Shell 1.0