HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/sos/report/plugins/__pycache__/ssh.cpython-39.opt-1.pyc
a

^��c��@s&ddlmZmZGdd�dee�ZdS)�)�Plugin�IndependentPluginc@s0eZdZdZdZdZdd�Zdd�Zdd	�Zd
S)�SshzSecure shell serviceZssh)ZservicesZsecurity�system�identitycCs8|�ddd��ddg}|�|�|�|�|��dS)NZsshd_configZ
ssh_config)z/etc/ssh/sshd_config$z/etc/ssh/ssh_config$z/etc/ssh/ssh_configz/etc/ssh/sshd_config)Z
add_file_tags�
add_copy_spec�included_configs�user_ssh_files_permissions)�self�sshcfgs�r�:/usr/lib/python3.9/site-packages/sos/report/plugins/ssh.py�setups��

z	Ssh.setupc	Cs�z�|D]�}|�d�d}t|�|�d��^}|D]H}t|���dks.|�d�rNq.|���d�r.|��}|j|d|d�q.Wd�q1s�0YqWnty�Yn0dS)	N�/����rr�#Zinclude�)�tags)�split�open�	path_join�len�
startswith�lowerr�	Exception)r
rZsshcfg�tagZcfgfile�lineZconfargrrr
r's8zSsh.included_configsc	Cs�|�d�}|drnz:t|�d���}|��}Wd�n1s@0YWqztyj|�d�YdS0n|d��}|D]L}z4|�|�d�dd	�}|�|�r�|�	d
�
|��Wq~ty�Yq~0q~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
getent passwd�statusz/etc/passwdNzCouldn't read /etc/passwd�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_dirrrr
r	8s 
*


zSsh.user_ssh_files_permissionsN)	�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesrrr	rrrr
rsrN)Zsos.report.pluginsrrrrrrr
�<module>s