HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/sos/report/plugins/__pycache__/ssh.cpython-39.opt-1.pyc
a

\��h��@s>ddlZddlmZddlmZmZmZGdd�dee�ZdS)�N��glob)�Plugin�IndependentPlugin�	PluginOptc@s@eZdZdZdZdZedddd�gZdd	�Zd
d�Z	dd
�Z
dS)�SshzSecure shell serviceZssh)ZservicesZsecurity�system�identity�	userconfsFz5Changes whether module will collect user .ssh configs)�defaultZdesccCsL|�ddd��gd�}|�|�|�|�|�d�r>|��|�d�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
zsshd -T)Z
add_file_tags�
add_copy_spec�included_configsZ
get_option�user_ssh_files_permissionsZadd_cmd_output)�self�sshcfgs�r�:/usr/lib/python3.9/site-packages/sos/report/plugins/ssh.py�setups�


z	Ssh.setupc	Cs�z�dd�dd�|D�D�}|D]�}|�d�d}t|�|�ddd��^}|D]H}t|���d	ksJ|�d
�rjqJ|���d�rJ|��}|j|d|d
�qJWd�q1s�0YqWnty�Yn0dS)z Include subconfig files cSsg|]}|D]}|�qqSrr)�.0�files�frrr�
<listcomp>:s�z(Ssh.included_configs.<locals>.<listcomp>cSsg|]}t|dd��qS)T)�	recursiver)rZcopyspecrrrr;s�/����r�UTF-8��encodingr�#Zinclude�)�tagsN)�split�open�	path_join�len�
startswith�lowerr�	Exception)rrZcfgfilesZsshcfg�tagZcfgfile�lineZconfargrrrr
6s(���8zSsh.included_configsc
Cs�t��}i}zXtdddd��6}|D] }|��dd�\}}|||<q"Wd�n1sX0YWnty�|�d�YdS0hd	�}|D]J}|j|vr�||j|vr�|�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/mountsrrrr �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)
rZ
users_dataZ
fs_mount_infoZmounts_filer*Zfs_fileZ	fs_vstypeZnon_local_fs�userZhome_dirrrrrNs*,

��zSsh.user_ssh_files_permissionsN)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesrZoption_listrr
rrrrrrs��r)r-rZsos.report.pluginsrrrrrrrr�<module>s