Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/crypto/acme/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/crypto/acme/acme_challenge_cert_helper.pyc

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZmZddl
mZmZdd
lmZmZddlZddlZddlZddlZdZy�ddlZddlZddlZddlZddlZddlZddlZddl Zddl!Zddl"Zddl#Z#ddl$m%Z%e%ej&�e%d�kZ'ej(j)j*�Z+Wn%e,k
r�Z-ej.�Ze/Z'nXej0ddkr�d�Z1n	d�Z1d�Z2e3dkr�e2�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysA
---
module: acme_challenge_cert_helper
author: "Felix Fontein (@felixfontein)"
version_added: "2.7"
short_description: Prepare certificates required for ACME challenges such as C(tls-alpn-01)
description:
   - "Prepares certificates for ACME challenges such as C(tls-alpn-01)."
   - "The raw data is provided by the M(acme_certificate) module, and needs to be
      converted to a certificate to be used for challenge validation. This module
      provides a simple way to generate the required certificates."
seealso:
  - name: Automatic Certificate Management Environment (ACME)
    description: The specification of the ACME protocol (RFC 8555).
    link: https://tools.ietf.org/html/rfc8555
  - name: ACME TLS ALPN Challenge Extension
    description: The specification of the C(tls-alpn-01) challenge (RFC 8737).
    link: https://www.rfc-editor.org/rfc/rfc8737.html
requirements:
   - "cryptography >= 1.3"
options:
  challenge:
    description:
      - "The challenge type."
    type: str
    required: yes
    choices:
    - tls-alpn-01
  challenge_data:
    description:
      - "The C(challenge_data) entry provided by M(acme_certificate) for the challenge."
    type: dict
    required: yes
  private_key_src:
    description:
      - "Path to a file containing the private key file to use for this challenge
         certificate."
      - "Mutually exclusive with C(private_key_content)."
    type: path
  private_key_content:
    description:
      - "Content of the private key to use for this challenge certificate."
      - "Mutually exclusive with C(private_key_src)."
    type: str
s"
- name: Create challenges for a given CRT for sample.com
  acme_certificate:
    account_key_src: /etc/pki/cert/private/account.key
    challenge: tls-alpn-01
    csr: /etc/pki/cert/csr/sample.com.csr
    dest: /etc/httpd/ssl/sample.com.crt
  register: sample_com_challenge

- name: Create certificates for challenges
  acme_challenge_cert_helper:
    challenge: tls-alpn-01
    challenge_data: "{{ item.value['tls-alpn-01'] }}"
    private_key_src: /etc/pki/cert/key/sample.com.key
  loop: "{{ sample_com_challenge.challenge_data | dictsort }}"
  register: sample_com_challenge_certs

- name: Install challenge certificates
  # We need to set up HTTPS such that for the domain,
  # regular_certificate is delivered for regular connections,
  # except if ALPN selects the "acme-tls/1"; then, the
  # challenge_certificate must be delivered.
  # This can for example be achieved with very new versions
  # of NGINX; search for ssl_preread and
  # ssl_preread_alpn_protocols for information on how to
  # route by ALPN protocol.
  ...:
    domain: "{{ item.domain }}"
    challenge_certificate: "{{ item.challenge_certificate }}"
    regular_certificate: "{{ item.regular_certificate }}"
    private_key: /etc/pki/cert/key/sample.com.key
  loop: "{{ sample_com_challenge_certs.results }}"

- name: Create certificate for a given CSR for sample.com
  acme_certificate:
    account_key_src: /etc/pki/cert/private/account.key
    challenge: tls-alpn-01
    csr: /etc/pki/cert/csr/sample.com.csr
    dest: /etc/httpd/ssl/sample.com.crt
    data: "{{ sample_com_challenge }}"
s�
domain:
  description:
    - "The domain the challenge is for. The certificate should be provided if
       this is specified in the request's the C(Host) header."
  returned: always
  type: str
identifier_type:
  description:
    - "The identifier type for the actual resource identifier. Will be C(dns)
       or C(ip)."
  returned: always
  type: str
  version_added: "2.8"
identifier:
  description:
    - "The identifier for the actual resource. Will be a domain name if the
       type is C(dns), or an IP address if the type is C(ip)."
  returned: always
  type: str
  version_added: "2.8"
challenge_certificate:
  description:
    - "The challenge certificate in PEM format."
  returned: always
  type: str
