Mini Shell

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

�

'!<�lǎN��$�ddlmZddlmZddlmZddlmZddlmZej��ddlTddl	Z	ddl
ZddlZddl
Z
ddlZddlZddlmcmZddlZddlmZddlZdd	lmZdd
lmZddlZddlZddlZddlmZddl Z ddl!m"Z"m#Z#dd
l$m%Z%m&Z&ddl'm(Z(m)Z)m*Z*da+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4d�Z5dZ6d�Z7d�Z8d�Z9d�Z:d8d �Z;d!�Z<d"�Z=d#�Z>d9d$�Z?d%�Z@d&�ZAd'�ZBe,fd(�ZCd)�ZDd*�ZEd+�ZFd,�ZGd-�ZHd.�ZId/�ZJd0�ZKd9d1�ZLd9d2�ZMd3�ZNd4�ZOd5�ZPd6�ZQd7�ZRdS):�)�print_function)�absolute_import)�division)�unicode_literals)�standard_library)�*N)�
parse_version)�touch)�write_file_content)�$install_ispmanager_directory_exclude)�is_ea4_enabled�read_cpanel_ea4_php_conf)�PROXY_COMMANDS�check_cagefs_skeleton)�mod_makedirs�get_file_lines�delete_line_from_file�z/usr/local/bin/lsphpz/var/run/postgresz/etc/sysconfig/postgresz/var/run/postgresqlz
hdir:/.cagefsz!/etc/cagefs/cagefs.base.home.dirsz/var/lib/php/sessionz/usr/local/directadmin/sharedz"/usr/local/directadmin/directadminc��tj��sdStj�t
��r.t
jd�t
����dSd�tj
��}	tj�t
��r[tt
d��5}|�
��}||vr|�|��ddd��n#1swxYwYnWtt
d��5}|�d��|�|��ddd��n#1swxYwYtjt
d��dS#t t"f$r3}t
jdt
t%|����Yd}~dSd}~wwxYw)Nz!Error: "{}" shouldn't be a folderz
^{}/[^/]+
zr+�wzmount_basedir=1
�zFailed to write )�detect�is_plesk�os�path�isdir�PLESK_BASE_HOME_DIRS_FILE�secureio�print_error�format�	cagefslib�PLESK_VHOSTS_D�exists�open�	readlines�write�chmod�OSError�IOError�str)�current_vhosts_d_regexp�f�content�es    �e/builddir/build/BUILDROOT/cagefs-7.6.19-1.el9.cloudlinux.x86_64/usr/share/cagefs/cagefsreconfigure.py�create_plesk_base_home_dirsr0;s*���?������	�w�}�}�.�/�/����B�28�&�9R�2S�2S�	U�	U�	U���+�2�2�9�3K�L�L��
9�
�7�>�>�3�4�4�	1��/��6�6�
5�!��+�+�-�-��*�'�9�9��G�G�3�4�4�4�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5��
�/��5�5�
1�����+�,�,�,����/�0�0�0�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1����
1�
1�
1�
1�	��*�E�2�2�2�2�2���W��9�9�9���/�1J�14�Q���	9�	9�	9�	9�	9�	9�	9�	9�	9�����9���s`�9E:�.C;�/E:�;C?�?E:�C?�E:�+E�E:�E�E:�E�E:�:F>�(F9�9F>z//usr/local/cpanel/sys_cpanel/boxtrapper-messagec�2�ttd���dS)NT��	read_only)�add_mount_to_cagefs_mp�BOX_TRAPPER_DIR��r/�add_boxtrapper_dir_cpanelr8Xs���?�d�;�;�;�;�;�;r7c�4�ttdd���dS)NT�700��personal�perm)r4�PLESK_PHP_SESSION_DIRr6r7r/�add_php_session_dir_pleskr?\s���0�4�e�L�L�L�L�L�Lr7c�6�d}|D]}t|d����dS)z;
    Add mounts related to ClamAV into cagefs.mp file.
    )z/usr/local/share/clamavz/var/lib/clamavTr2N�r4)�clamav_database_dirs�	directorys  r/�add_mounts_for_clamavrD`s:��J��)�:�:�	��y�D�9�9�9�9�9�:�:r7c�6�d}|D]}t|d����dS)zF
    Add mounts related to Phusion Passenger into cagefs.mp file.
    )z/var/run/ea-passenger-runtimez/usr/share/passengerz/usr/libexec/passengerFr2NrA)�passenger_dirsrCs  r/�add_mounts_for_passengerrGis:���N�
