Your IP : 216.73.216.172


Current Path : /lib/python3/dist-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/sos/report/plugins/__pycache__/postfix.cpython-38.pyc

U

-�_gI�@sZddlZddlmZmZmZmZGdd�de�ZGdd�dee�ZGdd�deee�ZdS)	�N)�Plugin�RedHatPlugin�DebianPlugin�UbuntuPluginc@s4eZdZdZdZdZdZdd�Zdd�Zd	d
�Z	dS)�PostfixzPostfix smtp server�postfix)Zmail�services�rcCs�ddddddddd	d
ddd
ddddg}g}znt|�d�ddd��P}|��D]@}|�d�rZqJ|�d�}|d��|krJ|�|d��d�qJW5QRXWntk
r�YnX|S)zi list of attributes defining a location of a SSL key file
        we must forbid from collection
        Zlmtp_tls_dkey_fileZlmtp_tls_eckey_fileZlmtp_tls_key_fileZsmtp_tls_dkey_fileZsmtp_tls_eckey_fileZsmtp_tls_key_fileZsmtpd_tls_dkey_fileZsmtpd_tls_eckey_fileZsmtpd_tls_key_fileZ"tls_legacy_public_key_fingerprintsZtlsproxy_tls_dkey_fileZtlsproxy_tls_eckey_fileZtlsproxy_tls_key_fileZsmtpd_tls_dh1024_param_fileZsmtpd_tls_dh512_param_fileZtlsproxy_tls_dh1024_param_fileZtlsproxy_tls_dh512_param_file�/etc/postfix/main.cf�r�UTF-8��encoding�#�=r�)�open�	path_join�	readlines�
startswith�split�strip�append�	Exception)�self�forbid_attributes�fpaths�cffile�lineZwords�r�</usr/lib/python3/dist-packages/sos/report/plugins/postfix.py�forbidden_ssl_keys_filessB��

&z Postfix.forbidden_ssl_keys_filesc
Csd}g}d}t�d�}z�t|�d�ddd���}|��D]|}t�dd	|�}|�|�}|d
kr\q6|�d���}||kr6|�d���}	t	|	�d
kr�q6|	�
|�r�|	t	|�d
�}	|�|	�q6W5QRXWn<tk
r�}
zd|
j
d
��}|�|�W5d
}
~
XYnX|S)z% Get the list of password to exclude )Zlmtp_sasl_password_mapsZsmtp_sasl_password_mapsZpostscreen_dnsbl_reply_mapZsmtp_sasl_auth_cache_namezhash:z
^(.*)=(.*)r
rrr
z#.*�Nr�rzError parsing main.cf: )�re�compilerrr�sub�match�groupr�lenrrr�argsZ
_log_error)rrr�prefixZ
option_formatrrZoptionZ	attribute�filepath�err�msgrrr �forbidden_password_files;s4
�

z Postfix.forbidden_password_filescCsJ|�dg�|�ddg�|�dddg�|�|���|�|���dS)Nz
/etc/postfix/ZpostconfZmailqz/etc/postfix/*.keyz/etc/postfix/*.crtz/etc/postfix/ssl/)�
add_copy_specZadd_cmd_outputZadd_forbidden_pathr!r/�rrrr �setupas���z
Postfix.setupN)
�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofiles�packagesr!r/r2rrrr r
s&&rcs$eZdZdZdZ�fdd�Z�ZS)�
RedHatPostfix)z/etc/rc.d/init.d/postfixr	cst���|�d�dS)Nz	/etc/mail)�superr2r0r1��	__class__rr r2xs
zRedHatPostfix.setup)r3r4r5�filesr6r2�
__classcell__rrr9r r7ssr7c@seZdZdZdS)�
DebianPostfixr	N)r3r4r5r6rrrr r=}sr=)	r$Zsos.report.pluginsrrrrrr7r=rrrr �<module>	sf