관리-도구
편집 파일: ssh.cpython-39.opt-1.pyc
a ����-�_g�����������������������@���s>���d�dl�Z�d�dlmZ�d�dlmZmZmZ�G�dd��dee�ZdS�)�����N��glob)�Plugin�IndependentPlugin� PluginOptc�������������������@���sB���e�Zd�ZdZdZdZeddedd�gZdd ��Z d d��Z dd ��ZdS�)�SshzSecure shell serviceZssh)ZservicesZsecurity�system�identity� userconfsTz5Changes whether module will collect user .ssh configs)�defaultZval_typeZdescc�����������������C���sB���|���ddd���g�d�}|��|��|��|��|��d�r>|�����d�S�)NZsshd_configZ ssh_config)z/etc/ssh/sshd_config$z/etc/ssh/ssh_config$)z/etc/ssh/ssh_configz/etc/ssh/sshd_configz/etc/ssh/sshd_config.d/*r ���)Z add_file_tags� add_copy_spec�included_configsZ get_option�user_ssh_files_permissions)�self�sshcfgs��r����:/usr/lib/python3.9/site-packages/sos/report/plugins/ssh.py�setup���s����� z Ssh.setupc�������������� ���C���s����z�dd��dd��|D��D��}|D�]�}|��d�d�}t|��|�ddd��^}|D�]H}t|�����d ksJ|�d �rjqJ|����d�rJ|����}|�j|d�|d ��qJW�d����q1�s�0����Y��qW�n�ty����Y�n0�dS�)z Include subconfig files c�����������������S���s���g�|�]}|D�]}|�qqS�r���r���)�.0�files�fr���r���r���� <listcomp>7���s����z(Ssh.included_configs.<locals>.<listcomp>c�����������������S���s���g�|�]}t�|d�d��qS�)T)� recursiver���)r���Zcopyspecr���r���r���r���8���s����/����r�UTF-8��encodingr����#Zinclude����)�tagsN)�split�open� path_join�len� startswith�lowerr���� Exception)r���r���ZcfgfilesZsshcfg�tagZcfgfile�lineZconfargr���r���r���r ���3���s(�������8zSsh.included_configsc����������� ������C���s����t����}i�}zXtdddd��6}|D�] }|���dd��\}}|||<�q"W�d����n1�sX0����Y��W�n�ty����|��d��Y�dS�0�h�d �}|D�]J}|j|v�r�||j�|v�r�|��d |j��d���q�|��|jd�} |�� | ��q�dS�) z� Iterate over .ssh folders in user homes to see their permissions. Bad permissions can prevent SSH from allowing access to given user. z/proc/mountsr���r���r���r �������NzCouldn't read /proc/mounts>���Zautofs�nfsZnfs4zSkipping capture in z because it's a remote directoryz.ssh) �pwd�getpwallr#���r"���r(���Z _log_error�pw_dirZ _log_infor$���Zadd_dir_listing) r���Z users_dataZ fs_mount_infoZmounts_filer*���Zfs_fileZ fs_vstypeZnon_local_fs�userZhome_dirr���r���r���r���K���s*����, ��zSsh.user_ssh_files_permissionsN)�__name__� __module__�__qualname__Z short_descZplugin_nameZprofilesr����strZoption_listr���r ���r���r���r���r���r���r������s�����r���)r-���r���Zsos.report.pluginsr���r���r���r���r���r���r���r����<module>���s���