AlkantarClanX12

Your IP : 3.149.29.98


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/lvemanager/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/lvemanager/__pycache__/sudoers.cpython-311.pyc

�

!�g!���ddlmZddlmZddlmZddlZddlZddlmZddlm	Z	m
Z
ddlmZm
Z
ddlmZdd	lmZdd
lmZdZdZd
Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�)�print_function)�division)�absolute_importN)�remount_proc)�admins�	getCPName)�
SysCtlConf�SYSCTL_CL_CONF_FILE)�Feature)�is_panel_feature_supported)�Clsudo�admin�
clsupergid�	clsudoersc�F�tjdd||g��}|dkrdSdS)zAdd user to given unix group�/usr/bin/gpasswdz-arFT��
subprocess�call��	user_name�
group_name�retcodes   �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/lvemanager/sudoers.py�_add_user_to_grouprs.���o�1�4��J�O�P�P�G��!�|�|��u��4�c�F�tjdd||g��}|dkrdSdS)Nrz-drFTrrs   r�_remove_user_from_groupr(s.���o�1�4��J�O�P�P�G��!�|�|��u��4rc��tt����}||vr|�|��|D]}t||���dS)z�
    Add all present DA admins (plus new_admin_name admin) to supplied group
    :param new_admin_name: new admin name to add
    :return:
    N)�listr�appendr)r�new_admin_name�
admin_listrs    r�_add_admins_into_groupr$/s^���f�h�h���J��Z�'�'����.�)�)�)��.�.���5�*�-�-�-�-�.�.rc�D�tjdd|g��}|dkrdSdS)zCreate group with given namez/usr/sbin/groupaddz-frFTr)rrs  r�
_create_groupr&=s,���o�3�T�:�F�G�G�G��!�|�|��u��4rc���ttjt��j��}tt���}|�d��}|�d��s-|�	d|��tt|��dSt��dkrr	ttjt��j��}n#t$rd}YnwxYw||kr-|�	d|��tt|��dS	t|��}n#t$rt!d���wxYwtj|��j}t||��dS)z�
    Add all present DA admins (plus new_admin_name admin) to current supergid group
    :param new_admin_name: new admin name to add
    :return:
    )�config_filezfs.proc_super_gidN�DirectAdminz6Bad fs.proc_super_gid option value in /etc/sysctl.conf)�str�grp�getgrnam�SUPER_GROUP_NAME�gr_gidr	r
�get�
has_parameter�setr$r�DEFAULT_GROUP_NAME�KeyError�int�
ValueError�RuntimeError�getgrgid�gr_name)r"�	super_gid�
sysctl_cfg�proc_super_gid�	admin_gid�proc_super_names      r�_add_admins_into_supergid_grpr>Es����C�L�!1�2�2�9�:�:�I��(;�<�<�<�J� �^�^�$7�8�8�N��#�#�$7�8�8�
����*�I�6�6�6��/��@�@�@���	���
�	%�	%�	��C�L�);�<�<�C�D�D�I�I���	�	�	��I�I�I�	�����Y�&�&��N�N�.�	�:�:�:�"�#3�^�D�D�D��F�U��^�,�,�����U�U�U��S�T�T�T�U�����l�>�2�2�:�O��?�N�;�;�;�;�;s�++C�C&�%C&�D-�-Ec�.�ttj��rjtt��stdtz���t
|��t|t��std|�dt�d����tt��stdtz���t|t��std|�dt�d����t��}|�
t��t��dS)NzERROR: Can't create %s group
zERROR: Can't add user z to z group
)rr�LVEr&r-�	Exceptionr>r�SUDOERS_GROUP_NAMEr
�add_lvemanager_groupr)�name�sudos  r�add_unix_user_to_sudoersrFls��!�'�+�.�.�)��-�.�.�	Q��<�?O�O�P�P�P�%�d�+�+�+�!�$�(8�9�9�	)��)����&�&�&�(�)�)�
)��+�,�,�O��8�;M�M�N�N�N��d�$6�7�7�'��i��D�D�$�$�$�&�'�'�	'��8�8�D����0�1�1�1��N�N�N�N�Nrc�Z�t|t��t|t��dS)N)rr-rB)rDs r�remove_unix_user_from_sudoersrH�s*���D�"2�3�3�3��D�"4�5�5�5�5�5r)�
__future__rrrr+r�cl_proc_hidepidr�clcommon.cpapirr�clcommon.sysctlr	r
�clcommon.constrr�clsudor
r2r-rBrrr$r&r>rFrH�rr�<module>rPsV��&�%�%�%�%�%�������&�&�&�&�&�&�
�
�
�
�����(�(�(�(�(�(�,�,�,�,�,�,�,�,�;�;�;�;�;�;�;�;�"�"�"�"�"�"�5�5�5�5�5�5��������� ��!��������.�.�.����$<�$<�$<�N���66�6�6�6�6r