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

-�_gI��l�ddlZddlmZmZmZmZGd�de�ZGd�dee�ZGd�deee�Zy)	�N)�Plugin�RedHatPlugin�DebianPlugin�UbuntuPluginc�.�eZdZdZdZdZdZd�Zd�Zd�Z	y)	�PostfixzPostfix smtp server�postfix)�mail�services�r	c��gd�}g}	t|jd�dd��5}|j�D]`}|jd�r�|j	d�}|dj�|vs�<|j
|d	j	�d��b	d
d
d
�|S#1swY|SxYw#t$rY|SwxYw)zi list of attributes defining a location of a SSL key file
        we must forbid from collection
        )�lmtp_tls_dkey_file�lmtp_tls_eckey_file�lmtp_tls_key_file�smtp_tls_dkey_file�smtp_tls_eckey_file�smtp_tls_key_file�smtpd_tls_dkey_file�smtpd_tls_eckey_file�smtpd_tls_key_file�"tls_legacy_public_key_fingerprints�tlsproxy_tls_dkey_file�tlsproxy_tls_eckey_file�tlsproxy_tls_key_file�smtpd_tls_dh1024_param_file�smtpd_tls_dh512_param_file�tlsproxy_tls_dh1024_param_file�tlsproxy_tls_dh512_param_file�/etc/postfix/main.cf�r�UTF-8��encoding�#�=r�N)�open�	path_join�	readlines�
startswith�split�strip�append�	Exception)�self�forbid_attributes�fpaths�cffile�line�wordss      �</usr/lib/python3/dist-packages/sos/report/plugins/postfix.py�forbidden_ssl_keys_filesz Postfix.forbidden_ssl_keys_filess���
��&��	��d�n�n�%;�<�c�&�(�
;�+1�"�,�,�.�;�D����s�+� � �J�J�s�O�E��Q�x�~�~�'�+<�<��
�
�e�A�h�n�n�&6�q�&9�:�
;�
;��
�
;��
���	���
�	�s5�B1�AB$�2'B$�B1�$B.�)B1�.B1�1	B>�=B>c��d}g}d}tjd�}	t|jd�dd��5}|j	�D]�}tj
dd	|�}|j
|�}|��.|jd�j�}||vs�R|jd�j�}	t|	�d
k(r��|	j|�r|	t|�d
}	|j|	���	d
d
d
�|S#1swY|SxYw#t$r.}
d|
jd
��}|j|�Yd
}
~
|Sd
}
~
wwxYw)z% Get the list of password to exclude )�lmtp_sasl_password_maps�smtp_sasl_password_maps�postscreen_dnsbl_reply_map�smtp_sasl_auth_cache_namezhash:z
^(.*)=(.*)rr r!r"z#.*�Nr&�rzError parsing main.cf: )�re�compiler'r(r)�sub�match�groupr,�lenr*r-r.�args�
_log_error)r/r0r1�prefix�
option_formatr2r3�option�	attribute�filepath�err�msgs            r5�forbidden_password_filesz Postfix.forbidden_password_files;sN��
�������
�
�=�1�
�	!��d�n�n�%;�<�c�&�(�
0�+1�"�,�,�.�0�D��6�6�%��T�2�D�*�0�0��6�F��~� �!'���Q�� 5� 5� 7�I� �$5�5�#)�<�<��?�#8�#8�#:���x�=�A�-�$�#�.�.�v�6�'/��F���'=�H��
�
�h�/�#0�
0�0�
�1
0�0�
��	�	!�+�C�H�H�Q�K�=�9�C��O�O�C� � ��
��		!�s<�D�A"D�A D�>D�D�
D�D�	E�#E�Ec���|jdg�|jddg�|jgd��|j|j��|j|j	��y)Nz
/etc/postfix/�postconf�mailq)z/etc/postfix/*.keyz/etc/postfix/*.crtz/etc/postfix/ssl/)�
add_copy_spec�add_cmd_output�add_forbidden_pathr6rM)r/s r5�setupz
Postfix.setupasx������
�	�	
�����
�	�
	
���!
�	�
	
���� =� =� ?�@����� =� =� ?�@�N)
�__name__�
__module__�__qualname__�
short_desc�plugin_name�profiles�packagesr6rMrT�rUr5rr
s(��&�J��K�#�H��H�$�L$�LArUrc�&��eZdZdZdZ�fd�Z�xZS)�
RedHatPostfix)z/etc/rc.d/init.d/postfixrc�D��t�|��|jd�y)Nz	/etc/mail)�superrTrQ)r/�	__class__s �r5rTzRedHatPostfix.setupxs���
��
�����;�'rU)rVrWrX�filesr\rT�
__classcell__)rbs@r5r_r_ss���)�E��H�(�(rUr_c��eZdZdZy)�
DebianPostfixrN)rVrWrXr\r]rUr5rfrf}s���HrUrf)	r>�sos.report.pluginsrrrrrr_rfr]rUr5�<module>rhs?��
�O�O�cA�f�cA�L(�G�\�(��G�\�<�rU