U
    *bÒ
  ã                   @   sR   d dl mZmZmZmZ G dd„ deƒZG dd„ deeƒZG dd„ deeeƒZdS )	é    )ÚPluginÚRedHatPluginÚDebianPluginÚUbuntuPluginc                   @   s,   e Zd ZdZdZdZdZdd„ Zdd„ Zd	S )
ÚPostfixzPostfix smtp serverÚpostfix)ZmailÚservices©r   c                 C   s¦   ddddddddd	d
dddddddg}g }d zjt |  d¡dƒP}| ¡ D ]@}| d¡rXqH| d¡}|d  ¡ |krH| |d  ¡ d ¡ qHW 5 Q R X W 5 |£  S X  )NZlmtp_tls_dkey_fileZlmtp_tls_eckey_fileZlmtp_tls_key_fileZsmtp_tls_dkey_fileZsmtp_tls_eckey_fileZsmtp_tls_key_fileZsmtpd_tls_dkey_fileZsmtpd_tls_eckey_fileZsmtpd_tls_key_fileZ"tls_legacy_public_key_fingerprintsZtlsproxy_tls_dkey_fileZtlsproxy_tls_eckey_fileZtlsproxy_tls_key_fileZsmtpd_tls_dh1024_param_fileZsmtpd_tls_dh512_param_fileZtlsproxy_tls_dh1024_param_fileZtlsproxy_tls_dh512_param_filez/etc/postfix/main.cfÚrú#ú=r   é   )ÚopenZ	path_joinÚ	readlinesÚ
startswithÚsplitÚstripÚappend)ÚselfZforbid_attributesÚfpZcffileÚlineZwords© r   ú</usr/lib/python3/dist-packages/sos/report/plugins/postfix.pyÚforbidden_ssl_keys_files   s8    ï

&z Postfix.forbidden_ssl_keys_filesc                 C   s<   |   dg¡ |  ddg¡ |  dddg¡ |  |  ¡ ¡ d S )Nz/etc/postfix/ZpostconfZmailqz/etc/postfix/*.keyz/etc/postfix/*.crtz/etc/postfix/ssl/)Úadd_copy_specZadd_cmd_outputZadd_forbidden_pathr   ©r   r   r   r   Úsetup7   s    ÿþýzPostfix.setupN)	Ú__name__Ú
__module__Ú__qualname__Z
short_descZplugin_nameZprofilesÚpackagesr   r   r   r   r   r   r      s   #r   c                       s$   e Zd ZdZdZ‡ fdd„Z‡  ZS )ÚRedHatPostfix)z/etc/rc.d/init.d/postfixr	   c                    s   t t| ƒ ¡  |  d¡ d S )Nz	/etc/mail)Úsuperr!   r   r   r   ©Ú	__class__r   r   r   M   s    zRedHatPostfix.setup)r   r   r   Úfilesr    r   Ú__classcell__r   r   r#   r   r!   H   s   r!   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )ÚDebianPostfixr	   c                    s   t t| ƒ ¡  d S )N)r"   r'   r   r   r#   r   r   r   V   s    zDebianPostfix.setup)r   r   r   r    r   r&   r   r   r#   r   r'   R   s   r'   N)Zsos.report.pluginsr   r   r   r   r   r!   r'   r   r   r   r   Ú<module>	   s   <
