o
    id                     @   s&   d dl mZmZ G dd deeZdS )    )PluginUbuntuPluginc                   @   s4   e Zd ZdZdZdZdZdZdZdd Z	dd	 Z
d
S )VaultzThe Vault plugin collects the current status of the vault
    snap on a Ubuntu machine.

    It will collect logs from journal, vault status and configuration
    z3Manage access to secrets and protect sensitive datavault)sysmgmtsecurity)r   c              
   C   s   d}|  | zCt|d3}|  D ]"}|sq|d}|d  dkr6|d d}| jdd	|id
 qW d    W d S 1 sCw   Y  W d S  tyf } z| d||f  W Y d }~d S d }~ww )N /var/snap/vault/common/vault.hclr=r   api_addr   z" zvault status
VAULT_ADDR)envzCould not open conf file %s: %s)	add_copy_specopenread
splitlinessplitstripadd_cmd_outputIOError
_log_error)self	vault_cfgcflinewordsr   error r   :/usr/lib/python3/dist-packages/sos/report/plugins/vault.pysetup   s,   

&	zVault.setupc                 C   s   |  ddd d S )Nr   z(password\s?=\s?).*z\1******)do_file_sub)r   r   r   r   postproc0   s
   zVault.postprocN)__name__
__module____qualname____doc__
short_descplugin_nameprofilesservicespackager    r"   r   r   r   r   r      s    r   N)sos.report.pluginsr   r   r   r   r   r   r   <module>   s   
