HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/sos/report/plugins/__pycache__/ssh.cpython-38.pyc
U

i��d
�@s*ddlmZmZmZGdd�dee�ZdS)�)�Plugin�IndependentPlugin�	PluginOptc@sBeZdZdZdZdZeddedd�gZdd	�Z	d
d�Z
dd
�ZdS)�SshzSecure shell serviceZssh)�servicesZsecurity�systemZidentity�	userconfsTz5Changes whether module will collect user .ssh configs)�defaultZval_typeZdesccCsB|�ddd��ddg}|�|�|�|�|�d�r>|��dS)NZsshd_configZ
ssh_config)z/etc/ssh/sshd_config$z/etc/ssh/ssh_config$z/etc/ssh/ssh_configz/etc/ssh/sshd_configr)Z
add_file_tags�
add_copy_spec�included_configsZ
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�z�|D]|}|�d�d}t|�|�d��T}|D]H}t|���dks.|�d�rNq.|���d�r.|��}|j|d|d�q.W5QRXqWntk
r�YnXdS)	N�/����rr�#Zinclude�)Ztags)�split�open�	path_join�len�
startswith�lowerr
�	Exception)r
rZsshcfg�tagZcfgfile�lineZconfargrrrr0s$zSsh.included_configsc	Cs�|�d�}|dr\z&t|�d���}|��}W5QRXWqhtk
rX|�d�YdSXn|d��}|D]N}z4|�|�d�dd	�}|�|�r�|�	d
�
|��Wqltk
r�YqlXqldS)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 passwdZstatusz/etc/passwdzCouldn't read /etc/passwdN�output�:�z.sshz
ls -laZ {})Zexec_cmdrr�	readlinesrZ
_log_error�
splitlinesrZ
path_isdirZadd_cmd_output�format�
IndexError)r
Z
users_dataZpasswd_fileZusers_data_linesZusr_lineZhome_dirrrrrAs 



zSsh.user_ssh_files_permissionsN)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesr�strZoption_listrrrrrrrrs��rN)Zsos.report.pluginsrrrrrrrr�<module>s