HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/ssh.cpython-312.pyc
�

O6uf���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�/����rzUTF-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�}|D]D}|j|jd�}|j	|�s�1|jd|����Fy)z�
        Iterate over .ssh folders in user homes to see their permissions.

        Bad permissions can prevent SSH from allowing access to given user.
        z.sshzls -laZ N)�pwd�getpwallr+�pw_dir�
path_isdir�add_cmd_output)r�
users_data�user�home_dirs    rrzSsh.user_ssh_files_permissionsKsU���\�\�^�
��	;�D��~�~�d�k�k�6�:�H����x�(��#�#�h�x�j�$9�:�	;rN)�__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.pluginsrrrrrJrr�<module>rLs$����C�C�G;�&�#�G;r