Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/crypto/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlZddl
mZdd
lmZdefd��YZdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: openssl_dhparam
version_added: "2.5"
short_description: Generate OpenSSL Diffie-Hellman Parameters
description:
    - This module allows one to (re)generate OpenSSL DH-params.
    - This module uses file common arguments to specify generated file permissions.
    - "Please note that the module regenerates existing DH params if they don't
      match the module's options. If you are concerned that this could overwrite
      your existing DH params, consider using the I(backup) option."
requirements:
    - OpenSSL
author:
- Thom Wiggers (@thomwiggers)
options:
    state:
        description:
            - Whether the parameters should exist or not,
              taking action if the state is different from what is stated.
        type: str
        default: present
        choices: [ absent, present ]
    size:
        description:
            - Size (in bits) of the generated DH-params.
        type: int
        default: 4096
    force:
        description:
            - Should the parameters be regenerated even it it already exists.
        type: bool
        default: no
    path:
        description:
            - Name of the file in which the generated parameters will be saved.
        type: path
        required: true
    backup:
        description:
            - Create a backup file including a timestamp so you can get the original
              DH params back if you overwrote them with new ones by accident.
        type: bool
        default: no
        version_added: "2.8"
extends_documentation_fragment:
- files
seealso:
- module: openssl_certificate
- module: openssl_csr
- module: openssl_pkcs12
- module: openssl_privatekey
- module: openssl_publickey
s�
- name: Generate Diffie-Hellman parameters with the default size (4096 bits)
  openssl_dhparam:
    path: /etc/ssl/dhparams.pem

- name: Generate DH Parameters with a different size (2048 bits)
  openssl_dhparam:
    path: /etc/ssl/dhparams.pem
    size: 2048

- name: Force regenerate an DH parameters if they already exist
  openssl_dhparam:
    path: /etc/ssl/dhparams.pem
    force: yes
s�
size:
    description: Size (in bits) of the Diffie-Hellman parameters.
    returned: changed or success
    type: int
    sample: 4096
filename:
    description: Path to the generated Diffie-Hellman parameters.
    returned: changed or success
    type: str
    sample: /etc/ssl/dhparams.pem
backup_file:
    description: Name of backup file created.
    returned: changed and if I(backup) is C(yes)
    type: str
    sample: /path/to/dhparams.pem.2019-03-09@11:22~
N(t
AnsibleModule(t	to_nativetDHParameterErrorcB`seZRS((t__name__t
__module__(((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyR
ostDHParametercB`sGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cC`s{|jd|_|jd|_|jd|_|jd|_t|_|jdt�|_	|jd|_
d|_dS(Ntstatetpathtsizetforcetopenssltbackup(
tparamsRRRRtFalsetchangedtget_bin_pathtTruetopenssl_binRtNonetbackup_file(tselftmodule((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyt__init__us	c
C`sJt}|js|j|�r%tj�\}}tj|�|j|�|jdd|t	|j
�g}|j|dt�\}}}|dkr�tt
|���n|jr�|j|j�|_ny|j||j�Wn6tk
r}	|jdd|jt	|	�f�nXt}n|j|�s=t}n||_dS(sGenerate a keypair.tdhparams-outtcheck_rcitmsgsFailed to write to file %s: %sN(RRt_check_params_validttempfiletmkstemptostclosetadd_cleanup_fileRtstrRtrun_commandR
R	Rtbackup_localRRtatomic_movet	Exceptiont	fail_jsonRt_check_fs_attributesR(
RRRtfdttmpsrctcommandtrctdummyterrte((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pytgenerate�s&

!	'		cC`sn|jr!|j|j�|_nytj|j�t|_Wn)tk
ri}|j	dt
|��nXdS(NR!(RR*RRR%tremoveRRtOSErrorR-R	(RRtexc((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyR7�s	
cC`s)|jr
tS|j|�o(|j|�S(s,Ensure the resource is in its desired state.(RRR"R.(RR((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pytcheck�s	c	C`s�|jddddd|jg}|j|dt�\}}}t|�}|dkr[tStjd|�}|swtSt|jd	��}d
|ks�d
t|�kr�tS||j	kS(s,Check if the params are in the correct stateRs-checks-texts-noouts-inR isParameters:\s+\((\d+) bit\).*itWARNING(
RRR)RR	tretsearchtinttgroupR(	RRR1R2toutR4tresulttmatchtbits((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyR"�s!cC`s)|j|j�}|j|t�}|S(s8Checks (and changes if not in check mode!) fs attributes(tload_file_common_argumentsRtset_fs_attributes_if_differentR(RRt	file_argst
attrs_changed((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyR.�scC`sAi|jd6|jd6|jd6}|jr=|j|d<n|S(s'Serialize the object into a dictionary.RtfilenameRR(RRRR(RRA((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pytdump�s


	(	RRRR6R7R:R"R.RI(((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyR
ss							cC`s:tdtdtdddddddg�d	tdd
dd�dtdd
dt�dtdddt�dtdd
dt��dtdt�}tjj|jd�p�d}tjj|�s�|j	d|dd|�nt
|�}|jdkr�|jrB|j
�}|jdp+|j|�|d<|j|�ny|j|�Wqtk
r~}|j	dt|��qXn�|jr�|j
�}tjj|jd�|d<|j|�ntjj|jd�ry|j|�Wqtk
r}|j	dt|��qXn|j
�}|j|�dS(s
Main functiont
argument_specRttypeR(tdefaulttpresenttchoicestabsentRR>iRtboolRtrequiredRtsupports_check_modetadd_file_common_argst.tnameR!s@The directory '%s' does not exist or the file is not a directoryRN(RtdictRRR%RtdirnameRtisdirR-R
Rt
check_modeRIR:t	exit_jsonR6R
R	texistsR7R,(Rtbase_dirRRAR9((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pytmain�sF!			!	t__main__(t
__future__RRRRKt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR%R<R#tansible.module_utils.basicRtansible.module_utils._textR	R,R
tobjectR
R]R(((sJ/usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyt<module>s"


7f	5

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