$�;�;�	��y�E�:�:�:�:�:�;�;r7Fc��|r|rtd���ddl}|s tj�|���rtj�d��r�|���|�|jdd���}|dz|j	vr�|tj|j|j
|j|j��vr~|rd|z}|r|dz|z}n|rd	|z}t!dd
��}|�|���dz��|���t)d��dSdSdSdSdS)Nz5read_only and personal can`t be true in the same timerz/etc/cagefs/cagefs.mpT)r�skip_errors�skip_cpanel_check�
�@�,�!�atz/usr/share/cagefs/need.remount)�
ValueError�	cagefsctlrrr�isfile�
check_mp_file�MountpointConfig�
ETC_MPFILE�
common_mounts�	itertools�chain�read_only_mounts�personal_mounts�splitted_by_username_mounts�splitted_by_uid_mountsr$r&�strip�closer
)�liner3r<r=rQ�	mp_configr,s       r/r4r4vs����R�X�R��P�Q�Q�Q������4�B�G�M�M�$�'�'�4�R�W�^�^�<S�-T�-T�4����!�!�!��.�.��%��"�/�
�
�	�
�$�;�i�5�5�5��	��	�0J�09�0I�09�0U�09�0P�!R�!R�R�R��
"��T�z���-��#�:��,�D���
"��T�z���,�d�3�3�A�
�G�G�D�J�J�L�L��%�&�&�&�
�G�G�I�I�I��2�3�3�3�3�3�+4�4�4�4�6�5�R�Rr7c�0�tj���rtj�t
��st
t��dStjt
dd��}|dkrt}nh|tkr]	tj
|t��nA#tf$r3}tj
dtt|����Yd}~dSd}~wwxYw	tjd��}n;#t"f$r-}tj
dt|����Yd}~dSd}~wwxYw|j}|j}tj�|��sN	t+|d	��n<#tf$r.}tj
d
|t|����Yd}~dSd}~wwxYw	tj|||��n<#tf$r.}tj
d|t|����Yd}~dSd}~wwxYwt
t��dSdS)NT�SOCK_DIR�=rzfailed to create symlinkF�postgreszfailed to find 'postgres' user���failed to createzfailed to change owner of)r�detect_postgresqlrrrR�
POSTGRES_CONFr4�POSTGRES_CL7_FOLDER�get_param_from_file�DEFAULT_POSTGRES_FOLDER�symlinkr(rrr*�pwd�getpwnam�KeyError�pw_uid�pw_gid�lexistsr�chown)�postgres_folderr.�pg_user�postgres_uid�postgres_gids     r/�postgresql_configurerx�sB��
��!�!�&��w�~�~�m�,�,�	�"�#6�7�7�7��4� �4�]�J�PS�T�T���b� � �5�O�O�
� 7�
7�
7�
��
�?�,C�D�D�D�D���:�
�
�
��$�%?�AX�Z]�^_�Z`�Z`�a�a�a��u�u�u�u�u�����
����	��l�:�.�.�G�G���{�	�	�	�� �!A�3�q�6�6�J�J�J��5�5�5�5�5�����	�����~���~���w����/�/�	�
��_�e�4�4�4�4���:�
�
�
��$�%7��#�a�&�&�Q�Q�Q��u�u�u�u�u�����
����	��H�_�l�L�A�A�A�A���z�	�	�	�� �!<�o�s�ST�v�v�V�V�V��5�5�5�5�5�����	����	�6�7�7�7��t��5s`�B�C�*(C�C�!C6�6D.�"D)�)D.�E0�0F)�;#F$�$F)�-G�G=�#G8�8G=c�@�tdkr�	tjtj��adS#ddl}t
|���tj	���tjdtjzdz��tjd��YdSxYwdS)Nrr��file�bad � file�)
�
LITESPEED_XML�xml�parser�LITESPEED_CONFIG_FILE�	traceback�print�
format_exc�sys�stderrrr�exit)r�s r/�litespeed_config_readr��s�������	��I�f�&B�C�C�M�M�M��	������)�&�&�(�(�s�z�:�:�:�:�� ��&�*F�!F��!P�Q�Q�Q��H�Q�K�K�K�K�K�K�����s
�-�A+Bc�D�tj��r�tjtjtjdz��ttjd��}|�t�ddd�����|�	��dSdS)Nz.cagefs�wbrzUTF-8)�indent�newl�encoding)
r�detect_enterprise_litespeed�shutil�copyfiler�r$r&r�toprettyxmlr^)r,s r/�litespeed_config_writer��s���
�)�+�+�����4�V�5Q�T]�5]�^�^�^���-�t�4�4��	���
�)�)��"�w�)�O�O�P�P�P�	���	�	�	�	�	�	�r7c��tj���rht��|dkrd}n|}	t�d��d�d��djj}|}|dkst|��dkrRt|��t�d��d�d��dj_|}n�#t$r�t�
d��}t�t|����}|�|��t�d��d�|��|}YnwxYw|SdS)N��httpServerConfigr�	enableLVE�
rr�r�r�getElementsByTagName�
firstChild�	nodeValue�intr*�
IndexError�
createElement�createTextNode�appendChild)�force_value�	new_value�enableLVE_value�resultr�s     r/�litespeed_enableLVE_configurer��s���
�)�+�+�������$����I�I�#�I�	�+�@�@�AS�T�T�UV�W�l�l�mx�y�y�z{�|�H�R�O�$�F��t�#�#�s�?�';�';�a�'?�'?�GJ�KT�GU�GU�
�2�2�3E�F�F�q�I�^�^�_j�k�k�lm�n�y�D�"�����	�	�	�%�3�3�K�@�@�I�+�:�:�3�y�>�>�J�J�O��!�!�/�2�2�2��.�.�/A�B�B�1�E�Q�Q�R[�\�\�\��F�F�F�	�����
�%�s�B0C � BE8�7E8c���tj���rSt��	t�d��d�d��djj}t|��dkrRtd��t�d��d�d��dj_dSdS#t$r�t�
d��}t�td����}|�|��t�d��d�|��YdSwxYwdS)Nr�r�	phpSuExecr~r�)�phpSuExec_valuer�s  r/�litespeed_phpSuExec_configurer��su��
�)�+�+�
]�����	]�+�@�@�AS�T�T�UV�W�l�l�mx�y�y�z{�|�H�R�O��O�$�$��)�)�GJ�KL�GM�GM�
�2�2�3E�F�F�q�I�^�^�_j�k�k�lm�n�y�D�D�D�*�)���	]�	]�	]�%�3�3�K�@�@�I�+�:�:�3�q�6�6�B�B�O��!�!�/�2�2�2��.�.�/A�B�B�1�E�Q�Q�R[�\�\�\�\�\�\�		]����
]�
]s�B&C�BE%�$E%c�8�tj��}t�d��d�d��}|sQt	|��t	d��kr1tdtjzdzdzdztj�	��|S)
z�
    CAG-914
    Check if there is extProcessorList section
    If not, print doc link to configure LiteSpeed
    Starting from LSWS v5.3 external apps and script handlers are no longer required.
    r�r�extProcessorListz5.3z%No extProcessorList section in file:
z'
Please configure LiteSpeed Web Server z+using Web Admin Console as discribed here:
z;https://docs.cloudlinux.com/php_selector/#litespeed-supportrz)	r�get_litespeed_versionrr�r	r�r�r�r�)�litespeed_version�checks  r/�check_extProcessorListr��s����4�6�6���.�.��
 �
 � !�
#�#7�#7�8J�#K�#K�
���]�#4�5�5�
�e�8L�8L�L�L�
�6��*�+�8�9�=�=�L�	L�
�:�	�	�	�	��Lr7c�.�tj���rt��	t��}|sdS|d�d��}|D�]D}t|�d��djj��dk�r
	|�d��djdkrht|�d��djj��}|dvr2td��|�d��dj_��#t$rot�
d��}t�td����}|�|��|�|��Y��@wxYw��FdS#t$rmddl
}t|���t j���t%jd	tjzd
z��t!jd��YdSwxYwdS)NTr�extProcessor�name�lsphp5�runOnStartUp)�1�0rzr|r}r~)rr�r�r�r�r*r�r�r�rr�r�r�r�r�r�r�r�rrr�r�)�check_nodelist�nodelist�node�runOnStartUp_valuer�r�s      r/� litespeed_runOnStartUp_configurer�s��
�)�+�+������	�3�5�5�N�!�
��t�%�a�(�=�=�n�M�M�H� �
7�
7����1�1�&�9�9�!�<�G�Q�R�R�V^�^�^�	7� �5�5�n�E�E�a�H�S�W[�[�[�14�T�5N�5N�~�5^�5^�_`�5a�5l�5v�1w�1w�.�#5��#B�#B�dg�hi�dj�dj�� 9� 9�.� I� I�!� L� W� a���%�7�7�7�'4�'B�'B�>�'R�'R��-:�-I�-I�#�a�&�&�-Q�-Q�*�$�0�0�1C�D�D�D��(�(��6�6�6�6�6�	7����
_�
7�
7���	�	�	������)�&�&�(�(�s�z�:�:�:�:�� ��&�*F�!F��!P�Q�Q�Q��H�Q�K�K�K�K�K�K�		����'�s>�F�AF�BD�F�A5F�F�F�F�A3H�Hc�x�tj���r%t��	t��}|sdS|d�d��}|D]j}t|�d��djj��dkr2t|��|�d��dj_�kny#t$rlddl	}t|���tj
���tjd	tjzd
z��tjd��YnwxYwdSdS)
z:
    LiteSpeed extProcessorList->path change for php5
    Trr�r�r�rNrzr|r}r~F)rr�r�r�r�r*r�r�r�r�r�r�r�r�rrr�r�)�lsphp5_pathr�r�r�r�s     r/�litespeed_lsphp5_path_changer�/sG���)�+�+������	�3�5�5�N�!�
��t�%�a�(�=�=�n�M�M�H� �
a�
a����1�1�&�9�9�!�<�G�Q�R�R�V^�^�^�PS�T_�P`�P`�D�-�-�f�5�5�a�8�C�M��
a���	�	�	������)�&�&�(�(�s�z�:�:�:�:�� ��&�*F�!F��!P�Q�Q�Q��H�Q�K�K�K�K�K�		����
�t��us�B?�BB?�?A3D5�4D5c�h�	tjddd|gd���dS#tj$rYdSwxYw)zO
    Perform '/usr/local/directadmin/custombuild/build set cagefs' command
    �(/usr/local/directadmin/custombuild/build�set�cagefsT�r�N��
subprocess�run�CalledProcessError)�options r/�custombuild_set_cagefsr�Gs`�����
7���&�Q��	
�	
�	
�	
�	
�	
���(����������s��1�1c�d�	tjddgd���dS#tj$rYdSwxYw)zR
    Perform '/usr/local/directadmin/custombuild/build rewrite_confs' command
    r��
rewrite_confsTr�Nr�r6r7r/�custombuild_rewrite_confsr�Ts\�����
7��I��	
�	
�	
�	
�	
�	
���(����������s��/�/c��	t��td��t��t��t	��dS#YdSxYw�Nr�TF)r�r�r�r�r�r6r7r/�litespeed_configure_selectorr�bsZ���$�&�&�&�%�a�(�(�(�%�'�'�'�(�*�*�*�� � � ��t����u�u���s�AA�Ac��tj��r2tj��rtd��t	��dSdS)z;
    OpenLitespeed configure for CageFS on DirectAdmin
    �yesTF)r�detect_open_litespeed�is_dar�r�r6r7r/�configure_open_litespeedr�nsF���#�%�%��&�,�.�.���u�%�%�%�!�#�#�#��t��5r7c��	tt����dkrt��t��dS#YdSxYwr�)r�r�r�r�r6r7r/�litespeed_configurer�zsN����,�.�.�/�/�1�4�4�)�+�+�+�� � � ��t����u�u���s	�;?�Ac
���d}tj��rtj�|��sdS	tj|dd��}|�d��}t|��dkr|d}|dkrdStj	d|gd	td
��tjtjddd�
��}|j
���}tdd��}|�|dz��|���tjdd��dS#t$t&f$r-}t)jdt-|����Yd}~dSd}~wwxYw)Nz/usr/local/assp/assp.cfg�sendAllSpamz:=rLr�r~rz/scripts/whoownsFz	/dev/nullTz	/scripts/)�shell�stdin�stdoutr��	close_fds�cwd�textz/etc/cagefs/exclude/assp-deluxerrKrz*Failed to disable CageFS for ASSP Deluxe: )r�	is_cpanelrrrRrj�split�lenr��Popenr$�PIPE�STDOUTr��readr&r^r'r(r)rrr*)�config_file�
adm_domain�parts�p�	user_namer,r.s       r/�disable_cagefs_for_assp_deluxer��s��,�K������R�W�^�^�K�%@�%@����S��/��]�D�Q�Q�
�� � ��%�%���u�:�:��?�?��q��J������F�
��0�*�=�U�RV�Wb�Rc�Rc�lv�l{�!�(�D�k�PT�
V�
V�
V���H�M�M�O�O�	�
�2�C�8�8��	���	�$�����	���	�	�	�
��2�E�:�:�:�:�:���W��S�S�S���I�3�q�6�6�R�R�R�R�R�R�R�R�R�����S���s�AD1�B)D1�1E/�"E*�*E/c��tj��tjd}t��rwtj�|��sXt��}|rH	|d}n#t$rgcYSwxYw|�	d��sgSd�
|��}tj�|��r|tj||d��fgStjdt|����gS)z�
    Return parameter and its value from native php.ini
    :param param_name: name of parameter in php.ini
    :type param_name: string
    zphp.ini�defaultzea-phpz/opt/cpanel/{}/root/etc/php.inirc�failed to open file)r!�read_native_conf�
