
    ~ g                     D    S SK r S SKJr  S SKJrJrJr   " S S\\5      rg)    N)glob)PluginIndependentPlugin	PluginOptc                   D    \ rS rSrSrSrSr\" SSSS9/rS	 r	S
 r
S rSrg)Ssh   zSecure shell servicessh)servicessecuritysystemidentity	userconfsTz5Changes whether module will collect user .ssh configs)defaultdescc                     U R                  SSS.5        / SQnU R                  U5        U R                  U5        U R                  S5      (       a  U R	                  5         g g )Nsshd_config
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   )add_file_tagsadd_copy_specincluded_configs
get_optionuser_ssh_files_permissions)selfsshcfgss     8/usr/lib/python3/dist-packages/sos/report/plugins/ssh.pysetup	Ssh.setup   sb    %2$0
 	
 	7#g& ??;''++- (    c                 \    U Vs/ s H  n[        USS9PM     sn VVs/ s H  nU  H  nUPM     M     nnnU H  nUR                  S5      S   n[        U R                  U5      SSS9 nU H  n	[	        U	R                  5       5      S:X  d  U	R                  S	5      (       a  M8  U	R                  5       R                  S
5      (       d  M^  U	R                  5       n
U R                  U
S   US9  M     SSS5        M     gs  snf s  snnf ! , (       d  f       M  = f! [         a     gf = f)zInclude subconfig files T)	recursive/rUTF-8encodingr   #include   )tagsN)	r   splitopen	path_joinlen
startswithlowerr   	Exception)r   r   copyspecfilesfcfgfilessshcfgtagcfgfilelineconfargs              r   r   Ssh.included_configs3   s*   	 DK CJxDT27  e a       
 #ll3'+$..0##*,/6 'tzz|,1T__S5I5I$::<229==&*jjlG ..wqz.D !(, , #	 , ,  		sJ   D DD D6D ,AD'D4D D 
D	D 
D+*D+c                    [         R                  " 5       n0 n [        SSSS9 nU H  nUR                  5       SS u  pVXbU'   M     SSS5        1 S	knU Hs  nUR                  U;   a3  X(R                     U;   a!  U R                  S
UR                   S35        MF  U R                  UR                  S5      n	U R                  U	5        Mu     g! , (       d  f       N= f! [         a    U R                  S5         gf = f)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/mountsr$   r%   r&   r*      NzCouldn't read /proc/mounts>   nfsnfs4autofszSkipping capture in z  because it's a remote directoryz.ssh)
pwdgetpwallr-   r,   r2   
_log_errorpw_dir	_log_infor.   add_dir_listing)
r   
users_datafs_mount_infomounts_filer:   fs_file	fs_vstypenon_local_fsuserhome_dirs
             r   r   Ssh.user_ssh_files_permissionsK   s     \\^
	ncG<'D+/::<!+<(W-6'* ( = 1D{{m+!++.,>.t{{m:; ~~dkk6:H  *  =<  	OO89	s.   C #CC 
CC C C<;C< N)__name__
__module____qualname____firstlineno__
short_descplugin_nameprofilesr   option_listr   r   r   __static_attributes__rQ   r   r   r   r      s:    'JK=H 	+t4	6K.,0+r   r   )rB   r   sos.report.pluginsr   r   r   r   rQ   r   r   <module>r\      s$      C CW+&# W+r   