%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_set_passwords.cpython-312.pyc

�

���f�"�
�~�UdZddlZddlZddlmZmZddlmZddlm	Z	m
Z
mZmZddl
mZddlmZddlmZdd	lmZmZmZdd
lmZddlmZdegegd
�Zeed<ej:e�ZdjAeezD�cgc]	}|dvs�|��c}�Z!de"de#de"fd�Z$d�Z%defd�Z&de#dedede"ddf
d�Z'dd�Z(ycc}w)zFSet Passwords: Set user passwords and enable/disable SSH password auth�N)�
ascii_letters�digits)�List)�features�	lifecycle�subp�util)�Cloud)�Config)�
MetaSchema)�ALL_DISTROS�Distro�ug_util)�PER_INSTANCE)�update_ssh_config�cc_set_passwords)�id�distros�	frequency�activate_by_schema_keys�meta��loLOI01�
users_list�pw_type�returnc��|sgS|D�cgc].}|jdd�|k(r|d|jdd�f��0c}Scc}w)zDeither password or type: RANDOM is required, user is always required�type�hash�name�password�RANDOM)�get)rr�items   �C/usr/lib/python3/dist-packages/cloudinit/config/cc_set_passwords.py�get_users_by_typer&$sZ���	��
#�
���x�x���'�7�2��&�\�4�8�8�J��9�:�
���
s�3?c��	|jd|�tjd�y#tj$r }tjd|�Yd}~yd}~wwxYw)N�restartzRestarted the SSH daemon.zm'ssh_pwauth' configuration may not be applied. Cloud-init was unable to restart SSH daemon due to error: '%s')�manage_service�LOG�debugr�ProcessExecutionError�warning)�distro�service�es   r%�_restart_ssh_daemonr11sS��
����i��1��	�	�-�.���%�%�
����
>�
�	
�	
��
�s�'*�A�A�Ar.c��|jdd�}d}t|t�rtjddd��tj|�rd}nctj|�rd	}nKd
|�d�}|�|j�d
k(rtjd||�ytjd||�yt||i�}|stjd|�y|j�rStjddddd|g�jj!�}|j�dvr
t#||�yyt#||�y)z�Apply sshd PasswordAuthentication changes.

    @param pw_auth: config setting from 'pw_auth'.
                    Best given as True, False, or "unchanged".
    @param distro: an instance of the distro class for the target distribution

    @return: None�ssh_svcname�ssh�PasswordAuthenticationz-Using a string value for the 'ssh_pwauth' key�22.2z&Use a boolean value with 'ssh_pwauth'.��
