Debian Codegraph @

ansible_collections/community/crypto/plugins/doc_fragments/_module_privatekey.py

raw
1 # Copyright (c) 2016, Yanis Guenane <[email protected]>
2 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 # Note that this doc fragment is **PRIVATE** to the collection. It can have breaking changes at any time.
6 # Do not use this from other collections or standalone plugins/modules!
7
8 from __future__ import annotations
9
10
11 class ModuleDocFragment:
12 # Standard files documentation fragment
13 DOCUMENTATION = r"""
14 description:
15 - One can generate L(RSA,https://en.wikipedia.org/wiki/RSA_%28cryptosystem%29), L(DSA,https://en.wikipedia.org/wiki/Digital_Signature_Algorithm),
16 L(ECC,https://en.wikipedia.org/wiki/Elliptic-curve_cryptography) or L(EdDSA,https://en.wikipedia.org/wiki/EdDSA) private
17 keys.
18 - Keys are generated in PEM format.
19 attributes:
20 diff_mode:
21 support: full
22 idempotent:
23 support: partial
24 details:
25 - The option O(regenerate=always) generally disables idempotency.
26 requirements:
27 - cryptography >= 3.3
28 options:
29 size:
30 description:
31 - Size (in bits) of the TLS/SSL key to generate.
32 type: int
33 default: 4096
34 type:
35 description:
36 - The algorithm used to generate the TLS/SSL private key.
37 type: str
38 default: RSA
39 choices: [DSA, ECC, Ed25519, Ed448, RSA, X25519, X448]
40 curve:
41 description:
42 - Note that not all curves are supported by all versions of C(cryptography).
43 - For maximal interoperability, V(secp384r1) or V(secp256r1) should be used.
44 - We use the curve names as defined in the L(IANA registry for TLS,https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8).
45 - Please note that all curves except V(secp224r1), V(secp256k1), V(secp256r1), V(secp384r1), and V(secp521r1) are discouraged
46 for new private keys.
47 type: str
48 choices:
49 - secp224r1
50 - secp256k1
51 - secp256r1
52 - secp384r1
53 - secp521r1
54 - secp192r1
55 - brainpoolP256r1
56 - brainpoolP384r1
57 - brainpoolP512r1
58 - sect163k1
59 - sect163r2
60 - sect233k1
61 - sect233r1
62 - sect283k1
63 - sect283r1
64 - sect409k1
65 - sect409r1
66 - sect571k1
67 - sect571r1
68 passphrase:
69 description:
70 - The passphrase for the private key.
71 type: str
72 cipher:
73 description:
74 - The cipher to encrypt the private key. This is only used when O(passphrase) is provided.
75 - Must be V(auto).
76 type: str
77 default: auto
78 select_crypto_backend:
79 description:
80 - Determines which crypto backend to use.
81 - The default choice is V(auto), which tries to use C(cryptography) if available.
82 - If set to V(cryptography), will try to use the L(cryptography,https://cryptography.io/) library.
83 - Note that with community.crypto 3.0.0, all values behave the same.
84 This option will be deprecated in a later version.
85 We recommend to not set it explicitly.
86 type: str
87 default: auto
88 choices: [auto, cryptography]
89 format:
90 description:
91 - Determines which format the private key is written in. By default, PKCS1 (traditional OpenSSL format) is used for
92 all keys which support it. Please note that not every key can be exported in any format.
93 - The value V(auto) selects a format based on the key format. The value V(auto_ignore) does the same, but for existing
94 private key files, it will not force a regenerate when its format is not the automatically selected one for generation.
95 - Note that if the format for an existing private key mismatches, the key is B(regenerated) by default. To change this
96 behavior, use the O(format_mismatch) option.
97 type: str
98 default: auto_ignore
99 choices: [pkcs1, pkcs8, raw, auto, auto_ignore]
100 format_mismatch:
101 description:
102 - Determines behavior of the module if the format of a private key does not match the expected format, but all other
103 parameters are as expected.
104 - If set to V(regenerate) (default), generates a new private key.
105 - If set to V(convert), the key will be converted to the new format instead.
106 type: str
107 default: regenerate
108 choices: [regenerate, convert]
109 regenerate:
110 description:
111 - Allows to configure in which situations the module is allowed to regenerate private keys. The module will always generate
112 a new key if the destination file does not exist.
113 - By default, the key will be regenerated when it does not match the module's options, except when the key cannot be
114 read or the passphrase does not match. Please note that this B(changed) for Ansible 2.10. For Ansible 2.9, the behavior
115 was as if V(full_idempotence) is specified.
116 - If set to V(never), the module will fail if the key cannot be read or the passphrase is not matching, and will never
117 regenerate an existing key.
118 - If set to V(fail), the module will fail if the key does not correspond to the module's options.
119 - If set to V(partial_idempotence), the key will be regenerated if it does not conform to the module's options. The
120 key is B(not) regenerated if it cannot be read (broken file), the key is protected by an unknown passphrase, or when
121 they key is not protected by a passphrase, but a passphrase is specified.
122 - If set to V(full_idempotence), the key will be regenerated if it does not conform to the module's options. This is
123 also the case if the key cannot be read (broken file), the key is protected by an unknown passphrase, or when they
124 key is not protected by a passphrase, but a passphrase is specified. Make sure you have a B(backup) when using this
125 option!
126 - If set to V(always), the module will always regenerate the key. This is equivalent to setting O(force) to V(true).
127 - Note that if O(format_mismatch) is set to V(convert) and everything matches except the format, the key will always
128 be converted, except if O(regenerate) is set to V(always).
129 type: str
130 choices:
131 - never
132 - fail
133 - partial_idempotence
134 - full_idempotence
135 - always
136 default: full_idempotence
137 seealso:
138 - module: community.crypto.x509_certificate
139 - module: community.crypto.x509_certificate_pipe
140 - module: community.crypto.openssl_csr
141 - module: community.crypto.openssl_csr_pipe
142 - module: community.crypto.openssl_dhparam
143 - module: community.crypto.openssl_pkcs12
144 - module: community.crypto.openssl_publickey
145 """