- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 52.15.57.54
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 8.2.26
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/cagefs/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/cagefs/__pycache__/sanity_check.cpython-311.pyc
�

��cg�&��(�ddlmZddlmZddlmZddlmZddlmZej��ddlTddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZdd	lmZdd
lmZddlmZmZmZmZmZmZddlmZdd
lmZm Z dZ!	ddl"m#Z#m$Z$m%Z%m&Z&m'Z'n##e($rdZ!dZ%dZ&dZ'dZ)edddg��Z$YnwxYwd�Z*de*_+d�Z,de,_+d�Z-de-_+d�Z.de._+d �Z/d!�Z0d"e0_+d#�Z1d$e1_+d%�Z2d&e2_+d'�Z3d(e3_+e*e,e-e.e0e1e2e3fZ4d)�Z5d*�Z6dS)+�)�print_function)�absolute_import)�division)�unicode_literals)�standard_library)�*N)�
clconfpars)�chain)�
namedtuple)�MountpointConfig�
DISABLE_ETCFS�get_cagefs_users�enabled_dir�disabled_dir�build_wrappers_dicts)�CageFSException)�is_ea4_enabled�read_cpanel_ea4_php_confT)�runner�	ChkResult�OK�FAILED�SKIPPEDFrrr�INTERNAL_TEST_ERRORr�res�msgc�|�tdd���}g}t|j|j|j��D]J}|���}tj�|��s|�	|���K|r(ttd�|����Sttd��S)NT)�skip_errors�ignore_cachez"There are missing mount points: {}zNo missing mount points found)rr
�
common_mounts�splitted_by_username_mounts�splitted_by_uid_mounts�strip�os�path�isdir�appendrr�formatr)�	mp_config�missing�p�ts    �`/builddir/build/BUILDROOT/cagefs-7.6.23-1.el8.cloudlinux.x86_64/usr/share/cagefs/sanity_check.py� check_cagefs_mount_points_existsr.7s���!�T��E�E�E�I��G�
�9�*��8��3�5�5����
�G�G�I�I���w�}�}�Q���	��N�N�1������W���!E�!L�!L�W�!U�!U�V�V�V��R�8�9�9�9�z Check cagefs mount points existsc�F�tj�t��rQtj�t��s-ttd�t����Sttd�t����S�Nz{} is not a directoryz
{} is fine)	r$r%�existsrr&rrr(r�r/r-� check_cagefs_enabled_users_isdirr4Jsl��	�w�~�~�k�"�"�N�2�7�=�=��+E�+E�N���!8�!?�!?��!L�!L�M�M�M��R��,�,�[�9�9�:�:�:r/z'Check cagefs users.enabled is directoryc�F�tj�t��rQtj�t��s-ttd�t����Sttd�t����Sr1)	r$r%r2rr&rrr(rr3r/r-�!check_cagefs_disabled_users_isdirr6Qsl��	�w�~�~�l�#�#�O�B�G�M�M�,�,G�,G�O���!8�!?�!?��!M�!M�N�N�N��R��,�,�\�:�:�;�;�;r/z(Check cagefs users.disabled is directoryc��tj�t��s-t	t
d�t����St	td�t����S)Nz{} doesn't existsz	{} exists)r$r%r2r
rrr(rr3r/r-�"check_cagefs_disabled_etcfs_existsr8XsV��
�7�>�>�-�(�(�L���!4�!;�!;�M�!J�!J�K�K�K��R��+�+�M�:�:�;�;�;r/z!Check cagefs disable.etcfs existsc�>�t��}t��}tjd��}|D]�}	tj|��}n#t
$rY�$wxYw|�|j��|jD]B}	tj
|��}n#t
$rY�$wxYw|�|j���C��|D]Z}|�|��r�	tj
|��}n#t
$rY�:wxYw|j}	|j
}
|
|vs|	|vr�U||	fcSdS)aX
    Filter out users that are in super groups and
    return username and uid of cagefs user for test
    :param groups: list of super groups
    :type groups: list of str
    :param all_enabled_users: list of cagefs users to filter
    :type all_enabled_users: list of str
    :rtype tuple (user, uid) or (None, None) when user not found
    z^cldiaguser_[a-f0-9]{21}$)NN)�set�re�compile�grp�getgrnam�KeyError�add�gr_gid�gr_mem�pwd�getpwnam�pw_uid�match�pw_gid)�groups�all_enabled_users�
super_gids�
super_uids�
re_pattern�group�g�userr+�uid�gids           r-�get_cagefs_user_for_testrR_s}�����J����J���7�8�8�J��%�%��	���U�#�#�A�A���	�	�	��H�	�������q�x� � � ��H�	%�	%�D�
��L��&�&�����
�
�
���
�����N�N�1�8�$�$�$�$�	%�"�������D�!�!�	��	���T�"�"�A�A���	�	�	��H�	�����h���h���*����z� 1� 1���S�y�����:s5�A�
A�A�?B�
B!� B!�C0�0
C=�<C=c	��	td���}n%#t$rttd��cYSwxYw|sttd��S	t	jd��}nF#ttf$r2}ttd�	|����cYd}~Sd}~wwxYw|�ttd��St|j|��\}}|�ttd��Sd�	|��}d	�	||��}	tj
|tjdd
d������n\#tj$rJ}ttd�	||j�������cYd}~Sd}~wwxYwtt$d
��S)NT��raise_exceptionzNo users with cagefs enabledz
/etc/pam.d/suz*Error parsing /etc/pam.d/su config file {}z?pam_lve configuration is not found in /etc/pam.d/su config filezCNo users with cagefs enabled (all enabled users are in super group)zYecho -n "Logged in as: $(whoami) - $(id -u) "; [ "$(id -u)" == "{0}" ] && ls /var/.cagefsz.unset BASH_ENV; su '{0}' -s /bin/bash -c '{1}'z	/bin/bash)�stderr�shell�
executable�textz{}; Output was: "{}"z,Several tested users really can enter cagefs)rrrrr	�parse_pam_lve_config�IOError�
ValueErrorrr(rRrH�
subprocess�check_output�STDOUTr#�CalledProcessError�outputr)rI�cfg�erOrP�inner�cmds       r-�check_users_can_enter_cagefsrf�s���B�,�T�B�B�B�����B�B�B���"@�A�A�A�A�A�B�����B���"@�A�A�A�Y��-�o�>�>�����Z� �Y�Y�Y���!M�!T�!T�UV�!W�!W�X�X�X�X�X�X�X�X�����Y����
�{���!b�c�c�c�(���5F�G�G�I�D�#��|���"g�h�h�h�:�;A�6�#�;�;�
�
>�
E�
E�d�E�
R�
R�C�U����J�,=�&*�{��	O�	O�	O�OT�u�w�w�w�w���(�U�U�U���!7�!>�!>�q�!�(�.�.�BR�BR�!S�!S�T�T�T�T�T�T�T�T�����U�����R�G�H�H�HsH��5�5�A%�%B(�6'B#�B(�#B(�5E�F,�"?F'�!F,�'F,z#Check cagefs users can enter cagefsc	���	td���nL#t$r?}ttd�t|������cYd}~Sd}~wwxYwttd��S)NTrTz)Proxy commands config parsing error: "{}"z%Syntax looks fine. Files are parsable)r�	Exceptionrrr(�reprr)rcs r-�)check_proxy_commands_configs_are_parsablerj�s���
�	�T�2�2�2�2�2���
�
�
���7�>�>�t�A�w�w�G�G�
�
�	
�	
�	
�	
�	
�	
�����
����
�R�@�A�A�As��
A�4A�A�Az0Check cagefs proxy commands configs are parsablec���g}tjd��}|sttd��S|D]�}t|d��5}|���}ddd��n#1swxYwYt|��dkr|�|���g|ddkr|�|����|rtt|��Sttd��S)Nz/var/cagefs/*/*/virt.mpzNo virt.mp files found�rtr�@zvirt.mp files syntax is fine)	�globrr�open�read�lenr'rr)�wrong�files�virt_mp�f�confs     r-�check_all_virt_mp_files_syntaxrw�s���E��I�/�0�0�E��<���":�;�;�;��"�"��
�'�4�
 �
 �	�A��6�6�8�8�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��t�9�9��>�>��L�L��!�!�!����7�c�>�>��L�L��!�!�!���(����'�'�'��R�7�8�8�8s�A#�#A'	�*A'	z!Check cagefs virt.mp files syntaxc�4�d�}t��rs|��sit��}|rY	|d}|�d��sttd��Sn%#t
$rttd��cYSwxYwttd��S)Nc�|�	tdd��}d|v}|���n#t$rYdSwxYw|S)Nz/var/cpanel/cpanel.config�rzlve_hide_selector=1
F)ro�closer[)ru�results  r-�php_selector_is_disabledz?check_multiphp_system_default.<locals>.php_selector_is_disabled�sW��	��0�#�6�6�A�,��1�F�
�G�G�I�I�I�I���	�	�	��5�5�	�����
s�(+�
9�9�defaultzea-phpznChoose one of ea-php versions instead of alt-php in cPanel MultiPHP Manager for PHP Selector to start working.z*Cannot get MultiPHP system default versionzVMultiPHP system default PHP version is NOT alt-php. PHP Selector should work normally.)rr�
startswithrrr?r)r}rv�default_phps   r-�check_multiphp_system_defaultr��s���������
W� 8� 8� :� :�
W�'�)�)���	W�
W�"�9�o��"�-�-�h�7�7�_�$�V�.^�_�_�_�_���
W�
W�
W� ��)U�V�V�V�V�V�
W�����R�q�r�r�rs�1A � B�Bz)Check MultiPHP system default php versionc���g}g}tD]�}	|��}|j|j}}n-#t$r }tt|��}}Yd}~nd}~wwxYw|tkr/|�d�|j	|������|tfvr|�|��|�d�|j	||������||fS)Nz	{}...
{}
z
{}...
{}: {}
)�CAGEFS_CHECKERSrrrhrrirr'r(�__name__r)�errorsraru�chk_resr�detailsrcs       r-�	run_testsr��s���
�F�
�F�
�N�N��	8��a�c�c�G�"�;����C�C���	8�	8�	8�.��Q����C�C�C�C�C�C�����	8�����"�9�9��M�M�-�.�.�q�z�3�?�?�@�@�@�@��7�*�$�$��
�
�c�"�"�"��M�M�+�2�2�1�:�s�G�L�L�M�M�M�M��6�>�s�(�
A�A
�
Ac��tj��dkrtd��td��trtt��dStd��t��\}}td�|����td�	t|������|rtd��dSdS)Nrz&This script should be run by root user�z*** Starting sanity check ***
�
z*** There are {} errors ***�)r$�geteuid�print�exit�cldiaglib_foundrr�r��joinr(rq)r��outs  r-�checkr�	s���	�z�|�|�q���
�6�7�7�7��Q�������������
�/�0�0�0��k�k����
�d�i�i��n�n����
�+�2�2�3�v�;�;�?�?�@�@�@��	���G�G�G�G�G�	�	r/)7�
__future__rrrr�futurer�install_aliases�builtinsr$rCr=rnr]r;�clcommonr	�	itertoolsr
�collectionsr�	cagefsctlrr
rrrr�	cagefslibr�clcagefslib.selector.configurerrr��	cldiaglibrrrrr�ImportErrorrr.�pretty_namer4r6r8rRrfrjrwr�r�r�r�r3r/r-�<module>r�sR��&�%�%�%�%�%�&�&�&�&�&�&�������'�'�'�'�'�'�#�#�#�#�#�#� �� �"�"�"�����	�	�	�	�
�
�
�
�
�
�
�
���������	�	�	�	�������������"�"�"�"�"�"�����������������&�%�%�%�%�%�S�S�S�S�S�S�S�S��������������������
�
�
�
��O�	
�B�
�F��G�/���
�;�
�
�)���I�I�I�
����:�:�:� 0R� �,�;�;�;�0Y� �,�<�<�<�1[�!�-�<�<�<�2U�"�.�&�&�&�RI�I�I�8,Q��(�
B�
B�
B�9k�)�5�9�9�9�0.Q��*�s�s�s�*-X��)�%�$�%�&� �-�"�!�	�����$����s�=B�B,�+B,

Youez - 2016 - github.com/yon3zu
LinuXploit