
    -_g                     t    d dl Z d dlZ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)	    N)PluginRedHatPluginDebianPluginUbuntuPluginc                   ,    e Zd ZdZdZdZdZdZd Zd Z	y)Krb5a:  This plugin handles the collection of kerberos authentication config
    files and logging. Users should expect to see their krb5 config(s) in the
    final archive, along with krb5 logging and `klist` output.

    kdc configs and acls will also be collected from the distribution-spcecific
    kdc directory.
    zKerberos authenticationkrb5)identitysystemNc                 
   | j                  dd| j                   d| j                   ddg       | j                          | j                  dd       | j                  d	| j                   d
       | j                  d       y )Nz/etc/krb5.confz/etc/krb5.conf.d/*z
/kadm5.aclz	/kdc.confz/var/log/kadmind.logz/var/log/krb5kdc.logkerberos_kdc_log)tagszklist -ket z/.k5*zklist -ket /etc/krb5.keytab)add_copy_speckdcdircollect_kinitadd_cmd_output)selfs    9/usr/lib/python3/dist-packages/sos/report/plugins/krb5.pysetupz
Krb5.setup   s     {{m:&{{m9%"
 	 	18JKk$++e<=9:    c                    t        j                         }d}| j                  |      rt        |dd      5 }|D ]  }t	        j
                  d|t        j                        r<|j                  d      d   dd	 j                         }| j                  d
| d        n>t	        j
                  d|t        j                        s| j                  d
| d        n ddd       yy# 1 sw Y   yxY w)a)  
        Collect the kinit command output for the system with id_provider "AD"
        or "IPA" domains.

        While integrating the Linux M/c with AD the realmd will create a
        computer object on the AD side. The realmd and AD restrict the
        Hostname/SPN to 15 Characters.
        z/etc/sssd/sssd.confrzutf-8)encodingz\s*id_provider\s*=\s*ad.r   N   zMKRB5_TRACE=/dev/stdout                                             kinit -k 'z$'z\s*id_provider\s*=\s*ipa')
socketgetfqdnpath_isfileopenrematch
IGNORECASEsplitupperr   )r   hostname	sssd_confflines        r   r   zKrb5.collect_kinit+   s     >>#)	I&iw7 1 Dxx : $bmm5#+>>##6q#9#2#>#D#D#F++ /77?j-D Exx ; $bmm5++ /77?j-C D  ' s   BC%C%%C.)
__name__
__module____qualname____doc__
short_descplugin_nameprofilesr   r   r    r   r   r   r      s'     +JK%HF;r   r   c                       e Zd ZdZdZy)
RedHatKrb5)z	krb5-libszkrb5-serverz/var/kerberos/krb5kdcNr*   r+   r,   packagesr   r1   r   r   r3   r3   G   s    +H$Fr   r3   c                       e Zd ZdZdZy)
UbuntuKrb5)zkrb5-kdczkrb5-configz	krb5-userz/var/lib/krb5kdcNr4   r1   r   r   r7   r7   M   s    7HFr   r7   )
r!   r   sos.report.pluginsr   r   r   r   r   r3   r7   r1   r   r   <module>r9      s>    
  O O46 4n%| % |\  r   