
    -_g                     d    d dl mZmZmZmZ  G d de      Z G d dee      Z G d deee      Zy)	    )PluginRedHatPluginDebianPluginUbuntuPluginc                   4     e Zd ZdZdZdZdZ fdZd Z xZ	S )LdapzLDAP configurationldap)identitysysmgmtsystemz/etc/openldap/ldap.confc                 D    t         |           | j                  d       y )N/etc/ldap.conf)supersetupadd_copy_specself	__class__s    9/usr/lib/python3/dist-packages/sos/report/plugins/ldap.pyr   z
Ldap.setup   s    +,    c                 *    | j                  ddd       y )Nr   (\s*bindpw\s*)\S+z\1******)do_file_sub)r   s    r   postproczLdap.postproc   s    )+?Mr   )
__name__
__module____qualname__
short_descplugin_nameprofiles	ldap_confr   r   __classcell__r   s   @r   r   r      s"    %JK0H)I-Nr   r   c                   0     e Zd ZdZdZ fdZ fdZ xZS )
RedHatLdap)openldapznss-pam-ldapd)r   /etc/pam_ldap.confc                     t         |           | j                  g d       | j                  | j                  ddddg       | j                  d       y )N)z/etc/openldap/certs/passwordz/etc/openldap/certs/pwfile.txtz/etc/openldap/certs/pin.txtz/etc/openldap/certs/*passw*z/etc/openldap/certs/key3.dbz/etc/openldap/certs/cert8.dbz/etc/openldap/certs/secmod.db/etc/nslcd.confr'   zcertutil -L -d /etc/openldap)r   r   add_forbidden_pathr   r!   add_cmd_outputr   s    r   r   zRedHatLdap.setup!   sX     !
 	 	NN*+ 
 	 	:;r   c                 V    t         |           dD ]  }| j                  |dd        y )N)r)   r'   r   
\1********)r   r   r   )r   filer   s     r   r   zRedHatLdap.postproc4   s4    = 	D$	r   )r   r   r   packagesfilesr   r   r"   r#   s   @r   r%   r%      s    ,H4E<& r   r%   c                   0     e Zd ZdZdZ fdZ fdZ xZS )
DebianLdapz/etc/ldap/ldap.conf)slapdz
ldap-utilsc                 
   t         |           d}| j                  | j                  dddg       | j	                  d       | j	                  |dz   d       | j	                  |d	z   d
       | j	                  |dz   d       y )Nz,ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// z/etc/slapd.confz/etc/ldap/slapd.dr)   z+ldapsearch -x -b '' -s base 'objectclass=*'z/-b cn=config '(!(objectClass=olcSchemaConfig))'configuration_minus_schemas)suggest_filenamez-b cn=schema,cn=config dnloaded_schemasz0-b cn=config '(olcAccess=*)' olcAccess olcSuffixaccess_control_lists)r   r   r   r!   r+   )r   ldap_searchr   s     r   r   zDebianLdap.setupC   s    DNN	
 	 	IJKK: 	 	< 	55- 	 	/ 	LL3 	 	5r   c                 n    t         |           | j                  ddd       | j                  ddd       y )Nr)   r   r-   
ldapsearchz(olcRootPW\: \s*)\S+)r   r   r   do_cmd_output_subr   s    r   r   zDebianLdap.postprocZ   s>     	

 	#	
r   )r   r   r   r!   r/   r   r   r"   r#   s   @r   r2   r2   >   s    %I&H5.
 
r   r2   N)sos.report.pluginsr   r   r   r   r   r%   r2    r   r   <module>r?      s;    P ON6 N | D'
|\ '
r   