
    ~ gI                     l    S SK r S SKJrJrJrJr   " S S\5      r " S S\\5      r " S S\\\5      rg)	    N)PluginRedHatPluginDebianPluginUbuntuPluginc                   6    \ rS rSrSrSrSrSrS rS r	S r
S	rg
)Postfix   zPostfix smtp serverpostfix)mailservicesr
   c                    / SQn/ n [        U R                  S5      SSS9 nUR                  5        Hj  nUR                  S5      (       a  M  UR	                  S5      nUS   R                  5       U;   d  ME  UR                  US	   R	                  5       S   5        Ml     S
S
S
5        U$ ! , (       d  f       U$ = f! [         a     U$ f = f)zXlist 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_files Postfix.forbidden_ssl_keys_files   s    
& 	dnn%;<c&(+1",,.Ds++  JJsOEQx~~'+<<eAhnn&6q&9: /( ( (   		s5   B= AB+8)B+!B= +
B:5B= :B= =
C
Cc                    Sn/ nSn[         R                  " S5      n [        U R                  S5      SSS9 nUR	                  5        H  n[         R
                  " SS	U5      nUR                  U5      nUc  M1  UR                  S5      R                  5       nX;   d  MW  UR                  S5      R                  5       n	[        U	5      S:X  a  M  U	R                  U5      (       a  U	[        U5      S
 n	UR                  U	5        M     S
S
S
5        U$ ! , (       d  f       U$ = f! [         a.  n
SU
R                  S    3nU R                  U5         S
n
A
U$ S
n
A
ff = f)z$Get the list of password to exclude )lmtp_sasl_password_mapssmtp_sasl_password_mapspostscreen_dnsbl_reply_mapsmtp_sasl_auth_cache_namezhash:z
^(.*)=(.*)r    r!   r"   r#   z#.* Nr'      r   zError parsing main.cf: )recompiler(   r)   r*   submatchgroupr-   lenr+   r.   r/   args
_log_error)r0   r1   r2   prefixoption_formatr3   r4   option	attributefilepatherrmsgs               r6   forbidden_password_files Postfix.forbidden_password_files;   sI   
 

=1	!dnn%;<c&(+1",,.D66%T2D*006F~  !'Q 5 5 7I 5#)<<?#8#8#:x=A-$#..v66'/F'=Hh/# /(0 1( (0 	  	!+CHHQK=9COOC  		!s<   D% A$D A)D	D% 
D"D% "D% %
E/#EEc                     U R                  S/5        U R                  SS/5        U R                  / SQ5        U R                  U R                  5       5        U R                  U R	                  5       5        g )Nz/etc/postfix/postconfmailq)z/etc/postfix/*.keyz/etc/postfix/*.crtz/etc/postfix/ssl/)add_copy_specadd_cmd_outputadd_forbidden_pathr7   rO   )r0   s    r6   setupPostfix.setupa   sx    
 	 	
 	
 	 !
 	
 	 = = ?@ = = ?@     N)__name__
__module____qualname____firstlineno__
short_descplugin_nameprofilespackagesr7   rO   rW   __static_attributes__rZ   rY   r6   r   r      s(    &JK#HH$L$LArY   r   c                   0   ^  \ rS rSrSrSrU 4S jrSrU =r$ )RedHatPostfixs   )z/etc/rc.d/init.d/postfixr   c                 D   > [         TU ]  5         U R                  S5        g )Nz	/etc/mail)superrW   rT   )r0   	__class__s    r6   rW   RedHatPostfix.setupx   s    ;'rY   rZ   )	r[   r\   r]   r^   filesrb   rW   rc   __classcell__)ri   s   @r6   re   re   s   s    )EH( (rY   re   c                       \ rS rSrSrSrg)DebianPostfix}   r   rZ   N)r[   r\   r]   r^   rb   rc   rZ   rY   r6   rn   rn   }   s    HrY   rn   )	r@   sos.report.pluginsr   r   r   r   r   re   rn   rZ   rY   r6   <module>rq      s?    
 O OcAf cAL(G\ (G\< rY   