HEX
Server: Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System: Linux ns565604.ip-54-39-133.net 4.18.0-553.50.1.el8_10.x86_64 #1 SMP Tue Apr 15 08:09:22 EDT 2025 x86_64
User: greer489 (1034)
PHP: 8.3.19
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/sos/report/plugins/__pycache__/ssh.cpython-36.opt-1.pyc
3

-�_g��@s>ddlZddlmZddlmZmZmZGdd�dee�ZdS)�N)�glob)�Plugin�IndependentPlugin�	PluginOptc@sBeZdZdZdZdZedded	d
�gZdd�Z	d
d�Z
dd�ZdS)�SshzSecure shell serviceZssh�services�security�system�identity�	userconfsTz5Changes whether module will collect user .ssh configs)�defaultZval_typeZdesccCsD|jddd��dddg}|j|�|j|�|jd�r@|j�dS)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.6/ssh.py�setups



z	Ssh.setupcCs�y�dd�dd�|D�D�}x�|D]�}|jd�d}t|j|�ddd��X}xP|D]H}t|j��d	ksN|jd
�rnqN|j�jd�rN|j�}|j|d|d�qNWWd
QRXq WWntk
r�YnXd
S)z Include subconfig files cSsg|]}|D]}|�qqSrr)�.0�files�frrr�
<listcomp>8sz(Ssh.included_configs.<locals>.<listcomp>cSsg|]}t|dd��qS)T)�	recursive)r)rZcopyspecrrrr9s�/��rzUTF-8)�encodingr�#�include)ZtagsN���)�split�open�	path_join�len�
startswith�lowerr
�	Exception)rrZcfgfilesZsshcfg�tagZcfgfile�lineZconfargrrrr3s


(zSsh.included_configsc
Cs�tj�}i}yHtdddd��0}x(|D] }|j�dd�\}}|||<q$WWdQRXWntk
rr|jd�dSXd	d
dh}xR|D]J}|j|kr�||j|kr�|jd|j�d
��q�|j|jd�}	|j	|	�q�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/proc/mountsrzUTF-8)rr�NzCouldn't read /proc/mountsZnfsZnfs4ZautofszSkipping capture in z  because it's a remote directoryz.ssh)
�pwdZgetpwallr"r!r'Z
_log_error�pw_dirZ	_log_infor#Zadd_dir_listing)
rZ
users_dataZ
fs_mount_infoZmounts_filer)Zfs_fileZ	fs_vstypeZnon_local_fs�userZhome_dirrrrrKs&




zSsh.user_ssh_files_permissionsN)rrr	r
)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesr�strZoption_listrrrrrrrrs
r)r+rZsos.report.pluginsrrrrrrrr�<module>s