�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l Z d d l Z d d l
m Z d d
l m Z d e f d � � YZ d e f d � � YZ d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust 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_nativet DHParameterErrorc B` s e Z RS( ( t __name__t
__module__( ( ( sJ /usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyR
o s t DHParameterc B` sG e Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z RS( c C` s{ | j d | _ | j d | _ | j d | _ | j d | _ t | _ | j d t � | _ | j d | _
d | _ d S( Nt statet patht sizet forcet opensslt backup(
t paramsR R R R t Falset changedt get_bin_patht Truet openssl_binR t Nonet backup_file( t selft module( ( sJ /usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyt __init__u s c
C` sJ t } | j s | j | � r%t j � \ } } t j | � | j | � | j d d | t | j
� g } | j | d t �\ } } } | d k r� t t
| � � � n | j r� | j | j � | _ n y | j | | j � Wn6 t k
r} | j d d | j t | � f � n Xt } n | j | � s=t } n | | _ d S( s Generate a keypair.t dhparams -outt check_rci t msgs Failed to write to file %s: %sN( R R t _check_params_validt tempfilet mkstempt ost closet add_cleanup_fileR t strR t run_commandR
R R t backup_localR R t atomic_movet Exceptiont fail_jsonR t _check_fs_attributesR (
R R R t fdt tmpsrct commandt rct dummyt errt e( ( sJ /usr/lib/python2.7/site-packages/ansible/modules/crypto/openssl_dhparam.pyt generate� s&