Debian Codegraph @

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

raw
1 # Copyright (c) 2016 Michael Gruener <[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 # Basic documentation fragment without account data
13 BASIC = r"""
14 notes:
15 - Although the defaults are chosen so that the module can be used with the L(Let's Encrypt,https://letsencrypt.org/) CA,
16 the module can in principle be used with any CA providing an ACME endpoint.
17 - So far, the ACME modules have only been tested by the developers against Let's Encrypt (staging and production),
18 ZeroSSL (production), and L(Pebble testing server,https://github.com/letsencrypt/Pebble).
19 We have got community feedback that they also work with Sectigo ACME Service for InCommon and with HARICA.
20 If you experience problems with another ACME server, please
21 L(create an issue, https://github.com/ansible-collections/community.crypto/issues/new/choose)
22 to help us supporting it. Feedback that an ACME server not mentioned does work is also appreciated.
23 requirements:
24 - either C(openssl)
25 - or L(cryptography,https://cryptography.io/) >= 3.3
26 options:
27 acme_version:
28 description:
29 - The ACME version of the endpoint.
30 - Must be V(2) for standardized ACME v2 endpoints.
31 - The value V(1) is no longer supported since community.crypto 3.0.0.
32 type: int
33 default: 2
34 choices:
35 - 2
36 acme_directory:
37 description:
38 - The ACME directory to use. This is the entry point URL to access the ACME CA server API.
39 - For safety reasons the default is set to the Let's Encrypt staging server (for the ACME v1 protocol). This will create
40 technically correct, but untrusted certificates.
41 - "For Let's Encrypt, all staging endpoints can be found here: U(https://letsencrypt.org/docs/staging-environment/)."
42 - For B(Let's Encrypt), the production directory URL for ACME v2 is U(https://acme-v02.api.letsencrypt.org/directory).
43 - For B(ZeroSSL), the production directory URL for ACME v2 is U(https://acme.zerossl.com/v2/DV90).
44 - For B(Sectigo), the production directory URL for ACME v2 is U(https://acme-qa.secure.trust-provider.com/v2/DV).
45 - For B(HARICA), the production directory URL for ACME v2 is U(https://acme.harica.gr/XXX/directory) with XXX being specific to your account.
46 - The notes for this module contain a list of ACME services this module has been tested against.
47 required: true
48 type: str
49 validate_certs:
50 description:
51 - Whether calls to the ACME directory will validate TLS certificates.
52 - B(Warning:) Should B(only ever) be set to V(false) for testing purposes, for example when testing against a local
53 Pebble server.
54 type: bool
55 default: true
56 select_crypto_backend:
57 description:
58 - Determines which crypto backend to use.
59 - The default choice is V(auto), which tries to use C(cryptography) if available, and falls back to C(openssl).
60 - If set to V(openssl), will try to use the C(openssl) binary.
61 - If set to V(cryptography), will try to use the L(cryptography,https://cryptography.io/) library.
62 type: str
63 default: auto
64 choices: [auto, cryptography, openssl]
65 request_timeout:
66 description:
67 - The time Ansible should wait for a response from the ACME API.
68 - This timeout is applied to all HTTP(S) requests (HEAD, GET, POST).
69 type: int
70 default: 10
71 version_added: 2.3.0
72 """
73
74 # Account data documentation fragment
75 ACCOUNT = r"""
76 notes:
77 - If a new enough version of the C(cryptography) library is available (see Requirements for details), it will be used instead
78 of the C(openssl) binary. This can be explicitly disabled or enabled with the O(select_crypto_backend) option. Note that
79 using the C(openssl) binary will be slower and less secure, as private key contents always have to be stored on disk (see
80 O(account_key_content)).
81 options:
82 account_key_src:
83 description:
84 - Path to a file containing the ACME account RSA or Elliptic Curve key.
85 - "For Elliptic Curve keys only the following curves are supported: V(secp256r1), V(secp384r1), and V(secp521r1)."
86 - 'Private keys can be created with the M(community.crypto.openssl_privatekey) or M(community.crypto.openssl_privatekey_pipe)
87 modules. If the requisite (cryptography) is not available, keys can also be created directly with the C(openssl) command
88 line tool: RSA keys can be created with C(openssl genrsa ...). Elliptic curve keys can be created with C(openssl ecparam
89 -genkey ...). Any other tool creating private keys in PEM format can be used as well.'
90 - Mutually exclusive with O(account_key_content).
91 - Required if O(account_key_content) is not used.
92 type: path
93 aliases:
94 - account_key
95 account_key_content:
96 description:
97 - Content of the ACME account RSA or Elliptic Curve key.
98 - "For Elliptic Curve keys only the following curves are supported: V(secp256r1), V(secp384r1), and V(secp521r1)."
99 - Mutually exclusive with O(account_key_src).
100 - Required if O(account_key_src) is not used.
101 - B(Warning:) the content will be written into a temporary file, which will be deleted by Ansible when the module completes.
102 Since this is an important private key — it can be used to change the account key, or to revoke your certificates
103 without knowing their private keys —, this might not be acceptable.
104 - In case C(cryptography) is used, the content is not written into a temporary file. It can still happen that it is
105 written to disk by Ansible in the process of moving the module with its argument to the node where it is executed.
106 type: str
107 account_key_passphrase:
108 description:
109 - Passphrase to use to decode the account key.
110 - B(Note:) this is not supported by the C(openssl) backend, only by the C(cryptography) backend.
111 type: str
112 version_added: 1.6.0
113 account_uri:
114 description:
115 - If specified, assumes that the account URI is as given. If the account key does not match this account, or an account
116 with this URI does not exist, the module fails.
117 type: str
118 """
119
120 # No account data documentation fragment
121 NO_ACCOUNT = r"""
122 notes:
123 - "If a new enough version of the C(cryptography) library
124 is available (see Requirements for details), it will be used
125 instead of the C(openssl) binary. This can be explicitly disabled
126 or enabled with the O(select_crypto_backend) option. Note that using
127 the C(openssl) binary will be slower."
128 options: {}
129 """
130
131 CERTIFICATE = r"""
132 options:
133 csr:
134 description:
135 - File containing the CSR for the new certificate.
136 - Can be created with M(community.crypto.openssl_csr).
137 - The CSR may contain multiple Subject Alternate Names, but each one will lead to an individual challenge that must
138 be fulfilled for the CSR to be signed.
139 - 'B(Note): the private key used to create the CSR B(must not) be the account key. This is a bad idea from a security
140 point of view, and the CA should not accept the CSR. The ACME server should return an error in this case.'
141 - Precisely one of O(csr) or O(csr_content) must be specified.
142 type: path
143 csr_content:
144 description:
145 - Content of the CSR for the new certificate.
146 - Can be created with M(community.crypto.openssl_csr_pipe).
147 - The CSR may contain multiple Subject Alternate Names, but each one will lead to an individual challenge that must
148 be fulfilled for the CSR to be signed.
149 - 'B(Note): the private key used to create the CSR B(must not) be the account key. This is a bad idea from a security
150 point of view, and the CA should not accept the CSR. The ACME server should return an error in this case.'
151 - Precisely one of O(csr) or O(csr_content) must be specified.
152 type: str
153 """