orig_binariesr
rrrRrro�
startswithr rrjrrr*)�
param_name�ini_file�conf�default_phps    r/�get_native_settingsr��s���� � � ��&�y�1�H����M�����x� 8� 8�M�'�)�)���		M�
�"�9�o�����
�
�
��	�	�	�
�����)�)�(�3�3�
��	�8�?�?��L�L�H�	�w�~�~�h���U��V�7��*�c�R�R�S�T�T���.��H�
�
�>�>�>�
�Is�$A-�-A<�;A<c��d}g}tj�|��r�t|��}t	jdd���}	|�|��n#tj$rgcYSwxYw|���D]*}|�	|�
|�����+|���|S)z-
    Return settings from global_php.ini
    z/etc/cl.selector/global_php.iniNF)�
interpolation�strict)rrrRr$�configparser�ConfigParser�readfp�Error�sections�extend�itemsr^)�
GLOBAL_INI�settingsr,�cfg�sects     r/�get_global_php_settingsr�s���3�J��H�	�w�~�~�j�!�!�	�������'�d�5�I�I�I��	��J�J�q�M�M�M�M���!�	�	�	��I�I�I�	�����L�L�N�N�	-�	-�D��O�O�C�I�I�d�O�O�,�,�,�,�	���	�	�	��Os�
A � A4�3A4c	��|sdS|gkrddg}n|�g}tj��D�]}tj�d|d��}tj�|���r�t
|d��}|���}|D�];}d}tj	d|d	zd
z��}ttt|������D]�}	|�
||	��}
|
r�|r$||	d	dkrd||	zdz||	<�E||	�d
d��\}}|���dvs*|���r|���|vr|d	dz|dzdz||	<d}��|s*|�|d	dz|dzdz����=|���t
|d��}|�|��|������t'jdt+|������dS)av
    Replace or add settings in php.ini for all alt-php versions
    :param settings: list of tuples like [('date.timezone', 'Europe/Moscow'), ('error_log', 'error_log')]
    :param overwrite_list: list of options to overwrite; empty list [] == overwrite all the two options ('error_log', 'date.timezone')
                           None == do not overwrite the options
    N�	error_log�
