Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/sos/report/plugins/__pycache__/ssh.cpython-36.opt-1.pyc

3

�f�
�@s*ddlmZmZmZGdd�dee�ZdS)�)�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_typeZdesccCsB|jddd��ddg}|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_configr
)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�x�|D]�}|jd�d}t|j|�ddd��X}xP|D]H}t|j��dks6|jd�rVq6|j�jd�r6|j�}|j|d|d	�q6WWd
QRXqWWntk
r�YnXd
S)z Include subconfig files �/��rzUTF-8)�encodingr�#�include)ZtagsN���)�split�open�	path_join�len�
startswith�lowerr�	Exception)rrZsshcfg�tagZcfgfile�lineZconfargrrrr
0s


(zSsh.included_configscCs�|jd�}|dr`y,t|jd�ddd��}|j�}WdQRXWqltk
r\|jd�dSXn|d	j�}xV|D]N}y4|j|jd
�dd�}|j|�r�|j	d
|���Wqrt
k
r�YqrXqrWdS)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/passwdrzUTF-8)rNzCouldn't read /etc/passwd�output�:�z.sshzls -laZ )Zexec_cmdrr�	readlinesr!Z
_log_error�
splitlinesrZ
path_isdirZadd_cmd_output�
IndexError)rZ
users_dataZpasswd_fileZusers_data_linesZusr_lineZhome_dirrrrrCs"




zSsh.user_ssh_files_permissionsN)rrrr	)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesr�strZoption_listrr
rrrrrrs
rN)Zsos.report.pluginsrrrrrrrr�<module>s

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists