Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/sos/report/plugins/__pycache__/postfix.cpython-36.pyc

3

�fI�@sZddlZddlmZmZmZmZGdd�de�ZGdd�dee�ZGdd�deee�ZdS)	�N)�Plugin�RedHatPlugin�DebianPlugin�UbuntuPluginc@s4eZdZdZdZdZd
Zdd�Zdd�Zd	d
�Z	dS)�PostfixzPostfix smtp server�postfix�mail�servicescCs�ddddddddd	d
ddd
ddddg}g}yrt|jd�ddd��T}xL|j�D]@}|jd�r\qL|jd�}|dj�|krL|j|dj�d�qLWWdQRXWntk
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_filez/etc/postfix/main.cf�rzUTF-8)�encoding�#�=r�N)�open�	path_join�	readlines�
startswith�split�strip�append�	Exception)�self�forbid_attributes�fpaths�cffile�lineZwords�r�/usr/lib/python3.6/postfix.py�forbidden_ssl_keys_filess<


(z Postfix.forbidden_ssl_keys_filescCsd}g}d}tjd�}y�t|jd�dd	d
���}x�|j�D]|}tjdd|�}|j|�}|d
kr^q8|jd�j�}||kr8|jd�j�}	t	|	�dkr�q8|	j
|�r�|	t	|�d
�}	|j|	�q8WWd
QRXWn>tk
�r}
z d|
j
d��}|j|�WYd
d
}
~
XnX|S)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
^(.*)=(.*)z/etc/postfix/main.cfr
zUTF-8)rz#.*�Nr�rzError parsing main.cf: )rr r!r")�re�compilerrr�sub�match�groupr�lenrrr�argsZ
_log_error)rrr�prefixZ
option_formatrrZoptionZ	attribute�filepath�err�msgrrr�forbidden_password_files;s6



z Postfix.forbidden_password_filescCsJ|jdg�|jddg�|jdddg�|j|j��|j|j��dS)Nz
/etc/postfix/ZpostconfZmailqz/etc/postfix/*.keyz/etc/postfix/*.crtz/etc/postfix/ssl/)�
add_copy_specZadd_cmd_outputZadd_forbidden_pathrr0)rrrr�setupasz
Postfix.setupN)rr	)r)
�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofiles�packagesrr0r2rrrrr
s&&rcs$eZdZdZdZ�fdd�Z�ZS)�
RedHatPostfix�/etc/rc.d/init.d/postfixrcst�j�|jd�dS)Nz	/etc/mail)�superr2r1)r)�	__class__rrr2xs
zRedHatPostfix.setup)r8)r)r3r4r5�filesr6r2�
__classcell__rr)r:rr7ssr7c@seZdZdZdS)�
DebianPostfixrN)r)r3r4r5r6rrrrr=}sr=)	r%Zsos.report.pluginsrrrrrr7r=rrrr�<module>	sf

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists