o
    O6ufæ	  ã                   @   s.   d dl mZmZmZmZ G dd„ deeƒZdS )é    )ÚPluginÚIndependentPluginÚSoSPredicateÚ	PluginOptc                   @   s@   e Zd ZdZdZdZedddd�gZdZd	Z	d
d„ Z
dd„ ZdS )Ú	LibreswanzLibreswan IPsecÚ	libreswan)ÚnetworkÚsecurityÚ	openshiftú
ipsec-barfFzcollect ipsec barf output)ÚdefaultÚdesc)ú/etc/ipsec.conf)r   Úopenswanc                 C   sj   |   g d¢¡ |  g d¢¡ t| ddgddid�}| jdd	g|d
� |  d¡r,|  d¡ |  g d¢¡ d S )N)r   z/etc/ipsec.dz/proc/net/xfrm_stat)zipsec verifyzipsec whack --statuszipsec whack --listallzcertutil -L -d sql:/etc/ipsec.dÚ	xfrm_userÚ	xfrm_algoÚkmodsÚall)r   Úrequiredzip xfrm policyzip xfrm state)Úpredr   z
ipsec barf)z/etc/ipsec.secretsz/etc/ipsec.secrets.dz/etc/ipsec.d/*.dbz/etc/ipsec.d/*.secrets)Úadd_copy_specÚadd_cmd_outputr   Ú
get_optionÚadd_forbidden_path)ÚselfÚ	xfrm_pred© r   ú>/usr/lib/python3/dist-packages/sos/report/plugins/libreswan.pyÚsetup   s   
ÿþý

zLibreswan.setupc                 C   s2   d}|   d|d¡ |  d¡r|   d|d¡ d S d S )Nz/(aead|auth|auth-trunc|enc)(\s.*\s)(0x[0-9a-f]+)Ústatez\1\2********r   Úbarf)Údo_cmd_output_subr   )r   Úxfrm_state_regexpr   r   r   Úpostproc@   s   ÿ
ÿÿzLibreswan.postprocN)Ú__name__Ú
__module__Ú__qualname__Ú
short_descÚplugin_nameÚprofilesr   Úoption_listÚfilesÚpackagesr   r#   r   r   r   r   r      s    ÿÿ"r   N)Úsos.report.pluginsr   r   r   r   r   r   r   r   r   Ú<module>   s   