File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/__pycache__/digicertapi.cpython-310.pyc
Back
o ;j V � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlZ ddl Z ddlZ ddlZ ddl mZmZ z ddlmZ dZW n# eya dZzddlmZ W n ey^ ddlmZ Y nw Y nw dZe�e�Zd d � Zdd� Zd d� Zdd� Zd2dd�Zd2dd�Zd2dd�Z d3dd�Z!d4dd�Z" d5dd�Z#d6dd �Z$d!d"� Z% # d7d$d%�Z&d&d'� Z'd(d)� Z(d*d+� Z)d,d-� Z*d.d/� Z+d0d1� Z,dS )8a< Support for Digicert. Heavily based on the Venafi runner by Joseph Hall (jphall@saltstack.com). Before using this module you need to register an account with Digicert's CertCentral. Login to CertCentral, ensure you have a payment method configured and/or there are adequate funds attached to your account. Click the ``Account`` item in the left sidebar, and select ``Account Access``. The right hand pane should show "Account Access" and a link to create an API key. Create a new API key and assign it to the user that should be attached to requests coming from Salt. NOTE CertCentral will not show the API key again after revealing it the first time. Make sure you copy it right away or you will have to revoke it and generate a new one. Now open ``/etc/salt/master`` and add the API key as shown below. .. code-block:: yaml digicert: api_key: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC Restart your Salt Master. You can also include default values of the following variables to help with creating CSRs: .. code-block:: yaml digicert: api_key: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC shatype: sha256 This API currently only supports RSA key types. Support for other key types will be added if interest warrants. � N)�Sequence)�CommandExecutionError�SaltRunnerError)�RSATF�digicertc C s t �di ��d�rtS dS )zE Only load the module if digicert has configuration in place r �api_keyF)�__opts__�get�__virtualname__� r r �L/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/digicertapi.py�__virtual__B s r c C � t �di ��dd�S )z Return the base_url r Zbase_urlz%https://www.digicert.com/services/v2/�r r r r r r � _base_urlK s �r c C r )z Return the API key r r � r r r r r �_api_keyT s r c O s� t jjj| fi |��}d|d v r|d S t|d d d �}t|d d d �}|dkr/i S || d }|dkr?|d | S |d | }|d } td|�D ] } | d || d � � } t jj�| |�}|| �|d | � qN|S ) zN Wrapper to assist with paginated responses from Digicert's REST API. �errors�dictZpage�limit�totalr � � z?offset=)�salt�utils�http�query�int�range�extend)�urlZtopkey�args�kwargs�retZlimr ZnumpagesZ aggregate_ret�pZ param_urlZnext_retr r r � _paginate[ s"