U
    -_g                     @   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                       s4   e Zd ZdZdZdZdZ fddZdd Z  Z	S )	LdapzLDAP configurationZldap)ZidentityZsysmgmtsystemz/etc/openldap/ldap.confc                    s   t    | d d S )N/etc/ldap.conf)supersetupadd_copy_specself	__class__ 9/usr/lib/python3/dist-packages/sos/report/plugins/ldap.pyr
      s    
z
Ldap.setupc                 C   s   |  ddd d S )Nr   (\s*bindpw\s*)\S+z\1******)do_file_subr   r   r   r   postproc   s    zLdap.postproc)
__name__
__module____qualname__Z
short_descZplugin_nameZprofiles	ldap_confr
   r   __classcell__r   r   r   r   r      s   r   c                       s0   e Zd ZdZdZ fddZ fddZ  ZS )
RedHatLdap)Zopenldapznss-pam-ldapd)r   /etc/pam_ldap.confc                    sB   t    | dddddg | | jdddd	g | d
 d S )Nz/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
   Zadd_forbidden_pathr   r   add_cmd_outputr   r   r   r   r
   !   s     
zRedHatLdap.setupc                    s&   t    dD ]}| |dd qd S )N)r   r   r   
\1********)r	   r   r   )r   filer   r   r   r   4   s    
zRedHatLdap.postproc)r   r   r   packagesfilesr
   r   r   r   r   r   r   r      s   r   c                       s0   e Zd ZdZdZ fddZ fddZ  ZS )
DebianLdapz/etc/ldap/ldap.conf)Zslapdz
ldap-utilsc                    sf   t    d}| | jdddg | d | j|d dd | j|d	 d
d | j|d dd d S )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))'Zconfiguration_minus_schemas)Zsuggest_filenamez-b cn=schema,cn=config dnZloaded_schemasz0-b cn=config '(olcAccess=*)' olcAccess olcSuffixZaccess_control_lists)r	   r
   r   r   r   )r   Zldap_searchr   r   r   r
   C   s*    

zDebianLdap.setupc                    s*   t    | ddd | ddd d S )Nr   r   r   Z
ldapsearchz(olcRootPW\: \s*)\S+)r	   r   r   Zdo_cmd_output_subr   r   r   r   r   Z   s    
zDebianLdap.postproc)r   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   "