date.timezonez	/opt/alt/zetc/php.ini�rFz;*\s*rz\s*=.*�;rKrcr~)rrz = Trr�)r!�get_alt_dirsrr�joinrRr$r%�re�compile�reversed�ranger��matchr�r]�appendr^�
writelinesrrr*)
r�overwrite_list�alt_dirrr,r��setting�changed�prog�ir��param�values
             r/�reconfigure_alt_settingsr�s^����������%��7���	�	����)�+�+�C�C���w�|�|�K��-�@�@��
�7�>�>�$���	C��T�3���A��;�;�=�=�D�#�
H�
H�����z�'�G�A�J�"6��"A�B�B��!�%��D�	�	�"2�"2�3�3�
+�
+�A�!�Z�Z��Q��0�0�F��+�"�+�#�A�w�q�z�S�0�0�*-��Q��-�$�*>��Q���+/��7�=�=��a�+@�+@�L�E�5�$�{�{�}�}�4R�R�R�Z_�Ze�Ze�Zg�Zg�R�kp�kv�kv�kx�kx�}K�lK�lK�*1�!�*�u�*<�w�q�z�*I�D�*P��Q��&*�G���H��K�K���
�U� 2�W�Q�Z� ?�$� F�G�G�G��
�G�G�I�I�I��T�3���A�
�L�L�����
�G�G�I�I�I�I�� �!6��D�	�	�B�B�B�B�5C�Cr7c�~�d}|dkr�g}|r�|D]�}t|�d����}|�ddg��sAtd��td��td��t	jd��|�|����t��}td	�|D����d
kr"|�td����td�|D����d
kr"|�td����t||��dS)a&
    Replace or add settings in php.ini for all alt-php versions
    :param options: list of options to overwrite; empty list [] == overwrite all the two options ('error_log', 'date.timezone')
                                    None == do not overwrite the options
    :type options: list
    NrMrrz<Error: incorrect parameter of --apply-global-php-ini option:zGPlease use 0, 1 or 2 parameters from the list: error_log, date.timezonezausing --apply-global-php-ini without arguments applies all global php options including two abover~c�*�g|]}|ddk�|��S)rrr6��.0�xs  r/�
<listcomp>z(replace_alt_settings.<locals>.<listcomp>s&��7�7�7�!�1�Q�4�;�#6�#6�A�#6�#6�#6r7rc�*�g|]}|ddk�|��S)rrr6rs  r/r"z(replace_alt_settings.<locals>.<listcomp>s&��;�;�;�!�1�Q�4�?�#:�#:�A�#:�#:�#:r7)r�r��issubsetr�r�r�r�rr�r�r)�optionsr�arg�srs     r/�replace_alt_settingsr(�sJ���N��$������	)��
)�
)����	�	�#���'�'���z�z�;��"@�A�A� ��X�Y�Y�Y��c�d�d�d��}�~�~�~��H�Q�K�K�K��%�%�a�(�(�(�(�&�(�(�H�
�7�7�x�7�7�7�8�8�A�=�=����+�K�8�8�9�9�9�
�;�;�x�;�;�;�<�<��A�A����+�O�<�<�=�=�=��X�~�6�6�6�6�6r7c�&�tj��sdS	tj�d��r�tdd��}|���}|���d}|D]$}|�t��dkrd}n�%|s0|�
dtzdz��td|��n-tdtdz��tjdd��tj�d��r�tdd��}|���}|���d}|D]-}|�
���d	��rd}n�.|s'|�
d
��td|��dSdStdd��tjdd��dS#tt f$r-}t#jdt'|����Yd}~dSd}~wwxYw)
Nz/etc/cxs/cxs.ignorer	F���TrKi�z/etc/cxs/cxs.defaultzignore=/etc/cxs/cxs.ignorez
ignore=/etc/cxs/cxs.ignore
zignore=/etc/cxs/cxs.ignore
z/Failed to change CXS configuration for CageFS: )r�	CXS_checkrrrRr$r%r^�find�CXS_IGNORE_COMMANDrrr'r]r�r(r)rrr*)r,r-�CXS_HOOK_INSTALLEDr_�IGNORE_HOOK_INSTALLEDr.s      r/�
configure_cxsr0sM���������%X�
�7�>�>�/�0�0�	3��*�C�0�0�A��k�k�m�m�G�
�G�G�I�I�I�!&���
�
���9�9�/�0�0�B�6�6�)-�&��E�7�&�
C����t�&8�8�4�?�@�@�@�"�#8�'�B�B�B���4�6H�4�6O�P�P�P��H�*�E�2�2�2��7�>�>�0�1�1�	4��+�S�1�1�A��k�k�m�m�G�
�G�G�I�I�I�$)�!��
�
���:�:�<�<�*�*�+G�H�H��,0�)��E��)�
D����I�J�J�J�"�#9�7�C�C�C�C�C�
D�
D�
�5�7U�V�V�V��H�+�U�3�3�3�3�3���W��X�X�X���N�PS�TU�PV�PV�W�W�W�W�W�W�W�W�W�����X���s�FG�+%G�H�#"H�Hc�N�tj�t��rt	t��dS	ttd��t	t��dS#t$r3}tjdtt|����Yd}~dSd}~wwxYw)a�
    Create '/usr/local/directadmin/shared' directory if it doesn't already exist
    and add a corresponding line into the '/etc/cagefs/cagefs.mp' file.

    This directory is intended for storing files available to all users.
    Recent versions of DA panel will create this directory themselves,
    creation of the directory in our code is made for backwards compatibility
    with older DA panels.
    rerfN)
