Your IP : 216.73.217.13


Current Path : /lib/python3/dist-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/sos/report/plugins/__pycache__/ssh.cpython-38.pyc

U

���b��@s&ddlmZmZGdd�dee�ZdS)�)�Plugin�IndependentPluginc@s0eZdZdZdZdZdd�Zdd�Zdd	�Zd
S)�SshzSecure shell serviceZssh)�servicesZsecurity�systemZidentitycCs8|�ddd��ddg}|�|�|�|�|��dS)NZsshd_configZ
ssh_config)�/etc/ssh/sshd_config�/etc/ssh/ssh_configrr)Z
add_file_tags�
add_copy_spec�included_configs�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r
Zsshcfg�tagZcfgfile�lineZconfargrrrr
's$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_dirrrrr8s 



zSsh.user_ssh_files_permissionsN)	�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesrr
rrrrrrsrN)Zsos.report.pluginsrrrrrrr�<module>s