HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //proc/1233/cwd/lib/python3/dist-packages/sos/report/plugins/__pycache__/ssh.cpython-310.pyc
o

i��d
�@s*ddlmZmZmZGdd�dee�ZdS)�)�Plugin�IndependentPlugin�	PluginOptc@sBeZdZdZdZdZeddedd�gZdd	�Z	d
d�Z
dd
�ZdS)�SshzSecure shell service�ssh)�services�security�system�identity�	userconfsTz5Changes whether module will collect user .ssh configs)�default�val_type�desccCsF|�ddd��ddg}|�|�|�|�|�d�r!|��dSdS)N�sshd_config�
ssh_config)z/etc/ssh/sshd_config$z/etc/ssh/ssh_config$z/etc/ssh/ssh_configz/etc/ssh/sshd_configr)�
add_file_tags�
add_copy_spec�included_configs�
get_option�user_ssh_files_permissions)�self�sshcfgs�r�8/usr/lib/python3/dist-packages/sos/report/plugins/ssh.py�setups��


�z	Ssh.setupc	Cs�zN|D]H}|�d�d}t|�|�d��/}|D]$}t|���dks&|�d�r'q|���d�r;|��}|j|d|d�qWd�n1sFwYqWdStyXYdSw)	N�/����rr�#�include�)�tags)�split�open�	path_join�len�
startswith�lowerr�	Exception)rr�sshcfg�tag�cfgfile�line�confargrrrr0s$������zSsh.included_configsc	Cs�|�d�}|dr6zt|�d���}|��}Wd�n1s wYWnty5|�d�YdSw|d��}|D]%}z|�|�d�dd	�}|�|�rY|�	d
�
|��Wq>tycYq>wdS)z�
        Iterate over .ssh folders in user homes to see their permissions.

        Bad permissions can prevent SSH from allowing access to given user.
        z
getent passwd�statusz/etc/passwdNzCouldn't read /etc/passwd�output�:�z.sshz
ls -laZ {})�exec_cmdr#r$�	readlinesr(�
_log_error�
splitlinesr"�
path_isdir�add_cmd_output�format�
IndexError)r�
users_data�passwd_file�users_data_lines�usr_line�home_dirrrrrAs,

��
�
���zSsh.user_ssh_files_permissionsN)�__name__�
__module__�__qualname__�
short_desc�plugin_name�profilesr�str�option_listrrrrrrrrs��rN)�sos.report.pluginsrrrrrrrr�<module>s