File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/renderers/__pycache__/pass.cpython-310.pyc
o
�N�g� � @ sx d Z ddlZddlZddlmZ ddlmZmZ ddlZ ddl
mZmZ e�
e�Zdd� Zdd � Zd
d� Zddd�ZdS )a�
Pass Renderer for Salt
======================
pass_ is an encrypted on-disk password store.
.. _pass: https://www.passwordstore.org/
.. versionadded:: 2017.7.0
Setup
-----
*Note*: ``<user>`` needs to be replaced with the user salt-master will be
running as.
Have private gpg loaded into ``user``'s gpg keyring
.. code-block:: yaml
load_private_gpg_key:
cmd.run:
- name: gpg --import <location_of_private_gpg_key>
- unless: gpg --list-keys '<gpg_name>'
Said private key's public key should have been used when encrypting pass entries
that are of interest for pillar data.
Fetch and keep local pass git repo up-to-date
.. code-block:: yaml
update_pass:
git.latest:
- force_reset: True
- name: <git_repo>
- target: /<user>/.password-store
- identity: <location_of_ssh_private_key>
- require:
- cmd: load_private_gpg_key
Install pass binary
.. code-block:: yaml
pass:
pkg.installed
Salt master configuration options
.. code-block:: yaml
# If the prefix is *not* set (default behavior), all template variables are
# considered for fetching secrets from Pass. Those that cannot be resolved
# to a secret are passed through.
#
# If the prefix is set, only the template variables with matching prefix are
# considered for fetching the secrets, other variables are passed through.
#
# For ease of use it is recommended to set the following options as well:
# renderer: 'jinja|yaml|pass'
# pass_strict_fetch: true
#
pass_variable_prefix: 'pass:'
# If set to 'true', error out when unable to fetch a secret for a template variable.
pass_strict_fetch: true
# Set GNUPGHOME env for Pass.
# Defaults to: ~/.gnupg
pass_gnupghome: <path>
# Set PASSWORD_STORE_DIR env for Pass.
# Defaults to: ~/.password-store
pass_dir: <path>
� N)�
expanduser)�PIPE�Popen)�SaltConfigurationError�SaltRenderErrorc C s t jj�d�} | r| S td��)z6
Return the pass executable or raise an error
�passzpass unavailable)�salt�utils�path�whichr )� pass_exec� r
�G/opt/saltstack/salt/lib/python3.10/site-packages/salt/renderers/pass.py�_get_pass_execY s r c
C sR t � }| }td }|r| �|�s| S | t|�d� } td }|r(|s(d}t|��| �� } |d| g}t�dd�|�� t j
�� }td�|d <