rrr#�
DA_SHARED_DIRr4rr(rrr*)r.s r/�_add_da_shared_dir_to_cagefs_mpr3Ds���
�w�~�~�m�$�$�2��}�-�-�-�-�-�	2����.�.�.�
#�=�1�1�1�1�1���	L�	L�	L�� �!3�]�C��F�F�K�K�K�K�K�K�K�K�K�����	L���s�A'�'
B$�1(B�B$c
�H�dt��}tj��ttj��td��kr�	tt��}|d�|D��vrj|r |d���dz|d<|�|dz��tj
d�|��td��d
Sd
S#t$r5}tj
d|d	tt|����Yd
}~d
Sd
}~wwxYw	tt|��nA#t$r4}tj
d|dtt|����Yd
}~nd
}~wwxYwt!��r#t#jgd
�t�d�d���d
Sd
S)a�
    Add a line containing the path to DA binary into the 'proxy.commands' file
    if DA panel version < 1.62.8. If DA panel version >= 1.62.8 remove this line.

    Starting '1.62.8' version DA no longer supports having suid bit set on DA binary,
    version < 1.62.8 means DA binary have suid bit, it should be executed via proxyexec,
    hence, we should add a line that contains path to DA binary
    into the 'proxy.commands' file if it is not already there.
    zDIRECTADMIN=z1.62.8c3�>K�|]}|���V��dS�N)r])r r_s  r/�	<genexpr>z8_configure_proxy_commands_file_for_da.<locals>.<genexpr>js*����%S�%S�t�d�j�j�l�l�%S�%S�%S�%S�%S�%Sr7r*rKrrz
