관리-도구
편집 파일: config_passwd.cpython-39.pyc
a ����'�Dgv ����������������������@���s<���d�dl�Z�d�dlZd�dlmZmZ�e��e�ZG�dd��d�ZdS�)�����N)� atomic_helper�subpc�������������������@���s ���e�Zd�ZdZdd��Zdd��ZdS�)�PasswordConfiguratorzv Class for changing configurations related to passwords in a VM. Includes setting and expiring passwords. c�����������������C���s����t��d��|rt�|�}g�}tdd�D�]*}|�d�d�dkr&|�|�d�d���q&g�}tdd�D�]$}|�d�d�}||v�r`|�|��q`|r�t��d ��|�d |��|r�|��|��t��d��dS�) a+�� Main method to perform all functionalities based on configuration file inputs. @param passwd: encoded admin password. @param resetPasswd: boolean to determine if password needs to be reset. @return cfg: dict to be used by cloud-init set_passwd code. zStarting password configurationz/etc/passwd�r�:�����0r���z/etc/shadowzSetting admin password�rootzConfigure Password completed!N) �LOG�infor���Zb64d�open�split�appendZ set_passwd�reset_password)�self�passwdZresetPasswdZdistroZallRootUsers�lineZuidUsersList�user��r����V/usr/lib/python3.9/site-packages/cloudinit/sources/helpers/vmware/imc/config_passwd.py� configure���s$���� zPasswordConfigurator.configurec�����������������C���s����t��d��|D�]n}zt�dd|g��W�q�tjyz�}�z:tj�d�rXt�ddd|g��nt��d||��W�Y�d }~qd }~0�0�qd S�) z� Method to reset password. Use passwd --expire command. Use chage if not succeeded using passwd command. Log failure message otherwise. @param: list of users for which to expire password. zExpiring password.r���z--expirez/usr/bin/chageZchagez-dr���z/Failed to expire password for %s with error: %sN)r ���r���r���ZProcessExecutionError�os�path�existsZwarning)r���ZuidUserListr����er���r���r���r���3���s���� �z#PasswordConfigurator.reset_passwordN)�__name__� __module__�__qualname__�__doc__r���r���r���r���r���r���r������s���r���) Zloggingr���Z cloudinitr���r���Z getLoggerr���r ���r���r���r���r���r����<module> ���s���