Current File : //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/ssh.cpython-312.pyc
�

-�_g���D�ddlZddlmZddlmZmZmZGd�dee�Zy)�N)�glob)�Plugin�IndependentPlugin�	PluginOptc�D�eZdZdZdZdZedded��gZd�Z	d	�Z
d
�Zy)�SshzSecure shell service�ssh)�services�security�system�identity�	userconfsTz5Changes whether module will collect user .ssh configs)�default�val_type�descc��|jddd��gd�}|j|�|j|�|jd�r|j	�yy)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�setupz	Ssh.setups_�����%2�$0�
�	�
��	
���7�#����g�&��?�?�;�'��+�+�-�(�c�.�	|D�cgc]}t|d����c}D��cgc]}|D]}|���
}}}|D]�}|jd�d}t|j|�dd��5}|D]v}	t	|	j��dk(s|	jd	�r�1|	j
�jd
�s�Q|	j�}
|j|
d|���x	d
d
d
���y
cc}wcc}}w#1swY��xYw#t$rYy
wxYw)z Include subconfig files T)�	recursive�/����r�UTF-8��encodingr�#�include�)�tagsN)	r�split�open�	path_join�len�
startswith�lowerr�	Exception)rr�copyspec�files�f�cfgfiles�sshcfg�tag�cfgfile�line�confargs           rrzSsh.included_configs3s9��	�DK� �7?�D��T�2� ��� �������H��
#�
E���l�l�3�'��+���$�.�.��0�#�#*�,�	E�/6� '�E���t�z�z�|�,��1�T�_�_�S�5I�$��:�:�<�2�2�9�=�&*�j�j�l�G� �.�.�w�q�z��.�D�E�	E�	E�
E��	 ���	E�	E���	��	�sJ�D�C1�D�C6�9D�)AC<�=(C<�&
D�1D�<D	�D�	D�Dc���tj�}i}	tddd��5}|D]}|j�dd\}}|||<�	ddd�hd	�}|D]n}|j|vr1||j|vr |jd
|j�d���B|j|jd�}	|j|	��py#1swY��xYw#t$r|jd�YywxYw)
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)�NzCouldn't read /proc/mounts>�nfs�nfs4�autofszSkipping capture in z  because it's a remote directoryz.ssh)
�pwd�getpwallr,r+r1�
_log_error�pw_dir�	_log_infor-�add_dir_listing)
r�
users_data�
fs_mount_info�mounts_filer9�fs_file�	fs_vstype�non_local_fs�user�home_dirs
          rrzSsh.user_ssh_files_permissionsKs���\�\�^�
��
�	��n�c�G�<�
7��'�7�D�+/�:�:�<��!�+<�(�W�i�-6�M�'�*�7�
7�1���		+�D��{�{�m�+�!�$�+�+�.�,�>����.�t�{�{�m�:�;����~�~�d�k�k�6�:�H�� � ��*�		+�
7�
7���	��O�O�8�9��	�s(�C�#C
�
C�
C�C�C3�2C3N)�__name__�
__module__�__qualname__�
short_desc�plugin_name�profilesr�str�option_listrrr�rrrrs<��'�J��K�=�H�	�+�t�c�4�	6��K�.�,�0+rr)r@r�sos.report.pluginsrrrrrVrr�<module>rXs$����C�C�W+�&�#�W+r