deprecated�deprecated_version�
extra_message�yes�nozLeaving SSH config 'z' unchanged.N�	unchangedz%s ssh_pwauth=%sz$%s Unrecognized value: ssh_pwauth=%sz/No need to restart SSH service, %s not updated.�	systemctl�showz
--property�ActiveStatez--value)�active�
activating�	reloading)�
get_option�
isinstance�strr�	deprecater	�is_true�is_false�lowerr*r+r-r�uses_systemdr�stdout�stripr1)�pw_authr.r/�cfg_name�cfg_val�bmsg�updated�states        r%�handle_ssh_pwauthrT=s>�����
�u�5�G�'�H��'�3�����F�%�B�	
�
�|�|�G����	
���w�	���%�h�Z�|�<���?�g�m�m�o��<��I�I�(�$��8�	�
�K�K�>��g�N����7� 3�4�G���	�	�C�X�N��
�����	�	�������

�	
��&����	��;�;�=�A�A����0�B�	�F�G�,�r �cfg�cloud�argsc��	�|j}|r|d}d|vr%d|dvr|dd=ntj|dd�}d}g}g}d|vr�|d}	tj|	dg��}d|	vr�|	dr�t	j
dd	d
��t
|	dt�r-tjd�tj|	d|�}nUt	j
d
dd��tjd�tj|	d�}
|
r|
j�}tj|	d|�}|sU|sS|rQtj||�\}}tj|�\}
}|
r	|
�d|��g}ntjd�g}|s|�rAt!|d�}|D�
�cgc]\}
}|
��	}}
}t!|d�}|D�
�cgc]\}
}|
��	}}
}g}t!|d�D]I\}
}t#�}|j%|
�|j%|
|f�|j%|
�d|����Kt'j(d�}|D]�}|j+dd�\}}|j-|��)d|vr%|j%||f�|j%|��R|dk(s|dk(r t#�}|j%|�d|���|j%||f�|j%|���|r*	tjd|�|j/|d��|r*	tjd|�|j/|d��t5|�r.d d!j7|�f}tj8d"|zdd�#�|r[|}t:j<r||z
}g}|D]%}	|j?|�|j%|��'|rtjd%|�tA|jCd&�|�t5|�r$tjd't5|��|d(�ycc}}
wcc}}
w#t0$r7}|j%|�tj2td|�Yd}~��Td}~wwxYw#t0$r7}|j%|�tj2td|�Yd}~��kd}~wwxYw#t0$r7}|j%|�tj2td$|�Yd}~��Xd}~wwxYw))Nr�chpasswd�listr!T�users)�defaultzConfig key 'lists'z22.3zUse 'users' instead.r7z$Handling input for chpasswd as list.zThe chpasswd multiline stringr6zUse string type instead.z0Handling input for chpasswd as multiline string.�expire�:z2No default or defined user to change password for.�textrr"z\$(1|2a|2y|5|6)(\$.+){2}��RzChanging password for %s:F)�hashedz,Failed to set passwords with chpasswd for %szSetting hashed password for %s:z3Failed to set hashed passwords with chpasswd for %sz%Set the following 'random' passwords
�
z%s
%s
)�stderr�fallback_to_stdoutzFailed to set 'expire' for %szExpired passwords for: %s users�
ssh_pwauthz+%s errors occurred, re-raising the last one���)"r.r	�get_cfg_option_str�get_cfg_option_listrrGrEr[r*r+�
splitlines�get_cfg_option_boolr�normalize_users_groups�extract_defaultr-r&�rand_user_password�append�re�compile�split�matchrZ�	Exception�logexc�len�join�	multi_logr�EXPIRE_APPLIES_TO_HASHED_USERS�
expire_passwdrTr#)r rVrWrXr.r!r^�plistr�chfg�	multiliner\�_groups�user�_user_config�errors�plist_in�_�hashed_plist_in�hashed_users�randlist�prog�line�u�pr0�blurb�users_to_expire�
expired_userss                             r%�handler�qs����\�\�F����7������3�z�?�!:��J���'��*�*�3�
�D�A��
�F��E��J��S���:����-�-�d�G�R�H�
��T�>�d�6�l����/�#)�4�
�
�$�v�,��-��	�	�@�A��0�0��v�u�E���#�#�>�'-�"<��
�	�	�L�M� �3�3�D�&�A�	��%�0�0�2�E��)�)�$��&�A���%�X�"�9�9�#�v�F����&�6�6�u�=���|�� $�h�/�0�E��K�K�L�M�
�F��
�%�Z��8��%-�.�'�$���.��.�+�J��?��,;�<���q��<��<���(��X�>�	2�G�D�!�)�+�H��L�L����O�O�T�8�,�-��O�O�t�f�A�h�Z�0�1�		2��z�z�5�6���	 �D��:�:�c�1�%�D�A�q��z�z�!�}�(�S��\��&�&��1�v�.��#�#�A�&���8�q�H�}�*�,�A��O�O�q�!�$4�5�����A��'����Q��	 ��
��	�	�5�u�=�������7��	
��	�	�;�\�J�������=��x�=�8��	�	�(�#��E�
�N�N��U�"�5�U�
��#�O��6�6��<�/���M�$�
I��I��(�(��+�!�(�(��+�
I���	�	�;�]�K��c�g�g�l�+�V�4�
�6�{��	�	�?��V��M��R�j����]/��<��@�
��
�
�a� �����G�����
���
��
�
�a� �����I� ����
��4!�I��M�M�!�$��K�K��%D�a�H�H��I�sT� P�P!�%)P'�)Q*�"R-�'	Q'�0,Q"�"Q'�*	R*�3,R%�%R*�-	S-�6,S(�(S-c�8�tj|t��S)N)�select_from)r	�rand_str�PW_SET)�pwlens r%roro�s���=�=��F�3�3rU)�))�__doc__�loggingrq�stringrr�typingr�	cloudinitrrrr	�cloudinit.cloudr
�cloudinit.configr�cloudinit.config.schemar�cloudinit.distrosr
rr�cloudinit.settingsr�cloudinit.ssh_utilrr�__annotations__�	getLogger�__name__r*rxr�r[rFr&r1rTr�ro)�xs0r%�<module>r�s���M��	�(��5�5�!�#�.�:�:�+�0���}��!�	��j���g����!��
���]�V�3�J��q�	�7I�!�J�	K��
�$�
��
��
�	
�1-�v�1-�hE��E�6�E�%�E�t�E��E�P4��qKs�?	B:�	B:

Zerion Mini Shell 1.0