HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/keystore.cpython-310.pyc
o

�N�g��@s8dZddlZddlZdZe�e�Zdd�Zd	dd�ZdS)
z%
State management of a java keystore
�NZkeystorecCsdtvrtSdd�t�fS)zM
    Only load this module if the keystore execution module is available
    �
keystore.listFzDCannot load the {} state module: keystore execution module not found)�__salt__�__virtualname__�format�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/keystore.py�__virtual__s��rFcCs�id|dd�}g}g}|r-tj�|�r-td||�}|D]
}|�|�d��qt�d|�|D]�}d}	d}
tj�|�r�|rD|�|d�td|||d�}
|
r�|
dd	}ztd
|d�d}Wn!tt	fy�}
zt�d
�td|d�}WYd}
~
nd}
~
ww|�
t�|�
t�kr�d}	|	�rtdr�d|d<|
r�|dd�
|d�7<q/|dd�
|d�7<q/|
r�td|d||�}td|d|||d|�dd�d�}|r�d|d|d<|dd�
|d�7<q/td|d|||d|�dd�d�}|�rd|d|d<|dd�
|d�7<q/|�rftt|�t|��}t�d|�|D]4}td�rJ|dd|�d �7<d|d<�q1td|||�d!|d|<|dd|�d"�7<�q1|d�st|d�std#|d<|S)$a�
    Create or manage a java keystore.

    :param name: The path to the keystore file
    :param passphrase: The password to the keystore
    :param entries: A list containing an alias, certificate, and optional private_key.
        The certificate and private_key can be a file or a string

        .. code-block:: yaml

          - entries:
            - alias: hostname2
              certificate: /path/to/cert.crt
              private_key: /path/to/key.key
            - alias: stringhost
              certificate: |
                -----BEGIN CERTIFICATE-----
                MIICEjCCAXsCAg36MA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG
                2VguKv4SWjRFoRkIfIlHX0qVviMhSlNy2ioFLy7JcPZb+v3ftDGywUqcBiVDoea0
                -----END CERTIFICATE-----
    :param force_remove: If True will cause the state to remove any entries found in the keystore
        which are not defined in the state. The default is False.  Example:

        .. code-block:: yaml

          define_keystore:
            keystore.managed:
              - name: /path/to/keystore
              - passphrase: changeit
              - force_remove: True
              - entries:
                - alias: hostname1
                  certificate: /path/to/cert.crt
                - alias: remotehost
                  certificate: /path/to/cert2.crt
                  private_key: /path/to/key2.key
                - alias: pillarhost
                  certificate: {{ salt.pillar.get('path:to:cert') }}
    �T)�changes�comment�name�resultr�aliaszExisting aliases list: %sNr�sha1zx509.read_certificateZcertificatezSHA1 Finger Printz;Unable to obtain SHA1 finger print from entry's certificatezkeystore.get_sha1F�testr
rz!Alias {} would have been updated
zAlias {} would have been added
zkeystore.removezkeystore.add�private_key)rZUpdatedr
zAlias {} updated.
ZAddedzAlias {} added.
zWill remove: %szAlias z would have been removedZRemovedz
 removed.
zNo changes made.
)�os�path�existsr�append�get�log�debug�KeyError�	TypeError�decodeZ__salt_system_encoding__Z__opts__r�list�set)rZ
passphrase�entriesZforce_remove�retZ	keep_listZold_aliasesZexisting_entries�entryZupdate_entryZexisting_entryZ
existing_sha1Znew_sha1�errr
Zremove_listZ
alias_namerrr�manageds�(�����
�
�
�
��
��
r")F)	�__doc__�loggingrr�	getLogger�__name__rrr"rrrr�<module>s