failed to add�intoNzfailed to remove�from)z/usr/sbin/cagefsctlz--wait-lockz
--update-listT)�inputr�)�DA_BINr�getCPr	�
CP_VERSIONrrr]rr�write_file_via_tempfilerr(rr*rrr�r�)�da_binary_line�proxy_command_linesr.s   r/�%_configure_proxy_commands_file_for_darAYs0��-�F�,�,�N�
�L�N�N�N��V�&�'�'�-��*A�*A�A�A�
	Q�"0��"@�"@���%S�%S�?R�%S�%S�%S�S�S�&�U�.A�"�.E�.K�.K�.M�.M�PT�.T�'��+�#�*�*�>�D�+@�A�A�A��0��G�G�/�0�0�.�%�I�I�I�I�I�	T�S���	Q�	Q�	Q�� ������Q���
Q�
Q�
Q�
Q�
Q�
Q�
Q�
Q�
Q�����	Q����	T�!�.�.�A�A�A�A���	T�	T�	T�� �"�N�F�N�C�PQ�F�F�
T�
T�
T�
T�
T�
T�
T�
T�����	T����!�"�"�	t��N�R�R�R�]c�Zg�Zg�Zg�nr�s�s�s�s�s�s�	t�	ts1�	B
C�
D�!*D�D�D0�0
E.�:*E)�)E.c�h�tj��sdSt��t��dS)z1
    Configure CageFs for Directadmin panel.
    N)rr�r3rAr6r7r/�directadmin_configurerC~s5���<�>�>����#�%�%�%�)�+�+�+�+�+r7c��ddl}t��rtj��t	��t��t
��tj��t��|�
��tj��r"|�
��t��tj��rt!��tj��rt%��|���|���t+tjdd���t/��t1��dS)NrTr:r;)rQrxr!�detect_postgresr0rr��
cagefs_da_lib�"configure_selector_for_directadminr0�
check_excluderr��add_spamassassin_dirs_cpanelr8rr?r�rC�add_mount_for_php_apm�add_mounts_for_ea_php_sessionsr4�VAR_RUN_CAGEFSrDrG)rQs r/�reconfigure_cagefsrM�s8���������$��!�#�#�#��!�!�!�(�*�*�*�"�$�$�$��4�6�6�6��O�O�O�
������
����$��.�.�0�0�0�!�#�#�#�
����$�!�#�#�#�
�|�~�~� �����
�#�#�%�%�%�
�,�,�.�.�.��9�3�d��O�O�O�O����������r7)FFrr6)S�
__future__rrrr�futurer�install_aliases�builtinsrW�cldetectlibrrrmr�r��xml.dom.minidom�dom�minidomr�r��
pkg_resourcesr	r!r
�cagefshooksrr�r
r�cagefs_ispmanager_librrF�clcagefslib.selector.configurer
rrQrr�clcommon.utilsrrrr�LSPHP5_PATHrkrhrir-rr>r2r;r0r5r8r?rDrGr4rxr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr(r0r3rArCrMr6r7r/�<module>r\s���$&�%�%�%�%�%�&�&�&�&�&�&�������'�'�'�'�'�'�#�#�#�#�#�#� �� �"�"�"������������������������������������������'�'�'�'�'�'�����������*�*�*�*�*�*�����	�	�	�	�����F�F�F�F�F�F�����S�S�S�S�S�S�S�S�;�;�;�;�;�;�;�;�N�N�N�N�N�N�N�N�N�N��
�$��-��)�
�+��$��?��.��/�
�+��9�9�9�4D��<�<�<�M�M�M�:�:�:�
;�
;�
;�4�4�4�4�:)�)�)�^	�	�	��������.]�]�]����,���80;�����0
�
�
�
�
�
�	�	�	�������S�S�S�<���4���&'C�'C�'C�'C�T7�7�7�7�8)X�)X�)X�X2�2�2�*"t�"t�"t�J,�,�,�����r7

Zerion Mini Shell 1.0