regular_certificate:
  description:
    - "A self-signed certificate for the challenge domain."
    - "If no existing certificate exists, can be used to set-up
       https in the first place if that is needed for providing
       the challenge."
  returned: always
  type: str
(tModuleFailExceptiont	read_file(t
AnsibleModuletmissing_required_lib(tto_bytestto_textN(tLooseVersions1.3icC`s;t|�dkr!td��ntdt|�g�|S(Ni�s4Cannot handle octet strings with more than 128 bytesi(tlenRtbytes(toctet_string((sZ/usr/lib/python2.7/site-packages/ansible/modules/crypto/acme/acme_challenge_cert_helper.pytencode_octet_string�scC`s9t|�dkr!td��ndtt|��|S(Ni�s4Cannot handle octet strings with more than 128 bytess(RRtchr(R((sZ/usr/lib/python2.7/site-packages/ansible/modules/crypto/acme/acme_challenge_cert_helper.pyR�scC`s:tdtdtdddtddg�dtdd	dt�d
tdd�dtddd
t��dd
dgfdd
dgf�}ts�|jdtd�dt�nyg|jd}|jd}|jjd�}|dkr�t
|jd
�}nt|�}y(tj
jjj|dddt�}Wn(tk
r[}tdj|���nXt|d�}t|jdd|d��jdd�\}}tjjg�}	}
tjj�}tjj�tjdd�}|dkrtjj|�}
n?|dkr-tjjtj|��}
ntdj|���tjj �j!|	�j"|
�j#|j#��j$tjj%��j&|�j'|�j(tjj)|
g�d t*�j+|tj
jj,j-�t�}|dkr�t.j/|d!�}tjj �j!|	�j"|
�j#|j#��j$tjj%��j&|�j'|�j(tjj)|
g�d t*�j(tjj0tjj1d"�t2|��d t�j+|tj
jj,j-�t�}n|j3d#td$|d%|d&|d'|j4tj
jjj5j6�d(|j4tj
jjj5j6��Wn tk
r5}|j7|�nXdS()Nt
argument_spect	challengettypetstrtrequiredtchoicesstls-alpn-01tchallenge_datatdicttprivate_key_srctpathtprivate_key_contenttno_logtrequired_one_oftmutually_exclusivetmsgscryptography >= 1.3t	exceptiontpasswordtbackends$Error while loading private key: {0}tresourcetresource_originalsdns:t:itdaysi
tdnstips!Unsupported identifier type "{0}"tcriticaltresource_values1.3.6.1.5.5.7.1.31tchangedtdomaintidentifier_typet
identifiertchallenge_certificatetregular_certificate(8R
RtTruetHAS_CRYPTOGRAPHYt	fail_jsonRtCRYPTOGRAPHY_IMP_ERRtparamstgettNoneR	Rtcryptographythazmatt
primitivest
serializationtload_pem_private_keyt_cryptography_backendt	ExceptionRtformatR
tsplittx509tNametdatetimetutcnowt	timedeltatDNSNamet	IPAddresst	ipaddresst
ip_addresstCertificateBuildertsubject_nametissuer_namet
public_keyt
serial_numbertrandom_serial_numbertnot_valid_beforetnot_valid_aftert
add_extensiontSubjectAlternativeNametFalsetsignthashestSHA256tbase64t	b64decodetUnrecognizedExtensiontObjectIdentifierRt	exit_jsontpublic_bytestEncodingtPEMtdo_fail(tmoduleRRRtprivate_keyteR/R0R1tsubjecttissuerRSRTtsanR3tvalueR2((sZ/usr/lib/python2.7/site-packages/ansible/modules/crypto/acme/acme_challenge_cert_helper.pytmain�s�

(2														#t__main__(4t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.acmeRR	tansible.module_utils.basicR
Rtansible.module_utils._textRR
R[RFtsyst	tracebackR:R7R;tcryptography.hazmat.backendst,cryptography.hazmat.primitives.serializationt-cryptography.hazmat.primitives.asymmetric.rsat,cryptography.hazmat.primitives.asymmetric.ect1cryptography.hazmat.primitives.asymmetric.paddingt%cryptography.hazmat.primitives.hashest/cryptography.hazmat.primitives.asymmetric.utilstcryptography.x509tcryptography.x509.oidRKtdistutils.versionRt__version__R5R<tbackendstdefault_backendR@tImportErrortdummyt
format_excRWtversion_infoRRkt__name__(((sZ/usr/lib/python2.7/site-packages/ansible/modules/crypto/acme/acme_challenge_cert_helper.pyt<module>sN


/*$
		o

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]