golden hour
/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/__pycache__
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.cpython-310.pyc
197 B
Del
OK
asam.cpython-310.pyc
7.9 KB
Del
OK
auth.cpython-310.pyc
1.89 KB
Del
OK
bgp.cpython-310.pyc
12.55 KB
Del
OK
cache.cpython-310.pyc
10.98 KB
Del
OK
cloud.cpython-310.pyc
4.16 KB
Del
OK
config.cpython-310.pyc
1.08 KB
Del
OK
ddns.cpython-310.pyc
6.7 KB
Del
OK
digicertapi.cpython-310.pyc
16.23 KB
Del
OK
doc.cpython-310.pyc
1.76 KB
Del
OK
drac.cpython-310.pyc
4.15 KB
Del
OK
error.cpython-310.pyc
771 B
Del
OK
event.cpython-310.pyc
2.32 KB
Del
OK
f5.cpython-310.pyc
8.29 KB
Del
OK
fileserver.cpython-310.pyc
17.12 KB
Del
OK
git_pillar.cpython-310.pyc
3.54 KB
Del
OK
http.cpython-310.pyc
2.55 KB
Del
OK
jobs.cpython-310.pyc
13.26 KB
Del
OK
launchd.cpython-310.pyc
1.49 KB
Del
OK
lxc.cpython-310.pyc
13.3 KB
Del
OK
manage.cpython-310.pyc
21.71 KB
Del
OK
mattermost.cpython-310.pyc
4.21 KB
Del
OK
mine.cpython-310.pyc
1.79 KB
Del
OK
nacl.cpython-310.pyc
8.46 KB
Del
OK
net.cpython-310.pyc
27.7 KB
Del
OK
network.cpython-310.pyc
2.59 KB
Del
OK
pagerduty.cpython-310.pyc
3.96 KB
Del
OK
pillar.cpython-310.pyc
4.25 KB
Del
OK
pkg.cpython-310.pyc
1.37 KB
Del
OK
queue.cpython-310.pyc
8.14 KB
Del
OK
reactor.cpython-310.pyc
4.32 KB
Del
OK
salt.cpython-310.pyc
4.58 KB
Del
OK
saltutil.cpython-310.pyc
15.88 KB
Del
OK
sdb.cpython-310.pyc
2.54 KB
Del
OK
smartos_vmadm.cpython-310.pyc
7.99 KB
Del
OK
spacewalk.cpython-310.pyc
7.54 KB
Del
OK
ssh.cpython-310.pyc
1000 B
Del
OK
state.cpython-310.pyc
8.22 KB
Del
OK
survey.cpython-310.pyc
5.07 KB
Del
OK
test.cpython-310.pyc
2.65 KB
Del
OK
thin.cpython-310.pyc
1.81 KB
Del
OK
vault.cpython-310.pyc
10.01 KB
Del
OK
venafiapi.cpython-310.pyc
5.57 KB
Del
OK
virt.cpython-310.pyc
13.15 KB
Del
OK
vistara.cpython-310.pyc
4.39 KB
Del
OK
winrepo.cpython-310.pyc
5.14 KB
Del
OK
Edit: venafiapi.cpython-310.pyc
o �xe� � @ s� d Z ddlZddlZddlZddlZddlmZ ddlZddl Zddl ZddlmZ zddl Z ddlmZ dZW n eyC dZY nw dZdZe�e�Zd d � Zdd� Z dd d�ZeZdd� Zdd� Zdd� Zdd� ZdS )a) Support for Venafi :depends: - vcert Python module :configuration: In order to connect to Venafi services you need to specify it in Salt master configuration. Example for Venafi Cloud (using env variables): .. code-block:: yaml venafi: api_key: "sdb://osenv/CLOUDAPIKEY" Example for Venafi Platform (using env variables): .. code-block:: yaml venafi: base_url: "https://tpp.example.com/" tpp_user: admin tpp_password: "sdb://osenv/TPP_PASSWORD" trust_bundle: "/opt/venafi/bundle.pem" � N)�CommandExecutionError)�CertificateRequestTF�venafi/domains�venafic C s� t �d� t�di ��dd�} t�di ��dd�}t �d|� t�di ��dd�}t�di ��dd�}t�di ��d d�}t�di ��d d�}t �d� |rTtjdd �S |rht �d|� tj|| ||d|id�S tj|| ||d�S )Nz=Initializing Venafi Trust Platform or Venafi Cloud connectionr �api_key� �base_urlzUsing base_url: %s�tpp_user�tpp_password�trust_bundle�fakezFinished config processingT)r z"Will use trust bundle from file %sZverify)�url�token�user�passwordZhttp_request_kwargs)r r r r )�log�info�__opts__�get�vcertZ Connection)r r r r r r � r �J/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/venafiapi.py�_init_connection3 s. ��r c C s t rtS dS )z; Only load the module if vcert module is installed F)� HAS_VCERT�__virtualname__r r r r �__virtual__N s r c C s0 t �d� |du rt �d� t�d� |dur"|�d�r"td |�}t� }| du rEt|||||||d�}|� |�} t �d| � |� | � nEt �d | � t �d |� z#tjj �| ��}|�� }W d � n1 shw Y t||d�}W n ty� } z tdj| |d ���d}~ww |�||� d}t�� | }d}|du r�t�� |k r�|�|�}|du r�t�d� |du r�t�� |k s�| du r�|j}n7| r�ztjj �| ��}|�� }W d � n1 s�w Y W n ty� } z tdj| |d ���d}~ww d}tj�ttj�}| |j|j|d�}|�t||� |j|fS )z� Request a new certificate CLI Example: .. code-block:: bash salt-run venafi.request <minion_id> <dns_name> zRequesting Venafi certificateNzMissing zone parameter� zsdb://zsdb.get)�common_name�countryZprovinceZlocalityZorganizationZorganizational_unit�key_passwordzUpdating request from zone %szWill use generated CSR from %szUsing CN %s)�csrr z"Unable to open file {file}: {excp})�fileZexcpi, � )� minion_id�cert�chainZpkey) r r �error�sys�exit� startswithZ__salt__r r Zread_zone_confZupdate_from_zone_config�salt�utils�filesZfopen�read� Exception�formatZrequest_cert�timeZ retrieve_cert�sleepZprivate_key_pem�cache�Cacher �syspaths� CACHE_DIRr$ r% �store�CACHE_BANK_NAME)r# �dns_name�zoner �state�locZorgZorg_unitr Zcsr_pathZ pkey_path�conn�requestZzone_configZcsr_filer �eZtimeout_seconds�timeoutr$ Zprivate_keyZ pkey_filer2 �datar r r r= W s� � ���� � ������ r= c C sN t j�ttj�}|�t| �}t|t �sg }||vr|� |� |�t| |� dS )zA Maintain a relationship between a minion and a DNS name N)r* r2 r3 r r4 r5 �fetchr7 � isinstance�list�appendr6 )r# r8 r2 Z dns_namesr r r �_id_map� s rE c C s. t j�ttj�}|�t| �pi }|�d�}|S )z� Show issued certificate for domain CLI Example: .. code-block:: bash salt-run venafi.show_cert example.com r$ ) r* r2 r3 r r4 r5 rA r7 r )r8 r2 Zdomain_datar$ r r r � show_cert� s rF c C s t j�ttj�} | �d�S )z� List domains that have been cached CLI Example: .. code-block:: bash salt-run venafi.list_domain_cache r )r* r2 r3 r r4 r5 rC )r2 r r r �list_domain_cache� s rG c C s� t j�ttj�}t| t�r| �d�} t| t �st d��g }g }| D ]}z |�t|� |� |� W q! t y> |� |� Y q!w ||d�S )z� Delete cached domains from the master CLI Example: .. code-block:: bash salt-run venafi.del_cached_domain domain1.example.com,domain2.example.com �,zwYou must pass in either a string containing one or more domains separated by commas, or a list of single domain strings)Z SucceededZFailed)r* r2 r3 r r4 r5 rB �str�splitrC r �flushr7 rD )Zdomainsr2 �successZfailed�domainr r r �del_cached_domain� s"