mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-07 13:53:06 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ca4ecb54b | ||
|
|
ea970a044f | ||
|
|
3e3318f059 | ||
|
|
ae6fb88896 | ||
|
|
66d7989222 | ||
|
|
99d6a17653 | ||
|
|
edeed24e8f | ||
|
|
2f3809c84b | ||
|
|
4f92a02bc4 | ||
|
|
f7b01bae60 | ||
|
|
43d7868646 | ||
|
|
3fbf173674 | ||
|
|
d350b94ae6 | ||
|
|
a75cc7345a | ||
|
|
f7795f65b0 | ||
|
|
b5d3277798 | ||
|
|
f1a170d427 |
@@ -212,6 +212,8 @@ stages:
|
|||||||
targets:
|
targets:
|
||||||
- name: macOS 15.3
|
- name: macOS 15.3
|
||||||
test: macos/15.3
|
test: macos/15.3
|
||||||
|
- name: RHEL 10.0
|
||||||
|
test: rhel/10.0
|
||||||
- name: RHEL 9.5
|
- name: RHEL 9.5
|
||||||
test: rhel/9.5
|
test: rhel/9.5
|
||||||
- name: FreeBSD 14.2
|
- name: FreeBSD 14.2
|
||||||
|
|||||||
2
.github/workflows/ansible-test.yml
vendored
2
.github/workflows/ansible-test.yml
vendored
@@ -284,7 +284,7 @@ jobs:
|
|||||||
pre-test-cmd: >-
|
pre-test-cmd: >-
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools
|
||||||
;
|
;
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/community.general.git ../../community/general
|
git clone --depth=1 --single-branch --branch stable-10 https://github.com/ansible-collections/community.general.git ../../community/general
|
||||||
pull-request-change-detection: 'true'
|
pull-request-change-detection: 'true'
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
target-python-version: ${{ matrix.python }}
|
target-python-version: ${{ matrix.python }}
|
||||||
|
|||||||
618
CHANGELOG.md
618
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,36 @@ Community Crypto Release Notes
|
|||||||
|
|
||||||
.. contents:: Topics
|
.. contents:: Topics
|
||||||
|
|
||||||
|
v2.26.3
|
||||||
|
=======
|
||||||
|
|
||||||
|
Release Summary
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Bugfix release.
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- acme_account - make work with CAs that do not accept any account request without External Account Binding data (https://github.com/ansible-collections/community.crypto/issues/918, https://github.com/ansible-collections/community.crypto/pull/919).
|
||||||
|
|
||||||
|
v2.26.2
|
||||||
|
=======
|
||||||
|
|
||||||
|
Release Summary
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Maintenance release announcing removal of the Entrust content from community.crypto 3.0.0.
|
||||||
|
|
||||||
|
Deprecated Features
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- The Entrust service in currently being sunsetted after the sale of Entrust's Public Certificates Business to Sectigo; see `the announcement with key dates <https://www.entrust.com/tls-certificate-information-center>`__ and `the migration brief for customers <https://www.sectigo.com/uploads/resources/EOL_Migration-Brief-End-Customer.pdf>`__ for details (https://github.com/ansible-collections/community.crypto/issues/895, https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
- ecs_certificate - the module will be removed from community.crypto 3.0.0 (https://github.com/ansible-collections/community.crypto/issues/895, https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
- ecs_domain - the module will be removed from community.crypto 3.0.0 (https://github.com/ansible-collections/community.crypto/issues/895, https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
- x509_certificate - the ``entrust`` provider will be removed from community.crypto 3.0.0 (https://github.com/ansible-collections/community.crypto/issues/895, https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
- x509_certificate_pipe - the ``entrust`` provider will be removed from community.crypto 3.0.0 (https://github.com/ansible-collections/community.crypto/issues/895, https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
|
||||||
v2.26.1
|
v2.26.1
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -7,9 +7,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
# Ansible Community Crypto Collection
|
# Ansible Community Crypto Collection
|
||||||
|
|
||||||
[](https://docs.ansible.com/ansible/devel/collections/community/crypto/)
|
[](https://docs.ansible.com/ansible/devel/collections/community/crypto/)
|
||||||
[](https://dev.azure.com/ansible/community.crypto/_build?definitionId=21)
|
[](https://dev.azure.com/ansible/community.crypto/_build?definitionId=21)
|
||||||
[](https://github.com/ansible-collections/community.crypto/actions)
|
[](https://github.com/ansible-collections/community.crypto/actions)
|
||||||
[](https://github.com/ansible-collections/community.crypto/actions)
|
[](https://github.com/ansible-collections/community.crypto/actions)
|
||||||
[](https://codecov.io/gh/ansible-collections/community.crypto)
|
[](https://codecov.io/gh/ansible-collections/community.crypto)
|
||||||
[](https://api.reuse.software/info/github.com/ansible-collections/community.crypto)
|
[](https://api.reuse.software/info/github.com/ansible-collections/community.crypto)
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ Browsing the [**latest** collection documentation](https://docs.ansible.com/ansi
|
|||||||
|
|
||||||
Browsing the [**devel** collection documentation](https://docs.ansible.com/ansible/devel/collections/community/crypto) shows docs for the _latest version released on Galaxy_.
|
Browsing the [**devel** collection documentation](https://docs.ansible.com/ansible/devel/collections/community/crypto) shows docs for the _latest version released on Galaxy_.
|
||||||
|
|
||||||
We also separately publish [**latest commit** collection documentation](https://ansible-collections.github.io/community.crypto/branch/main/) which shows docs for the _latest commit in the `main` branch_.
|
We also separately publish [**latest commit** collection documentation](https://ansible-collections.github.io/community.crypto/branch/stable-2/) which shows docs for the _latest commit in the `stable-2` branch_.
|
||||||
|
|
||||||
If you use the Ansible package and do not update collections independently, use **latest**. If you install or update this collection directly from Galaxy, use **devel**. If you are looking to contribute, use **latest commit**.
|
If you use the Ansible package and do not update collections independently, use **latest**. If you install or update this collection directly from Galaxy, use **devel**. If you are looking to contribute, use **latest commit**.
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ If you use the Ansible package and do not update collections independently, use
|
|||||||
- luks_device module
|
- luks_device module
|
||||||
- parse_serial and to_serial filters
|
- parse_serial and to_serial filters
|
||||||
|
|
||||||
You can also find a list of all modules and plugins with documentation on the [Ansible docs site](https://docs.ansible.com/ansible/latest/collections/community/crypto/), or the [latest commit collection documentation](https://ansible-collections.github.io/community.crypto/branch/main/).
|
You can also find a list of all modules and plugins with documentation on the [Ansible docs site](https://docs.ansible.com/ansible/latest/collections/community/crypto/), or the [latest commit collection documentation](https://ansible-collections.github.io/community.crypto/branch/stable-2/).
|
||||||
|
|
||||||
## Using this collection
|
## Using this collection
|
||||||
|
|
||||||
@@ -141,19 +141,15 @@ See [Ansible's dev guide](https://docs.ansible.com/ansible/devel/dev_guide/devel
|
|||||||
|
|
||||||
## Release notes
|
## Release notes
|
||||||
|
|
||||||
See the [changelog](https://github.com/ansible-collections/community.crypto/blob/main/CHANGELOG.md).
|
See the [changelog](https://github.com/ansible-collections/community.crypto/blob/stable-2/CHANGELOG.md).
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
We plan to regularly release minor and patch versions, whenever new features are added or bugs fixed. Our collection follows [semantic versioning](https://semver.org/), so breaking changes will only happen in major releases.
|
We plan to regularly release minor and patch versions, whenever new features are added or bugs fixed. Our collection follows [semantic versioning](https://semver.org/), so breaking changes will only happen in major releases.
|
||||||
|
|
||||||
Most modules will drop PyOpenSSL support in version 2.0.0 of the collection, i.e. in the next major version. We currently plan to release 2.0.0 somewhen during 2021. Around then, the supported versions of the most common distributions will contain a new enough version of ``cryptography``.
|
In 2.0.0, the following notable features have been removed:
|
||||||
|
* PyOpenSSL backends of all modules, except ``openssl_pkcs12`` which did now have a ``cryptography`` backend for a long time due to lack of support of PKCS#12 functionality in ``cryptography``. (This changed.)
|
||||||
Once 2.0.0 has been released, bugfixes will still be backported to 1.0.0 for some time, and some features might also be backported. If we do not want to backport something ourselves because we think it is not worth the effort, backport PRs by non-maintainers are usually accepted.
|
* The ``assertonly`` provider of ``x509_certificate`` has been removed.
|
||||||
|
|
||||||
In 2.0.0, the following notable features will be removed:
|
|
||||||
* PyOpenSSL backends of all modules, except ``openssl_pkcs12`` which does not have a ``cryptography`` backend due to lack of support of PKCS#12 functionality in ``cryptography``.
|
|
||||||
* The ``assertonly`` provider of ``x509_certificate`` will be removed.
|
|
||||||
|
|
||||||
## More information
|
## More information
|
||||||
|
|
||||||
@@ -166,8 +162,8 @@ In 2.0.0, the following notable features will be removed:
|
|||||||
|
|
||||||
This collection is primarily licensed and distributed as a whole under the GNU General Public License v3.0 or later.
|
This collection is primarily licensed and distributed as a whole under the GNU General Public License v3.0 or later.
|
||||||
|
|
||||||
See [LICENSES/GPL-3.0-or-later.txt](https://github.com/ansible-collections/community.crypto/blob/main/COPYING) for the full text.
|
See [LICENSES/GPL-3.0-or-later.txt](https://github.com/ansible-collections/community.crypto/blob/stable-2/COPYING) for the full text.
|
||||||
|
|
||||||
Parts of the collection are licensed under the [Apache 2.0 license](https://github.com/ansible-collections/community.crypto/blob/main/LICENSES/Apache-2.0.txt) (`plugins/module_utils/crypto/_obj2txt.py` and `plugins/module_utils/crypto/_objects_data.py`), the [BSD 2-Clause license](https://github.com/ansible-collections/community.crypto/blob/main/LICENSES/BSD-2-Clause.txt) (`plugins/module_utils/ecs/api.py`), the [BSD 3-Clause license](https://github.com/ansible-collections/community.crypto/blob/main/LICENSES/BSD-3-Clause.txt) (`plugins/module_utils/crypto/_obj2txt.py`, `tests/integration/targets/prepare_jinja2_compat/filter_plugins/jinja_compatibility.py`), and the [PSF 2.0 license](https://github.com/ansible-collections/community.crypto/blob/main/LICENSES/PSF-2.0.txt) (`plugins/module_utils/_version.py`). This only applies to vendored files in ``plugins/module_utils/`` and to the ECS module utils.
|
Parts of the collection are licensed under the [Apache 2.0 license](https://github.com/ansible-collections/community.crypto/blob/stable-2/LICENSES/Apache-2.0.txt) (`plugins/module_utils/crypto/_obj2txt.py` and `plugins/module_utils/crypto/_objects_data.py`), the [BSD 2-Clause license](https://github.com/ansible-collections/community.crypto/blob/stable-2/LICENSES/BSD-2-Clause.txt) (`plugins/module_utils/ecs/api.py`), the [BSD 3-Clause license](https://github.com/ansible-collections/community.crypto/blob/stable-2/LICENSES/BSD-3-Clause.txt) (`plugins/module_utils/crypto/_obj2txt.py`, `tests/integration/targets/prepare_jinja2_compat/filter_plugins/jinja_compatibility.py`), and the [PSF 2.0 license](https://github.com/ansible-collections/community.crypto/blob/stable-2/LICENSES/PSF-2.0.txt) (`plugins/module_utils/_version.py`). This only applies to vendored files in ``plugins/module_utils/`` and to the ECS module utils.
|
||||||
|
|
||||||
All files have a machine readable `SDPX-License-Identifier:` comment denoting its respective license(s) or an equivalent entry in an accompanying `.license` file. Only changelog fragments (which will not be part of a release) are covered by a blanket statement in `REUSE.toml`. This conforms to the [REUSE specification](https://reuse.software/spec/).
|
All files have a machine readable `SDPX-License-Identifier:` comment denoting its respective license(s) or an equivalent entry in an accompanying `.license` file. Only changelog fragments (which will not be part of a release) are covered by a blanket statement in `REUSE.toml`. This conforms to the [REUSE specification](https://reuse.software/spec/).
|
||||||
|
|||||||
@@ -1643,3 +1643,39 @@ releases:
|
|||||||
- 867-passphrase-encoding-nolog.yml
|
- 867-passphrase-encoding-nolog.yml
|
||||||
- 868-luks-remove-keyslot.yml
|
- 868-luks-remove-keyslot.yml
|
||||||
release_date: '2025-04-28'
|
release_date: '2025-04-28'
|
||||||
|
2.26.2:
|
||||||
|
changes:
|
||||||
|
deprecated_features:
|
||||||
|
- The Entrust service in currently being sunsetted after the sale of Entrust's
|
||||||
|
Public Certificates Business to Sectigo; see `the announcement with key
|
||||||
|
dates <https://www.entrust.com/tls-certificate-information-center>`__ and
|
||||||
|
`the migration brief for customers <https://www.sectigo.com/uploads/resources/EOL_Migration-Brief-End-Customer.pdf>`__
|
||||||
|
for details (https://github.com/ansible-collections/community.crypto/issues/895,
|
||||||
|
https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
- ecs_certificate - the module will be removed from community.crypto 3.0.0
|
||||||
|
(https://github.com/ansible-collections/community.crypto/issues/895, https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
- ecs_domain - the module will be removed from community.crypto 3.0.0 (https://github.com/ansible-collections/community.crypto/issues/895,
|
||||||
|
https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
- x509_certificate - the ``entrust`` provider will be removed from community.crypto
|
||||||
|
3.0.0 (https://github.com/ansible-collections/community.crypto/issues/895,
|
||||||
|
https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
- x509_certificate_pipe - the ``entrust`` provider will be removed from community.crypto
|
||||||
|
3.0.0 (https://github.com/ansible-collections/community.crypto/issues/895,
|
||||||
|
https://github.com/ansible-collections/community.crypto/pull/901).
|
||||||
|
release_summary: Maintenance release announcing removal of the Entrust content
|
||||||
|
from community.crypto 3.0.0.
|
||||||
|
fragments:
|
||||||
|
- 2.26.2.yml
|
||||||
|
- 901-remove-entrust.yml
|
||||||
|
release_date: '2025-05-22'
|
||||||
|
2.26.3:
|
||||||
|
changes:
|
||||||
|
bugfixes:
|
||||||
|
- acme_account - make work with CAs that do not accept any account request
|
||||||
|
without External Account Binding data (https://github.com/ansible-collections/community.crypto/issues/918,
|
||||||
|
https://github.com/ansible-collections/community.crypto/pull/919).
|
||||||
|
release_summary: Bugfix release.
|
||||||
|
fragments:
|
||||||
|
- 2.26.3.yml
|
||||||
|
- 919-acme_account-ear.yml
|
||||||
|
release_date: '2025-06-14'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace: community
|
namespace: community
|
||||||
name: crypto
|
name: crypto
|
||||||
version: 2.26.1
|
version: 2.26.3
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- Ansible (github.com/ansible)
|
- Ansible (github.com/ansible)
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ notes:
|
|||||||
the module can in principle be used with any CA providing an ACME endpoint, such as L(Buypass Go SSL,https://www.buypass.com/ssl/products/acme).
|
the module can in principle be used with any CA providing an ACME endpoint, such as L(Buypass Go SSL,https://www.buypass.com/ssl/products/acme).
|
||||||
- So far, the ACME modules have only been tested by the developers against Let's Encrypt (staging and production), Buypass
|
- So far, the ACME modules have only been tested by the developers against Let's Encrypt (staging and production), Buypass
|
||||||
(staging and production), ZeroSSL (production), and L(Pebble testing server,https://github.com/letsencrypt/Pebble). We
|
(staging and production), ZeroSSL (production), and L(Pebble testing server,https://github.com/letsencrypt/Pebble). We
|
||||||
have got community feedback that they also work with Sectigo ACME Service for InCommon. If you experience problems with
|
have got community feedback that they also work with Sectigo ACME Service for InCommon and with HARICA. If you experience problems with
|
||||||
another ACME server, please L(create an issue,https://github.com/ansible-collections/community.crypto/issues/new/choose)
|
another ACME server, please L(create an issue,https://github.com/ansible-collections/community.crypto/issues/new/choose)
|
||||||
to help us supporting it. Feedback that an ACME server not mentioned does work is also appreciated.
|
to help us supporting it. Feedback that an ACME server not mentioned does work is also appreciated.
|
||||||
requirements:
|
requirements:
|
||||||
@@ -146,6 +146,7 @@ options:
|
|||||||
- For B(Buypass), the production directory URL for ACME v2 and v1 is U(https://api.buypass.com/acme/directory).
|
- For B(Buypass), the production directory URL for ACME v2 and v1 is U(https://api.buypass.com/acme/directory).
|
||||||
- For B(ZeroSSL), the production directory URL for ACME v2 is U(https://acme.zerossl.com/v2/DV90).
|
- For B(ZeroSSL), the production directory URL for ACME v2 is U(https://acme.zerossl.com/v2/DV90).
|
||||||
- For B(Sectigo), the production directory URL for ACME v2 is U(https://acme-qa.secure.trust-provider.com/v2/DV).
|
- For B(Sectigo), the production directory URL for ACME v2 is U(https://acme-qa.secure.trust-provider.com/v2/DV).
|
||||||
|
- 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.
|
||||||
- The notes for this module contain a list of ACME services this module has been tested against.
|
- The notes for this module contain a list of ACME services this module has been tested against.
|
||||||
required: true
|
required: true
|
||||||
type: str
|
type: str
|
||||||
@@ -185,6 +186,7 @@ options:
|
|||||||
account_key_src:
|
account_key_src:
|
||||||
description:
|
description:
|
||||||
- Path to a file containing the ACME account RSA or Elliptic Curve key.
|
- Path to a file containing the ACME account RSA or Elliptic Curve key.
|
||||||
|
- "For Elliptic Curve keys only the following curves are supported: V(secp256r1), V(secp384r1), and V(secp521r1)."
|
||||||
- 'Private keys can be created with the M(community.crypto.openssl_privatekey) or M(community.crypto.openssl_privatekey_pipe)
|
- 'Private keys can be created with the M(community.crypto.openssl_privatekey) or M(community.crypto.openssl_privatekey_pipe)
|
||||||
modules. If the requisite (cryptography) is not available, keys can also be created directly with the C(openssl) command
|
modules. If the requisite (cryptography) is not available, keys can also be created directly with the C(openssl) command
|
||||||
line tool: RSA keys can be created with C(openssl genrsa ...). Elliptic curve keys can be created with C(openssl ecparam
|
line tool: RSA keys can be created with C(openssl genrsa ...). Elliptic curve keys can be created with C(openssl ecparam
|
||||||
@@ -192,10 +194,12 @@ options:
|
|||||||
- Mutually exclusive with O(account_key_content).
|
- Mutually exclusive with O(account_key_content).
|
||||||
- Required if O(account_key_content) is not used.
|
- Required if O(account_key_content) is not used.
|
||||||
type: path
|
type: path
|
||||||
aliases: [account_key]
|
aliases:
|
||||||
|
- account_key
|
||||||
account_key_content:
|
account_key_content:
|
||||||
description:
|
description:
|
||||||
- Content of the ACME account RSA or Elliptic Curve key.
|
- Content of the ACME account RSA or Elliptic Curve key.
|
||||||
|
- "For Elliptic Curve keys only the following curves are supported: V(secp256r1), V(secp384r1), and V(secp521r1)."
|
||||||
- Mutually exclusive with O(account_key_src).
|
- Mutually exclusive with O(account_key_src).
|
||||||
- Required if O(account_key_src) is not used.
|
- Required if O(account_key_src) is not used.
|
||||||
- B(Warning:) the content will be written into a temporary file, which will be deleted by Ansible when the module completes.
|
- B(Warning:) the content will be written into a temporary file, which will be deleted by Ansible when the module completes.
|
||||||
|
|||||||
@@ -377,7 +377,8 @@ options:
|
|||||||
- This is only used by the V(selfsigned) provider.
|
- This is only used by the V(selfsigned) provider.
|
||||||
type: str
|
type: str
|
||||||
default: +0s
|
default: +0s
|
||||||
aliases: [ selfsigned_notBefore ]
|
aliases:
|
||||||
|
- selfsigned_notBefore
|
||||||
|
|
||||||
selfsigned_not_after:
|
selfsigned_not_after:
|
||||||
description:
|
description:
|
||||||
@@ -395,7 +396,8 @@ options:
|
|||||||
Please see U(https://support.apple.com/en-us/HT210176) for more details.
|
Please see U(https://support.apple.com/en-us/HT210176) for more details.
|
||||||
type: str
|
type: str
|
||||||
default: +3650d
|
default: +3650d
|
||||||
aliases: [ selfsigned_notAfter ]
|
aliases:
|
||||||
|
- selfsigned_notAfter
|
||||||
|
|
||||||
selfsigned_create_subject_key_identifier:
|
selfsigned_create_subject_key_identifier:
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -75,37 +75,51 @@ options:
|
|||||||
description:
|
description:
|
||||||
- The countryName field of the certificate signing request subject.
|
- The countryName field of the certificate signing request subject.
|
||||||
type: str
|
type: str
|
||||||
aliases: [C, countryName]
|
aliases:
|
||||||
|
- C
|
||||||
|
- countryName
|
||||||
state_or_province_name:
|
state_or_province_name:
|
||||||
description:
|
description:
|
||||||
- The stateOrProvinceName field of the certificate signing request subject.
|
- The stateOrProvinceName field of the certificate signing request subject.
|
||||||
type: str
|
type: str
|
||||||
aliases: [ST, stateOrProvinceName]
|
aliases:
|
||||||
|
- ST
|
||||||
|
- stateOrProvinceName
|
||||||
locality_name:
|
locality_name:
|
||||||
description:
|
description:
|
||||||
- The localityName field of the certificate signing request subject.
|
- The localityName field of the certificate signing request subject.
|
||||||
type: str
|
type: str
|
||||||
aliases: [L, localityName]
|
aliases:
|
||||||
|
- L
|
||||||
|
- localityName
|
||||||
organization_name:
|
organization_name:
|
||||||
description:
|
description:
|
||||||
- The organizationName field of the certificate signing request subject.
|
- The organizationName field of the certificate signing request subject.
|
||||||
type: str
|
type: str
|
||||||
aliases: [O, organizationName]
|
aliases:
|
||||||
|
- O
|
||||||
|
- organizationName
|
||||||
organizational_unit_name:
|
organizational_unit_name:
|
||||||
description:
|
description:
|
||||||
- The organizationalUnitName field of the certificate signing request subject.
|
- The organizationalUnitName field of the certificate signing request subject.
|
||||||
type: str
|
type: str
|
||||||
aliases: [OU, organizationalUnitName]
|
aliases:
|
||||||
|
- OU
|
||||||
|
- organizationalUnitName
|
||||||
common_name:
|
common_name:
|
||||||
description:
|
description:
|
||||||
- The commonName field of the certificate signing request subject.
|
- The commonName field of the certificate signing request subject.
|
||||||
type: str
|
type: str
|
||||||
aliases: [CN, commonName]
|
aliases:
|
||||||
|
- CN
|
||||||
|
- commonName
|
||||||
email_address:
|
email_address:
|
||||||
description:
|
description:
|
||||||
- The emailAddress field of the certificate signing request subject.
|
- The emailAddress field of the certificate signing request subject.
|
||||||
type: str
|
type: str
|
||||||
aliases: [E, emailAddress]
|
aliases:
|
||||||
|
- E
|
||||||
|
- emailAddress
|
||||||
subject_alt_name:
|
subject_alt_name:
|
||||||
description:
|
description:
|
||||||
- Subject Alternative Name (SAN) extension to attach to the certificate signing request.
|
- Subject Alternative Name (SAN) extension to attach to the certificate signing request.
|
||||||
@@ -116,63 +130,75 @@ options:
|
|||||||
- More at U(https://tools.ietf.org/html/rfc5280#section-4.2.1.6).
|
- More at U(https://tools.ietf.org/html/rfc5280#section-4.2.1.6).
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
aliases: [subjectAltName]
|
aliases:
|
||||||
|
- subjectAltName
|
||||||
subject_alt_name_critical:
|
subject_alt_name_critical:
|
||||||
description:
|
description:
|
||||||
- Should the subjectAltName extension be considered as critical.
|
- Should the subjectAltName extension be considered as critical.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
aliases: [subjectAltName_critical]
|
aliases:
|
||||||
|
- subjectAltName_critical
|
||||||
use_common_name_for_san:
|
use_common_name_for_san:
|
||||||
description:
|
description:
|
||||||
- If set to V(true), the module will fill the common name in for O(subject_alt_name) with C(DNS:) prefix if no SAN is
|
- If set to V(true), the module will fill the common name in for O(subject_alt_name) with C(DNS:) prefix if no SAN is
|
||||||
specified.
|
specified.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
aliases: [useCommonNameForSAN]
|
aliases:
|
||||||
|
- useCommonNameForSAN
|
||||||
key_usage:
|
key_usage:
|
||||||
description:
|
description:
|
||||||
- This defines the purpose (for example encipherment, signature, certificate signing) of the key contained in the certificate.
|
- This defines the purpose (for example encipherment, signature, certificate signing) of the key contained in the certificate.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
aliases: [keyUsage]
|
aliases:
|
||||||
|
- keyUsage
|
||||||
key_usage_critical:
|
key_usage_critical:
|
||||||
description:
|
description:
|
||||||
- Should the keyUsage extension be considered as critical.
|
- Should the keyUsage extension be considered as critical.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
aliases: [keyUsage_critical]
|
aliases:
|
||||||
|
- keyUsage_critical
|
||||||
extended_key_usage:
|
extended_key_usage:
|
||||||
description:
|
description:
|
||||||
- Additional restrictions (for example client authentication, server authentication) on the allowed purposes for which
|
- Additional restrictions (for example client authentication, server authentication) on the allowed purposes for which
|
||||||
the public key may be used.
|
the public key may be used.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
aliases: [extKeyUsage, extendedKeyUsage]
|
aliases:
|
||||||
|
- extKeyUsage
|
||||||
|
- extendedKeyUsage
|
||||||
extended_key_usage_critical:
|
extended_key_usage_critical:
|
||||||
description:
|
description:
|
||||||
- Should the extkeyUsage extension be considered as critical.
|
- Should the extkeyUsage extension be considered as critical.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
aliases: [extKeyUsage_critical, extendedKeyUsage_critical]
|
aliases:
|
||||||
|
- extKeyUsage_critical
|
||||||
|
- extendedKeyUsage_critical
|
||||||
basic_constraints:
|
basic_constraints:
|
||||||
description:
|
description:
|
||||||
- Indicates basic constraints, such as if the certificate is a CA.
|
- Indicates basic constraints, such as if the certificate is a CA.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
aliases: [basicConstraints]
|
aliases:
|
||||||
|
- basicConstraints
|
||||||
basic_constraints_critical:
|
basic_constraints_critical:
|
||||||
description:
|
description:
|
||||||
- Should the basicConstraints extension be considered as critical.
|
- Should the basicConstraints extension be considered as critical.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
aliases: [basicConstraints_critical]
|
aliases:
|
||||||
|
- basicConstraints_critical
|
||||||
ocsp_must_staple:
|
ocsp_must_staple:
|
||||||
description:
|
description:
|
||||||
- Indicates that the certificate should contain the OCSP Must Staple extension (U(https://tools.ietf.org/html/rfc7633)).
|
- Indicates that the certificate should contain the OCSP Must Staple extension (U(https://tools.ietf.org/html/rfc7633)).
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
aliases: [ocspMustStaple]
|
aliases:
|
||||||
|
- ocspMustStaple
|
||||||
ocsp_must_staple_critical:
|
ocsp_must_staple_critical:
|
||||||
description:
|
description:
|
||||||
- Should the OCSP Must Staple extension be considered as critical.
|
- Should the OCSP Must Staple extension be considered as critical.
|
||||||
@@ -180,7 +206,8 @@ options:
|
|||||||
OCSP Must Staple are required to reject such certificates (see U(https://tools.ietf.org/html/rfc7633#section-4)).
|
OCSP Must Staple are required to reject such certificates (see U(https://tools.ietf.org/html/rfc7633#section-4)).
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
aliases: [ocspMustStaple_critical]
|
aliases:
|
||||||
|
- ocspMustStaple_critical
|
||||||
name_constraints_permitted:
|
name_constraints_permitted:
|
||||||
description:
|
description:
|
||||||
- For CA certificates, this specifies a list of identifiers which describe subtrees of names that this CA is allowed
|
- For CA certificates, this specifies a list of identifiers which describe subtrees of names that this CA is allowed
|
||||||
|
|||||||
@@ -73,13 +73,28 @@ class ACMEAccount(object):
|
|||||||
# and provide external_account_binding credentials. Thus we first send a request with allow_creation=False
|
# and provide external_account_binding credentials. Thus we first send a request with allow_creation=False
|
||||||
# to see whether the account already exists.
|
# to see whether the account already exists.
|
||||||
|
|
||||||
# Note that we pass contact here: ZeroSSL does not accept registration calls without contacts, even
|
# Unfortunately, for other ACME servers it's the other way around: (at least some) HARICA endpoints
|
||||||
# if onlyReturnExisting is set to true.
|
# do not allow *any* access without external account data. That's why we catch errors and check
|
||||||
created, data = self._new_reg(contact=contact, allow_creation=False)
|
# for 'externalAccountRequired'.
|
||||||
if data:
|
try:
|
||||||
# An account already exists! Return data
|
# Note that we pass contact here: ZeroSSL does not accept registration calls without contacts, even
|
||||||
return created, data
|
# if onlyReturnExisting is set to true.
|
||||||
# An account does not yet exist. Try to create one next.
|
created, data = self._new_reg(contact=contact, allow_creation=False)
|
||||||
|
if data:
|
||||||
|
# An account already exists! Return data
|
||||||
|
return created, data
|
||||||
|
# An account does not yet exist. Try to create one next.
|
||||||
|
except ACMEProtocolException as exc:
|
||||||
|
if (
|
||||||
|
exc.error_type
|
||||||
|
!= "urn:ietf:params:acme:error:externalAccountRequired"
|
||||||
|
or external_account_binding is None
|
||||||
|
):
|
||||||
|
# Either another error happened, or we got 'externalAccountRequired' and external account data was not supplied
|
||||||
|
# => re-raise exception!
|
||||||
|
raise
|
||||||
|
# In this case, the server really wants external account data.
|
||||||
|
# The below code tries to create the account with external account data present.
|
||||||
|
|
||||||
new_reg = {"contact": contact}
|
new_reg = {"contact": contact}
|
||||||
if not allow_creation:
|
if not allow_creation:
|
||||||
|
|||||||
@@ -105,8 +105,8 @@ options:
|
|||||||
external_account_binding:
|
external_account_binding:
|
||||||
description:
|
description:
|
||||||
- Allows to provide external account binding data during account creation.
|
- Allows to provide external account binding data during account creation.
|
||||||
- This is used by CAs like Sectigo to bind a new ACME account to an existing CA-specific account, to be able to properly
|
- This is used by CAs like Sectigo, HARICA, or ZeroSSL to bind a new ACME account to an existing CA-specific account,
|
||||||
identify a customer.
|
to be able to properly identify a customer.
|
||||||
- Only used when creating a new account. Can not be specified for ACME v1.
|
- Only used when creating a new account. Can not be specified for ACME v1.
|
||||||
type: dict
|
type: dict
|
||||||
suboptions:
|
suboptions:
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
tasks:
|
tasks:
|
||||||
- name: Show Python info
|
- name: Show Python info
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: ansible_python
|
var: ansible_python
|
||||||
|
|
||||||
- name: Register cryptography version
|
- name: Register cryptography version
|
||||||
command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'"
|
ansible.builtin.command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'"
|
||||||
register: cryptography_version
|
register: cryptography_version
|
||||||
|
|
||||||
- name: Register pyOpenSSL version
|
- name: Register pyOpenSSL version
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
register: pyopenssl_version
|
register: pyopenssl_version
|
||||||
|
|
||||||
- name: Determine output directory
|
- name: Determine output directory
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
output_path: "{{ 'output-%0x' % ((2**32) | random) }}"
|
output_path: "{{ 'output-%0x' % ((2**32) | random) }}"
|
||||||
|
|
||||||
- name: Find all roles
|
- name: Find all roles
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Dump result
|
- name: Dump result
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: result
|
var: result
|
||||||
|
|
||||||
- name: Validate result
|
- name: Validate result
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.openssl_present
|
- result.openssl_present
|
||||||
- result.python_cryptography_installed
|
- result.python_cryptography_installed
|
||||||
|
|||||||
@@ -24,13 +24,13 @@
|
|||||||
when: false
|
when: false
|
||||||
block:
|
block:
|
||||||
- name: Create lookback device
|
- name: Create lookback device
|
||||||
command: losetup -f {{ cryptfile_path }}
|
ansible.builtin.command: losetup -f {{ cryptfile_path }}
|
||||||
|
|
||||||
- name: Determine loop device name
|
- name: Determine loop device name
|
||||||
command: losetup -j {{ cryptfile_path }} --output name
|
ansible.builtin.command: losetup -j {{ cryptfile_path }} --output name
|
||||||
register: cryptfile_device_output
|
register: cryptfile_device_output
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
cryptfile_device: "{{ cryptfile_device_output.stdout_lines[1] }}"
|
cryptfile_device: "{{ cryptfile_device_output.stdout_lines[1] }}"
|
||||||
|
|
||||||
- name: Create LUKS container
|
- name: Create LUKS container
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Validate result
|
- name: Validate result
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.msg == 'Everything is ok'
|
- result.msg == 'Everything is ok'
|
||||||
|
|
||||||
@@ -17,6 +17,6 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Validate result
|
- name: Validate result
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.msg == 'Everything is ok'
|
- result.msg == 'Everything is ok'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Generate account keys
|
- name: Generate account keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
||||||
passphrase: "{{ item.pass | default(omit) | default(omit, true) }}"
|
passphrase: "{{ item.pass | default(omit) | default(omit, true) }}"
|
||||||
type: ECC
|
type: ECC
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
loop: "{{ account_keys }}"
|
loop: "{{ account_keys }}"
|
||||||
|
|
||||||
- name: Parse account keys (to ease debugging some test failures)
|
- name: Parse account keys (to ease debugging some test failures)
|
||||||
openssl_privatekey_info:
|
community.crypto.openssl_privatekey_info:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
||||||
passphrase: "{{ item.pass | default(omit) | default(omit, true) }}"
|
passphrase: "{{ item.pass | default(omit) | default(omit, true) }}"
|
||||||
return_private_key_data: true
|
return_private_key_data: true
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
- name: accountkey5
|
- name: accountkey5
|
||||||
|
|
||||||
- name: Do not try to create account
|
- name: Do not try to create account
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
register: account_not_created
|
register: account_not_created
|
||||||
|
|
||||||
- name: Create it now (check mode, diff)
|
- name: Create it now (check mode, diff)
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
register: account_created_check
|
register: account_created_check
|
||||||
|
|
||||||
- name: Create it now
|
- name: Create it now
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
register: account_created
|
register: account_created
|
||||||
|
|
||||||
- name: Create it now (idempotent)
|
- name: Create it now (idempotent)
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -86,12 +86,12 @@
|
|||||||
register: account_created_idempotent
|
register: account_created_idempotent
|
||||||
|
|
||||||
- name: Read account key
|
- name: Read account key
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/accountkey.pem'
|
src: '{{ remote_tmp_dir }}/accountkey.pem'
|
||||||
register: slurp
|
register: slurp
|
||||||
|
|
||||||
- name: Change email address (check mode, diff)
|
- name: Change email address (check mode, diff)
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_content: "{{ slurp.content | b64decode }}"
|
account_key_content: "{{ slurp.content | b64decode }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
register: account_modified_check
|
register: account_modified_check
|
||||||
|
|
||||||
- name: Change email address
|
- name: Change email address
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_content: "{{ slurp.content | b64decode }}"
|
account_key_content: "{{ slurp.content | b64decode }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
register: account_modified
|
register: account_modified
|
||||||
|
|
||||||
- name: Change email address (idempotent)
|
- name: Change email address (idempotent)
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
account_uri: "{{ account_created.account_uri }}"
|
account_uri: "{{ account_created.account_uri }}"
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
register: account_modified_idempotent
|
register: account_modified_idempotent
|
||||||
|
|
||||||
- name: Cannot access account with wrong URI
|
- name: Cannot access account with wrong URI
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
account_uri: "{{ account_created.account_uri ~ '12345thisdoesnotexist' }}"
|
account_uri: "{{ account_created.account_uri ~ '12345thisdoesnotexist' }}"
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
register: account_modified_wrong_uri
|
register: account_modified_wrong_uri
|
||||||
|
|
||||||
- name: Clear contact email addresses (check mode, diff)
|
- name: Clear contact email addresses (check mode, diff)
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
register: account_modified_2_check
|
register: account_modified_2_check
|
||||||
|
|
||||||
- name: Clear contact email addresses
|
- name: Clear contact email addresses
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -172,7 +172,7 @@
|
|||||||
register: account_modified_2
|
register: account_modified_2
|
||||||
|
|
||||||
- name: Clear contact email addresses (idempotent)
|
- name: Clear contact email addresses (idempotent)
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
register: account_modified_2_idempotent
|
register: account_modified_2_idempotent
|
||||||
|
|
||||||
- name: Change account key (check mode, diff)
|
- name: Change account key (check mode, diff)
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -200,7 +200,7 @@
|
|||||||
register: account_change_key_check
|
register: account_change_key_check
|
||||||
|
|
||||||
- name: Change account key
|
- name: Change account key
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -214,7 +214,7 @@
|
|||||||
register: account_change_key
|
register: account_change_key
|
||||||
|
|
||||||
- name: Deactivate account (check mode, diff)
|
- name: Deactivate account (check mode, diff)
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
||||||
account_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
account_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
||||||
@@ -227,7 +227,7 @@
|
|||||||
register: account_deactivate_check
|
register: account_deactivate_check
|
||||||
|
|
||||||
- name: Deactivate account
|
- name: Deactivate account
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
||||||
account_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
account_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
||||||
@@ -238,7 +238,7 @@
|
|||||||
register: account_deactivate
|
register: account_deactivate
|
||||||
|
|
||||||
- name: Deactivate account (idempotent)
|
- name: Deactivate account (idempotent)
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
||||||
account_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
account_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
||||||
@@ -249,7 +249,7 @@
|
|||||||
register: account_deactivate_idempotent
|
register: account_deactivate_idempotent
|
||||||
|
|
||||||
- name: Do not try to create account II
|
- name: Do not try to create account II
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
||||||
account_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
account_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
||||||
@@ -262,7 +262,7 @@
|
|||||||
register: account_not_created_2
|
register: account_not_created_2
|
||||||
|
|
||||||
- name: Do not try to create account III
|
- name: Do not try to create account III
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -274,7 +274,7 @@
|
|||||||
register: account_not_created_3
|
register: account_not_created_3
|
||||||
|
|
||||||
- name: Create account with External Account Binding
|
- name: Create account with External Account Binding
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/{{ item.account }}.pem"
|
account_key_src: "{{ remote_tmp_dir }}/{{ item.account }}.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -304,4 +304,4 @@
|
|||||||
kid: kid-3
|
kid: kid-3
|
||||||
alg: HS512
|
alg: HS512
|
||||||
key: zWNDZM6eQGHWpSRTPal5eIUYFTu7EajVIoguysqZ9wG44nMEtx3MUAsUDkMTQ12W
|
key: zWNDZM6eQGHWpSRTPal5eIUYFTu7EajVIoguysqZ9wG44nMEtx3MUAsUDkMTQ12W
|
||||||
- debug: var=account_created_eab
|
- ansible.builtin.debug: var=account_created_eab
|
||||||
|
|||||||
@@ -10,31 +10,31 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
||||||
when: openssl_version.stdout is version('1.0.0', '>=')
|
when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.5', '>=')
|
when: cryptography_version.stdout is version('1.5', '>=')
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Validate that account wasn't created in the first step
|
- name: Validate that account wasn't created in the first step
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_not_created is failed
|
- account_not_created is failed
|
||||||
- account_not_created.msg == 'Account does not exist or is deactivated.'
|
- account_not_created.msg == 'Account does not exist or is deactivated.'
|
||||||
|
|
||||||
- name: Validate that account was created in the second step (check mode)
|
- name: Validate that account was created in the second step (check mode)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_created_check is changed
|
- account_created_check is changed
|
||||||
- account_created_check.account_uri is none
|
- account_created_check.account_uri is none
|
||||||
@@ -21,19 +21,19 @@
|
|||||||
- account_created_check.diff.after.contact[0] in ['mailto:example@example.org', 'mailto:********@********.org']
|
- account_created_check.diff.after.contact[0] in ['mailto:example@example.org', 'mailto:********@********.org']
|
||||||
|
|
||||||
- name: Validate that account was created in the second step
|
- name: Validate that account was created in the second step
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_created is changed
|
- account_created is changed
|
||||||
- account_created.account_uri is not none
|
- account_created.account_uri is not none
|
||||||
|
|
||||||
- name: Validate that account was created in the second step (idempotency)
|
- name: Validate that account was created in the second step (idempotency)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_created_idempotent is not changed
|
- account_created_idempotent is not changed
|
||||||
- account_created_idempotent.account_uri is not none
|
- account_created_idempotent.account_uri is not none
|
||||||
|
|
||||||
- name: Validate that email address was changed (check mode)
|
- name: Validate that email address was changed (check mode)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_modified_check is changed
|
- account_modified_check is changed
|
||||||
- account_modified_check.account_uri is not none
|
- account_modified_check.account_uri is not none
|
||||||
@@ -44,24 +44,24 @@
|
|||||||
- account_modified_check.diff.after.contact[0] in ['mailto:example@example.com', 'mailto:********@********.com']
|
- account_modified_check.diff.after.contact[0] in ['mailto:example@example.com', 'mailto:********@********.com']
|
||||||
|
|
||||||
- name: Validate that email address was changed
|
- name: Validate that email address was changed
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_modified is changed
|
- account_modified is changed
|
||||||
- account_modified.account_uri is not none
|
- account_modified.account_uri is not none
|
||||||
|
|
||||||
- name: Validate that email address was not changed a second time (idempotency)
|
- name: Validate that email address was not changed a second time (idempotency)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_modified_idempotent is not changed
|
- account_modified_idempotent is not changed
|
||||||
- account_modified_idempotent.account_uri is not none
|
- account_modified_idempotent.account_uri is not none
|
||||||
|
|
||||||
- name: Make sure that with the wrong account URI, the account cannot be changed
|
- name: Make sure that with the wrong account URI, the account cannot be changed
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_modified_wrong_uri is failed
|
- account_modified_wrong_uri is failed
|
||||||
|
|
||||||
- name: Validate that email address was cleared (check mode)
|
- name: Validate that email address was cleared (check mode)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_modified_2_check is changed
|
- account_modified_2_check is changed
|
||||||
- account_modified_2_check.account_uri is not none
|
- account_modified_2_check.account_uri is not none
|
||||||
@@ -71,19 +71,19 @@
|
|||||||
- account_modified_2_check.diff.after.contact | length == 0
|
- account_modified_2_check.diff.after.contact | length == 0
|
||||||
|
|
||||||
- name: Validate that email address was cleared
|
- name: Validate that email address was cleared
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_modified_2 is changed
|
- account_modified_2 is changed
|
||||||
- account_modified_2.account_uri is not none
|
- account_modified_2.account_uri is not none
|
||||||
|
|
||||||
- name: Validate that email address was not cleared a second time (idempotency)
|
- name: Validate that email address was not cleared a second time (idempotency)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_modified_2_idempotent is not changed
|
- account_modified_2_idempotent is not changed
|
||||||
- account_modified_2_idempotent.account_uri is not none
|
- account_modified_2_idempotent.account_uri is not none
|
||||||
|
|
||||||
- name: Validate that the account key was changed (check mode)
|
- name: Validate that the account key was changed (check mode)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_change_key_check is changed
|
- account_change_key_check is changed
|
||||||
- account_change_key_check.account_uri is not none
|
- account_change_key_check.account_uri is not none
|
||||||
@@ -91,13 +91,13 @@
|
|||||||
- account_change_key_check.diff.before.public_account_key != account_change_key_check.diff.after.public_account_key
|
- account_change_key_check.diff.before.public_account_key != account_change_key_check.diff.after.public_account_key
|
||||||
|
|
||||||
- name: Validate that the account key was changed
|
- name: Validate that the account key was changed
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_change_key is changed
|
- account_change_key is changed
|
||||||
- account_change_key.account_uri is not none
|
- account_change_key.account_uri is not none
|
||||||
|
|
||||||
- name: Validate that the account was deactivated (check mode)
|
- name: Validate that the account was deactivated (check mode)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_deactivate_check is changed
|
- account_deactivate_check is changed
|
||||||
- account_deactivate_check.account_uri is not none
|
- account_deactivate_check.account_uri is not none
|
||||||
@@ -106,13 +106,13 @@
|
|||||||
- "account_deactivate_check.diff.after == {}"
|
- "account_deactivate_check.diff.after == {}"
|
||||||
|
|
||||||
- name: Validate that the account was deactivated
|
- name: Validate that the account was deactivated
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_deactivate is changed
|
- account_deactivate is changed
|
||||||
- account_deactivate.account_uri is not none
|
- account_deactivate.account_uri is not none
|
||||||
|
|
||||||
- name: Validate that the account was really deactivated (idempotency)
|
- name: Validate that the account was really deactivated (idempotency)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_deactivate_idempotent is not changed
|
- account_deactivate_idempotent is not changed
|
||||||
# The next condition should be true for all conforming ACME servers.
|
# The next condition should be true for all conforming ACME servers.
|
||||||
@@ -121,19 +121,19 @@
|
|||||||
- account_deactivate_idempotent.account_uri is none
|
- account_deactivate_idempotent.account_uri is none
|
||||||
|
|
||||||
- name: Validate that the account is gone (new account key)
|
- name: Validate that the account is gone (new account key)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_not_created_2 is failed
|
- account_not_created_2 is failed
|
||||||
- account_not_created_2.msg == 'Account does not exist or is deactivated.'
|
- account_not_created_2.msg == 'Account does not exist or is deactivated.'
|
||||||
|
|
||||||
- name: Validate that the account is gone (old account key)
|
- name: Validate that the account is gone (old account key)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_not_created_3 is failed
|
- account_not_created_3 is failed
|
||||||
- account_not_created_3.msg == 'Account does not exist or is deactivated.'
|
- account_not_created_3.msg == 'Account does not exist or is deactivated.'
|
||||||
|
|
||||||
- name: Validate that the account with External Account Binding has been created
|
- name: Validate that the account with External Account Binding has been created
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_created_eab.results[0] is changed
|
- account_created_eab.results[0] is changed
|
||||||
- account_created_eab.results[1] is changed
|
- account_created_eab.results[1] is changed
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Generate account keys
|
- name: Generate account keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
loop: "{{ account_keys }}"
|
loop: "{{ account_keys }}"
|
||||||
|
|
||||||
- name: Parse account keys (to ease debugging some test failures)
|
- name: Parse account keys (to ease debugging some test failures)
|
||||||
openssl_privatekey_info:
|
community.crypto.openssl_privatekey_info:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
||||||
return_private_key_data: true
|
return_private_key_data: true
|
||||||
loop: "{{ account_keys }}"
|
loop: "{{ account_keys }}"
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
- accountkey2
|
- accountkey2
|
||||||
|
|
||||||
- name: Check that account does not exist
|
- name: Check that account does not exist
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
register: account_not_created
|
register: account_not_created
|
||||||
|
|
||||||
- name: Create it now
|
- name: Create it now
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
- mailto:example@example.org
|
- mailto:example@example.org
|
||||||
|
|
||||||
- name: Check that account exists
|
- name: Check that account exists
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -55,12 +55,12 @@
|
|||||||
register: account_created
|
register: account_created
|
||||||
|
|
||||||
- name: Read account key
|
- name: Read account key
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/accountkey.pem'
|
src: '{{ remote_tmp_dir }}/accountkey.pem'
|
||||||
register: slurp
|
register: slurp
|
||||||
|
|
||||||
- name: Clear email address
|
- name: Clear email address
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_content: "{{ slurp.content | b64decode }}"
|
account_key_content: "{{ slurp.content | b64decode }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
contact: []
|
contact: []
|
||||||
|
|
||||||
- name: Check that account was modified
|
- name: Check that account was modified
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
register: account_modified
|
register: account_modified
|
||||||
|
|
||||||
- name: Check with wrong account URI
|
- name: Check with wrong account URI
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
register: account_not_exist
|
register: account_not_exist
|
||||||
|
|
||||||
- name: Check with wrong account key
|
- name: Check with wrong account key
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
|
|||||||
@@ -10,31 +10,31 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
||||||
when: openssl_version.stdout is version('1.0.0', '>=')
|
when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.5', '>=')
|
when: cryptography_version.stdout is version('1.5', '>=')
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Validate that account wasn't there
|
- name: Validate that account wasn't there
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- not account_not_created.exists
|
- not account_not_created.exists
|
||||||
- account_not_created.account_uri is none
|
- account_not_created.account_uri is none
|
||||||
- "'account' not in account_not_created"
|
- "'account' not in account_not_created"
|
||||||
|
|
||||||
- name: Validate that account was created
|
- name: Validate that account was created
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_created.exists
|
- account_created.exists
|
||||||
- account_created.account_uri is not none
|
- account_created.account_uri is not none
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
- "account_created.account.contact[0] == 'mailto:example@example.org'"
|
- "account_created.account.contact[0] == 'mailto:example@example.org'"
|
||||||
|
|
||||||
- name: Validate that account email was removed
|
- name: Validate that account email was removed
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_modified.exists
|
- account_modified.exists
|
||||||
- account_modified.account_uri is not none
|
- account_modified.account_uri is not none
|
||||||
@@ -32,13 +32,13 @@
|
|||||||
- account_modified.account.contact | length == 0
|
- account_modified.account.contact | length == 0
|
||||||
|
|
||||||
- name: Validate that account does not exist with wrong account URI
|
- name: Validate that account does not exist with wrong account URI
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- not account_not_exist.exists
|
- not account_not_exist.exists
|
||||||
- account_not_exist.account_uri is none
|
- account_not_exist.account_uri is none
|
||||||
- "'account' not in account_not_exist"
|
- "'account' not in account_not_exist"
|
||||||
|
|
||||||
- name: Validate that account cannot be accessed with wrong key
|
- name: Validate that account cannot be accessed with wrong key
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_wrong_key is failed
|
- account_wrong_key is failed
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
## SET UP ACCOUNT KEYS ########################################################################
|
## SET UP ACCOUNT KEYS ########################################################################
|
||||||
- block:
|
- block:
|
||||||
- name: Generate account keys
|
- name: Generate account keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
||||||
type: "{{ item.type }}"
|
type: "{{ item.type }}"
|
||||||
size: "{{ item.size | default(omit) }}"
|
size: "{{ item.size | default(omit) }}"
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
## CREATE ACCOUNTS AND OBTAIN CERTIFICATES ####################################################
|
## CREATE ACCOUNTS AND OBTAIN CERTIFICATES ####################################################
|
||||||
- name: Obtain cert 1
|
- name: Obtain cert 1
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 1 for renewal check
|
certgen_title: Certificate 1 for renewal check
|
||||||
certificate_name: cert-1
|
certificate_name: cert-1
|
||||||
@@ -39,18 +39,18 @@
|
|||||||
account_email: "example@example.org"
|
account_email: "example@example.org"
|
||||||
## OBTAIN CERTIFICATE INFOS ###################################################################
|
## OBTAIN CERTIFICATE INFOS ###################################################################
|
||||||
- name: Dump OpenSSL x509 info
|
- name: Dump OpenSSL x509 info
|
||||||
command:
|
ansible.builtin.command:
|
||||||
cmd: openssl x509 -in {{ remote_tmp_dir }}/cert-1.pem -noout -text
|
cmd: openssl x509 -in {{ remote_tmp_dir }}/cert-1.pem -noout -text
|
||||||
- name: Obtain certificate information
|
- name: Obtain certificate information
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-1.pem"
|
path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
register: cert_1_info
|
register: cert_1_info
|
||||||
- name: Read certificate
|
- name: Read certificate
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/cert-1.pem'
|
src: '{{ remote_tmp_dir }}/cert-1.pem'
|
||||||
register: slurp_cert_1
|
register: slurp_cert_1
|
||||||
- name: Obtain certificate information
|
- name: Obtain certificate information
|
||||||
acme_ari_info:
|
community.crypto.acme_ari_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
|
|||||||
@@ -14,31 +14,31 @@
|
|||||||
block:
|
block:
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
||||||
when: openssl_version.stdout is version('1.0.0', '>=')
|
when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.5', '>=')
|
when: cryptography_version.stdout is version('1.5', '>=')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Validate results
|
- name: Validate results
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_1 is not changed
|
- cert_1 is not changed
|
||||||
- cert_1.renewal_info.explanationURL is not defined or cert_1.renewal_info.explanationURL is string
|
- cert_1.renewal_info.explanationURL is not defined or cert_1.renewal_info.explanationURL is string
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
## SET UP ACCOUNT KEYS ########################################################################
|
## SET UP ACCOUNT KEYS ########################################################################
|
||||||
- block:
|
- block:
|
||||||
- name: Generate account keys
|
- name: Generate account keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
||||||
type: "{{ item.type }}"
|
type: "{{ item.type }}"
|
||||||
size: "{{ item.size | default(omit) }}"
|
size: "{{ item.size | default(omit) }}"
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
## SET UP ACCOUNTS ############################################################################
|
## SET UP ACCOUNTS ############################################################################
|
||||||
- name: Make sure ECC256 account hasn't been created yet
|
- name: Make sure ECC256 account hasn't been created yet
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
@@ -36,11 +36,11 @@
|
|||||||
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
||||||
state: absent
|
state: absent
|
||||||
- name: Read account key (EC384)
|
- name: Read account key (EC384)
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/account-ec384.pem'
|
src: '{{ remote_tmp_dir }}/account-ec384.pem'
|
||||||
register: slurp
|
register: slurp
|
||||||
- name: Create ECC384 account
|
- name: Create ECC384 account
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
- mailto:example@example.org
|
- mailto:example@example.org
|
||||||
- mailto:example@example.com
|
- mailto:example@example.com
|
||||||
- name: Create RSA account
|
- name: Create RSA account
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
## OBTAIN CERTIFICATES ########################################################################
|
## OBTAIN CERTIFICATES ########################################################################
|
||||||
- name: Obtain cert 1
|
- name: Obtain cert 1
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 1
|
certgen_title: Certificate 1
|
||||||
certificate_name: cert-1
|
certificate_name: cert-1
|
||||||
@@ -89,11 +89,11 @@
|
|||||||
issuer: "{{ acme_roots[1].subject }}"
|
issuer: "{{ acme_roots[1].subject }}"
|
||||||
use_csr_content: true
|
use_csr_content: true
|
||||||
- name: Store obtain results for cert 1
|
- name: Store obtain results for cert 1
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_1_obtain_results: "{{ certificate_obtain_result }}"
|
cert_1_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
cert_1_alternate: "{{ 1 if select_crypto_backend == 'cryptography' else 0 }}"
|
cert_1_alternate: "{{ 1 if select_crypto_backend == 'cryptography' else 0 }}"
|
||||||
- name: Obtain cert 2
|
- name: Obtain cert 2
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 2
|
certgen_title: Certificate 2
|
||||||
certificate_name: cert-2
|
certificate_name: cert-2
|
||||||
@@ -122,15 +122,15 @@
|
|||||||
issuer: "{{ acme_roots[2].subject }}"
|
issuer: "{{ acme_roots[2].subject }}"
|
||||||
use_csr_content: false
|
use_csr_content: false
|
||||||
- name: Store obtain results for cert 2
|
- name: Store obtain results for cert 2
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_2_obtain_results: "{{ certificate_obtain_result }}"
|
cert_2_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
cert_2_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
cert_2_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
||||||
- name: Read account key (RSA)
|
- name: Read account key (RSA)
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/account-rsa.pem'
|
src: '{{ remote_tmp_dir }}/account-rsa.pem'
|
||||||
register: slurp_account_key
|
register: slurp_account_key
|
||||||
- name: Obtain cert 3
|
- name: Obtain cert 3
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 3
|
certgen_title: Certificate 3
|
||||||
certificate_name: cert-3
|
certificate_name: cert-3
|
||||||
@@ -152,11 +152,11 @@
|
|||||||
subject: "{{ acme_roots[1].subject }}"
|
subject: "{{ acme_roots[1].subject }}"
|
||||||
use_csr_content: true
|
use_csr_content: true
|
||||||
- name: Store obtain results for cert 3
|
- name: Store obtain results for cert 3
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_3_obtain_results: "{{ certificate_obtain_result }}"
|
cert_3_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
cert_3_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
cert_3_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
||||||
- name: Obtain cert 4
|
- name: Obtain cert 4
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 4
|
certgen_title: Certificate 4
|
||||||
certificate_name: cert-4
|
certificate_name: cert-4
|
||||||
@@ -181,11 +181,11 @@
|
|||||||
issuer: "{{ acme_roots[1].subject }}"
|
issuer: "{{ acme_roots[1].subject }}"
|
||||||
use_csr_content: false
|
use_csr_content: false
|
||||||
- name: Store obtain results for cert 4
|
- name: Store obtain results for cert 4
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_4_obtain_results: "{{ certificate_obtain_result }}"
|
cert_4_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
cert_4_alternate: "{{ 2 if select_crypto_backend == 'cryptography' else 0 }}"
|
cert_4_alternate: "{{ 2 if select_crypto_backend == 'cryptography' else 0 }}"
|
||||||
- name: Obtain cert 5
|
- name: Obtain cert 5
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 5, Iteration 1/4
|
certgen_title: Certificate 5, Iteration 1/4
|
||||||
certificate_name: cert-5
|
certificate_name: cert-5
|
||||||
@@ -202,11 +202,11 @@
|
|||||||
account_email: ""
|
account_email: ""
|
||||||
use_csr_content: true
|
use_csr_content: true
|
||||||
- name: Store obtain results for cert 5a
|
- name: Store obtain results for cert 5a
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_5a_obtain_results: "{{ certificate_obtain_result }}"
|
cert_5a_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
cert_5_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
cert_5_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
||||||
- name: Obtain cert 5 (should not, since already there and valid for more than 1 days)
|
- name: Obtain cert 5 (should not, since already there and valid for more than 1 days)
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 5, Iteration 2/4
|
certgen_title: Certificate 5, Iteration 2/4
|
||||||
certificate_name: cert-5
|
certificate_name: cert-5
|
||||||
@@ -223,10 +223,10 @@
|
|||||||
account_email: ""
|
account_email: ""
|
||||||
use_csr_content: false
|
use_csr_content: false
|
||||||
- name: Store obtain results for cert 5b
|
- name: Store obtain results for cert 5b
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_5_recreate_1: "{{ challenge_data is changed }}"
|
cert_5_recreate_1: "{{ challenge_data is changed }}"
|
||||||
- name: Obtain cert 5 (should again by less days)
|
- name: Obtain cert 5 (should again by less days)
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 5, Iteration 3/4
|
certgen_title: Certificate 5, Iteration 3/4
|
||||||
certificate_name: cert-5
|
certificate_name: cert-5
|
||||||
@@ -245,15 +245,15 @@
|
|||||||
acme_certificate_profile: "{{ '6days' if acme_supports_profiles else omit }}"
|
acme_certificate_profile: "{{ '6days' if acme_supports_profiles else omit }}"
|
||||||
acme_certificate_include_renewal_cert_id: when_ari_supported
|
acme_certificate_include_renewal_cert_id: when_ari_supported
|
||||||
- name: Store obtain results for cert 5c
|
- name: Store obtain results for cert 5c
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_5_recreate_2: "{{ challenge_data is changed }}"
|
cert_5_recreate_2: "{{ challenge_data is changed }}"
|
||||||
cert_5c_obtain_results: "{{ certificate_obtain_result }}"
|
cert_5c_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
- name: Read account key (EC384)
|
- name: Read account key (EC384)
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/account-ec384.pem'
|
src: '{{ remote_tmp_dir }}/account-ec384.pem'
|
||||||
register: slurp_account_key
|
register: slurp_account_key
|
||||||
- name: Obtain cert 5 (should again by force)
|
- name: Obtain cert 5 (should again by force)
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 5, Iteration 4/4
|
certgen_title: Certificate 5, Iteration 4/4
|
||||||
certificate_name: cert-5
|
certificate_name: cert-5
|
||||||
@@ -270,12 +270,12 @@
|
|||||||
account_email: ""
|
account_email: ""
|
||||||
use_csr_content: false
|
use_csr_content: false
|
||||||
- name: Store obtain results for cert 5d
|
- name: Store obtain results for cert 5d
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_5_recreate_3: "{{ challenge_data is changed }}"
|
cert_5_recreate_3: "{{ challenge_data is changed }}"
|
||||||
cert_5d_obtain_results: "{{ certificate_obtain_result }}"
|
cert_5d_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
- block:
|
- block:
|
||||||
- name: Obtain cert 6
|
- name: Obtain cert 6
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 6
|
certgen_title: Certificate 6
|
||||||
certificate_name: cert-6
|
certificate_name: cert-6
|
||||||
@@ -303,13 +303,13 @@
|
|||||||
issuer: "{{ acme_roots[1].subject }}"
|
issuer: "{{ acme_roots[1].subject }}"
|
||||||
use_csr_content: true
|
use_csr_content: true
|
||||||
- name: Store obtain results for cert 6
|
- name: Store obtain results for cert 6
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_6_obtain_results: "{{ certificate_obtain_result }}"
|
cert_6_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
cert_6_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
cert_6_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
||||||
when: acme_intermediates[0].subject_key_identifier is defined
|
when: acme_intermediates[0].subject_key_identifier is defined
|
||||||
- block:
|
- block:
|
||||||
- name: Obtain cert 7
|
- name: Obtain cert 7
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 7
|
certgen_title: Certificate 7
|
||||||
certificate_name: cert-7
|
certificate_name: cert-7
|
||||||
@@ -333,13 +333,13 @@
|
|||||||
authority_key_identifier: "{{ acme_roots[2].subject_key_identifier }}"
|
authority_key_identifier: "{{ acme_roots[2].subject_key_identifier }}"
|
||||||
use_csr_content: false
|
use_csr_content: false
|
||||||
- name: Store obtain results for cert 7
|
- name: Store obtain results for cert 7
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_7_obtain_results: "{{ certificate_obtain_result }}"
|
cert_7_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
cert_7_alternate: "{{ 2 if select_crypto_backend == 'cryptography' else 0 }}"
|
cert_7_alternate: "{{ 2 if select_crypto_backend == 'cryptography' else 0 }}"
|
||||||
when: acme_roots[2].subject_key_identifier is defined
|
when: acme_roots[2].subject_key_identifier is defined
|
||||||
- block:
|
- block:
|
||||||
- name: Obtain cert 8
|
- name: Obtain cert 8
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 8
|
certgen_title: Certificate 8
|
||||||
certificate_name: cert-8
|
certificate_name: cert-8
|
||||||
@@ -361,7 +361,7 @@
|
|||||||
account_email: "example@example.org"
|
account_email: "example@example.org"
|
||||||
use_csr_content: true
|
use_csr_content: true
|
||||||
- name: Store obtain results for cert 8
|
- name: Store obtain results for cert 8
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cert_8_obtain_results: "{{ certificate_obtain_result }}"
|
cert_8_obtain_results: "{{ certificate_obtain_result }}"
|
||||||
cert_8_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
cert_8_alternate: "{{ 0 if select_crypto_backend == 'cryptography' else 0 }}"
|
||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
@@ -369,110 +369,110 @@
|
|||||||
## DISSECT CERTIFICATES #######################################################################
|
## DISSECT CERTIFICATES #######################################################################
|
||||||
# Make sure certificates are valid. Root certificate for Pebble equals the chain certificate.
|
# Make sure certificates are valid. Root certificate for Pebble equals the chain certificate.
|
||||||
- name: Verifying cert 1
|
- name: Verifying cert 1
|
||||||
command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-1-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-1-chain.pem" "{{ remote_tmp_dir }}/cert-1.pem"'
|
ansible.builtin.command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-1-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-1-chain.pem" "{{ remote_tmp_dir }}/cert-1.pem"'
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_1_valid
|
register: cert_1_valid
|
||||||
- name: Verifying cert 2
|
- name: Verifying cert 2
|
||||||
command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-2-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-2-chain.pem" "{{ remote_tmp_dir }}/cert-2.pem"'
|
ansible.builtin.command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-2-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-2-chain.pem" "{{ remote_tmp_dir }}/cert-2.pem"'
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_2_valid
|
register: cert_2_valid
|
||||||
- name: Verifying cert 3
|
- name: Verifying cert 3
|
||||||
command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-3-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-3-chain.pem" "{{ remote_tmp_dir }}/cert-3.pem"'
|
ansible.builtin.command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-3-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-3-chain.pem" "{{ remote_tmp_dir }}/cert-3.pem"'
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_3_valid
|
register: cert_3_valid
|
||||||
- name: Verifying cert 4
|
- name: Verifying cert 4
|
||||||
command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-4-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-4-chain.pem" "{{ remote_tmp_dir }}/cert-4.pem"'
|
ansible.builtin.command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-4-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-4-chain.pem" "{{ remote_tmp_dir }}/cert-4.pem"'
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_4_valid
|
register: cert_4_valid
|
||||||
- name: Verifying cert 5
|
- name: Verifying cert 5
|
||||||
command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-5-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-5-chain.pem" "{{ remote_tmp_dir }}/cert-5.pem"'
|
ansible.builtin.command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-5-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-5-chain.pem" "{{ remote_tmp_dir }}/cert-5.pem"'
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_5_valid
|
register: cert_5_valid
|
||||||
- name: Verifying cert 6
|
- name: Verifying cert 6
|
||||||
command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-6-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-6-chain.pem" "{{ remote_tmp_dir }}/cert-6.pem"'
|
ansible.builtin.command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-6-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-6-chain.pem" "{{ remote_tmp_dir }}/cert-6.pem"'
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_6_valid
|
register: cert_6_valid
|
||||||
when: acme_intermediates[0].subject_key_identifier is defined
|
when: acme_intermediates[0].subject_key_identifier is defined
|
||||||
- name: Verifying cert 7
|
- name: Verifying cert 7
|
||||||
command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-7-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-7-chain.pem" "{{ remote_tmp_dir }}/cert-7.pem"'
|
ansible.builtin.command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-7-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-7-chain.pem" "{{ remote_tmp_dir }}/cert-7.pem"'
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_7_valid
|
register: cert_7_valid
|
||||||
when: acme_roots[2].subject_key_identifier is defined
|
when: acme_roots[2].subject_key_identifier is defined
|
||||||
- name: Verifying cert 8
|
- name: Verifying cert 8
|
||||||
command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-8-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-8-chain.pem" "{{ remote_tmp_dir }}/cert-8.pem"'
|
ansible.builtin.command: '{{ openssl_binary }} verify -CAfile "{{ remote_tmp_dir }}/cert-8-root.pem" -untrusted "{{ remote_tmp_dir }}/cert-8-chain.pem" "{{ remote_tmp_dir }}/cert-8.pem"'
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_8_valid
|
register: cert_8_valid
|
||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
# Dump certificate info
|
# Dump certificate info
|
||||||
- name: Dumping cert 1
|
- name: Dumping cert 1
|
||||||
command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-1.pem" -noout -text'
|
ansible.builtin.command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-1.pem" -noout -text'
|
||||||
register: cert_1_text
|
register: cert_1_text
|
||||||
- name: Dumping cert 2
|
- name: Dumping cert 2
|
||||||
command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-2.pem" -noout -text'
|
ansible.builtin.command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-2.pem" -noout -text'
|
||||||
register: cert_2_text
|
register: cert_2_text
|
||||||
- name: Dumping cert 3
|
- name: Dumping cert 3
|
||||||
command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-3.pem" -noout -text'
|
ansible.builtin.command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-3.pem" -noout -text'
|
||||||
register: cert_3_text
|
register: cert_3_text
|
||||||
- name: Dumping cert 4
|
- name: Dumping cert 4
|
||||||
command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-4.pem" -noout -text'
|
ansible.builtin.command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-4.pem" -noout -text'
|
||||||
register: cert_4_text
|
register: cert_4_text
|
||||||
- name: Dumping cert 5
|
- name: Dumping cert 5
|
||||||
command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-5.pem" -noout -text'
|
ansible.builtin.command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-5.pem" -noout -text'
|
||||||
register: cert_5_text
|
register: cert_5_text
|
||||||
- name: Dumping cert 6
|
- name: Dumping cert 6
|
||||||
command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-6.pem" -noout -text'
|
ansible.builtin.command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-6.pem" -noout -text'
|
||||||
register: cert_6_text
|
register: cert_6_text
|
||||||
when: acme_intermediates[0].subject_key_identifier is defined
|
when: acme_intermediates[0].subject_key_identifier is defined
|
||||||
- name: Dumping cert 7
|
- name: Dumping cert 7
|
||||||
command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-7.pem" -noout -text'
|
ansible.builtin.command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-7.pem" -noout -text'
|
||||||
register: cert_7_text
|
register: cert_7_text
|
||||||
when: acme_roots[2].subject_key_identifier is defined
|
when: acme_roots[2].subject_key_identifier is defined
|
||||||
- name: Dumping cert 8
|
- name: Dumping cert 8
|
||||||
command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-8.pem" -noout -text'
|
ansible.builtin.command: '{{ openssl_binary }} x509 -in "{{ remote_tmp_dir }}/cert-8.pem" -noout -text'
|
||||||
register: cert_8_text
|
register: cert_8_text
|
||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
# Dump certificate info
|
# Dump certificate info
|
||||||
- name: Dumping cert 1
|
- name: Dumping cert 1
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-1.pem"
|
path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
register: cert_1_info
|
register: cert_1_info
|
||||||
- name: Dumping cert 2
|
- name: Dumping cert 2
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-2.pem"
|
path: "{{ remote_tmp_dir }}/cert-2.pem"
|
||||||
register: cert_2_info
|
register: cert_2_info
|
||||||
- name: Dumping cert 3
|
- name: Dumping cert 3
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-3.pem"
|
path: "{{ remote_tmp_dir }}/cert-3.pem"
|
||||||
register: cert_3_info
|
register: cert_3_info
|
||||||
- name: Dumping cert 4
|
- name: Dumping cert 4
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-4.pem"
|
path: "{{ remote_tmp_dir }}/cert-4.pem"
|
||||||
register: cert_4_info
|
register: cert_4_info
|
||||||
- name: Dumping cert 5
|
- name: Dumping cert 5
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-5.pem"
|
path: "{{ remote_tmp_dir }}/cert-5.pem"
|
||||||
register: cert_5_info
|
register: cert_5_info
|
||||||
- name: Dumping cert 6
|
- name: Dumping cert 6
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-6.pem"
|
path: "{{ remote_tmp_dir }}/cert-6.pem"
|
||||||
register: cert_6_info
|
register: cert_6_info
|
||||||
when: acme_intermediates[0].subject_key_identifier is defined
|
when: acme_intermediates[0].subject_key_identifier is defined
|
||||||
- name: Dumping cert 7
|
- name: Dumping cert 7
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-7.pem"
|
path: "{{ remote_tmp_dir }}/cert-7.pem"
|
||||||
register: cert_7_info
|
register: cert_7_info
|
||||||
when: acme_roots[2].subject_key_identifier is defined
|
when: acme_roots[2].subject_key_identifier is defined
|
||||||
- name: Dumping cert 8
|
- name: Dumping cert 8
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-8.pem"
|
path: "{{ remote_tmp_dir }}/cert-8.pem"
|
||||||
register: cert_8_info
|
register: cert_8_info
|
||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
## GET ACCOUNT ORDERS #########################################################################
|
## GET ACCOUNT ORDERS #########################################################################
|
||||||
- name: Don't retrieve orders
|
- name: Don't retrieve orders
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -481,7 +481,7 @@
|
|||||||
retrieve_orders: ignore
|
retrieve_orders: ignore
|
||||||
register: account_orders_not
|
register: account_orders_not
|
||||||
- name: Retrieve orders as URL list (1/2)
|
- name: Retrieve orders as URL list (1/2)
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -490,7 +490,7 @@
|
|||||||
retrieve_orders: url_list
|
retrieve_orders: url_list
|
||||||
register: account_orders_urls
|
register: account_orders_urls
|
||||||
- name: Retrieve orders as URL list (2/2)
|
- name: Retrieve orders as URL list (2/2)
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/account-ec384.pem"
|
account_key_src: "{{ remote_tmp_dir }}/account-ec384.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -499,7 +499,7 @@
|
|||||||
retrieve_orders: url_list
|
retrieve_orders: url_list
|
||||||
register: account_orders_urls2
|
register: account_orders_urls2
|
||||||
- name: Retrieve orders as object list (1/2)
|
- name: Retrieve orders as object list (1/2)
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -508,7 +508,7 @@
|
|||||||
retrieve_orders: object_list
|
retrieve_orders: object_list
|
||||||
register: account_orders_full
|
register: account_orders_full
|
||||||
- name: Retrieve orders as object list (2/2)
|
- name: Retrieve orders as object list (2/2)
|
||||||
acme_account_info:
|
community.crypto.acme_account_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/account-ec384.pem"
|
account_key_src: "{{ remote_tmp_dir }}/account-ec384.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
|
|||||||
@@ -10,46 +10,46 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Obtain root and intermediate certificates
|
- name: Obtain root and intermediate certificates
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "http://{{ acme_host }}:5000/{{ item.0 }}-certificate-for-ca/{{ item.1 }}"
|
url: "http://{{ acme_host }}:5000/{{ item.0 }}-certificate-for-ca/{{ item.1 }}"
|
||||||
dest: "{{ remote_tmp_dir }}/acme-{{ item.0 }}-{{ item.1 }}.pem"
|
dest: "{{ remote_tmp_dir }}/acme-{{ item.0 }}-{{ item.1 }}.pem"
|
||||||
loop: "{{ query('nested', types, root_numbers) }}"
|
loop: "{{ query('nested', types, root_numbers) }}"
|
||||||
|
|
||||||
- name: Analyze root certificates
|
- name: Analyze root certificates
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/acme-root-{{ item }}.pem"
|
path: "{{ remote_tmp_dir }}/acme-root-{{ item }}.pem"
|
||||||
loop: "{{ root_numbers }}"
|
loop: "{{ root_numbers }}"
|
||||||
register: acme_roots
|
register: acme_roots
|
||||||
|
|
||||||
- name: Analyze intermediate certificates
|
- name: Analyze intermediate certificates
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/acme-intermediate-{{ item }}.pem"
|
path: "{{ remote_tmp_dir }}/acme-intermediate-{{ item }}.pem"
|
||||||
loop: "{{ root_numbers }}"
|
loop: "{{ root_numbers }}"
|
||||||
register: acme_intermediates
|
register: acme_intermediates
|
||||||
|
|
||||||
- name: Read root certificates
|
- name: Read root certificates
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: "{{ remote_tmp_dir ~ '/acme-root-' ~ item ~ '.pem' }}"
|
src: "{{ remote_tmp_dir ~ '/acme-root-' ~ item ~ '.pem' }}"
|
||||||
loop: "{{ root_numbers }}"
|
loop: "{{ root_numbers }}"
|
||||||
register: slurp_roots
|
register: slurp_roots
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
x__: "{{ item | dict2items | selectattr('key', 'in', interesting_keys) | list | items2dict }}"
|
x__: "{{ item | dict2items | selectattr('key', 'in', interesting_keys) | list | items2dict }}"
|
||||||
loop: "{{ acme_roots.results }}"
|
loop: "{{ acme_roots.results }}"
|
||||||
register: acme_roots_tmp
|
register: acme_roots_tmp
|
||||||
|
|
||||||
- name: Read intermediate certificates
|
- name: Read intermediate certificates
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: "{{ remote_tmp_dir ~ '/acme-intermediate-' ~ item ~ '.pem' }}"
|
src: "{{ remote_tmp_dir ~ '/acme-intermediate-' ~ item ~ '.pem' }}"
|
||||||
loop: "{{ root_numbers }}"
|
loop: "{{ root_numbers }}"
|
||||||
register: slurp_intermediates
|
register: slurp_intermediates
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
x__: "{{ item | dict2items | selectattr('key', 'in', interesting_keys) | list | items2dict }}"
|
x__: "{{ item | dict2items | selectattr('key', 'in', interesting_keys) | list | items2dict }}"
|
||||||
loop: "{{ acme_intermediates.results }}"
|
loop: "{{ acme_intermediates.results }}"
|
||||||
register: acme_intermediates_tmp
|
register: acme_intermediates_tmp
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
acme_roots: "{{ acme_roots_tmp.results | map(attribute='ansible_facts.x__') | list }}"
|
acme_roots: "{{ acme_roots_tmp.results | map(attribute='ansible_facts.x__') | list }}"
|
||||||
acme_root_certs: "{{ slurp_roots.results | map(attribute='content') | map('b64decode') | list }}"
|
acme_root_certs: "{{ slurp_roots.results | map(attribute='content') | map('b64decode') | list }}"
|
||||||
acme_intermediates: "{{ acme_intermediates_tmp.results | map(attribute='ansible_facts.x__') | list }}"
|
acme_intermediates: "{{ acme_intermediates_tmp.results | map(attribute='ansible_facts.x__') | list }}"
|
||||||
@@ -74,48 +74,48 @@
|
|||||||
# - public_key_fingerprints
|
# - public_key_fingerprints
|
||||||
|
|
||||||
- name: ACME root certificate info
|
- name: ACME root certificate info
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: acme_roots
|
var: acme_roots
|
||||||
|
|
||||||
# - name: ACME root certificates as PEM
|
# - name: ACME root certificates as PEM
|
||||||
# debug:
|
# ansible.builtin.debug:
|
||||||
# var: acme_root_certs
|
# var: acme_root_certs
|
||||||
|
|
||||||
- name: ACME intermediate certificate info
|
- name: ACME intermediate certificate info
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: acme_intermediates
|
var: acme_intermediates
|
||||||
|
|
||||||
# - name: ACME intermediate certificates as PEM
|
# - name: ACME intermediate certificates as PEM
|
||||||
# debug:
|
# ansible.builtin.debug:
|
||||||
# var: acme_intermediate_certs
|
# var: acme_intermediate_certs
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
||||||
when: openssl_version.stdout is version('1.0.0', '>=')
|
when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.5', '>=')
|
when: cryptography_version.stdout is version('1.5', '>=')
|
||||||
|
|||||||
@@ -4,15 +4,15 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Check that certificate 1 is valid
|
- name: Check that certificate 1 is valid
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_1_valid is not failed
|
- cert_1_valid is not failed
|
||||||
- name: Check that certificate 1 contains correct SANs
|
- name: Check that certificate 1 contains correct SANs
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'DNS:example.com' in cert_1_text.stdout"
|
- "'DNS:example.com' in cert_1_text.stdout"
|
||||||
- name: Read certificate 1 files
|
- name: Read certificate 1 files
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/{{ item }}'
|
src: '{{ remote_tmp_dir }}/{{ item }}'
|
||||||
loop:
|
loop:
|
||||||
- cert-1.pem
|
- cert-1.pem
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
- cert-1-fullchain.pem
|
- cert-1-fullchain.pem
|
||||||
register: slurp
|
register: slurp
|
||||||
- name: Check that certificate 1 retrieval got all chains
|
- name: Check that certificate 1 retrieval got all chains
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'all_chains' in cert_1_obtain_results"
|
- "'all_chains' in cert_1_obtain_results"
|
||||||
- "cert_1_obtain_results.all_chains | length > 1"
|
- "cert_1_obtain_results.all_chains | length > 1"
|
||||||
@@ -32,16 +32,16 @@
|
|||||||
- "(slurp.results[2].content | b64decode) == cert_1_obtain_results.all_chains[cert_1_alternate | int].full_chain"
|
- "(slurp.results[2].content | b64decode) == cert_1_obtain_results.all_chains[cert_1_alternate | int].full_chain"
|
||||||
|
|
||||||
- name: Check that certificate 2 is valid
|
- name: Check that certificate 2 is valid
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_2_valid is not failed
|
- cert_2_valid is not failed
|
||||||
- name: Check that certificate 2 contains correct SANs
|
- name: Check that certificate 2 contains correct SANs
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'DNS:*.example.com' in cert_2_text.stdout"
|
- "'DNS:*.example.com' in cert_2_text.stdout"
|
||||||
- "'DNS:example.com' in cert_2_text.stdout"
|
- "'DNS:example.com' in cert_2_text.stdout"
|
||||||
- name: Read certificate 2 files
|
- name: Read certificate 2 files
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/{{ item }}'
|
src: '{{ remote_tmp_dir }}/{{ item }}'
|
||||||
loop:
|
loop:
|
||||||
- cert-2.pem
|
- cert-2.pem
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
- cert-2-fullchain.pem
|
- cert-2-fullchain.pem
|
||||||
register: slurp
|
register: slurp
|
||||||
- name: Check that certificate 1 retrieval got all chains
|
- name: Check that certificate 1 retrieval got all chains
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'all_chains' in cert_2_obtain_results"
|
- "'all_chains' in cert_2_obtain_results"
|
||||||
- "cert_2_obtain_results.all_chains | length > 1"
|
- "cert_2_obtain_results.all_chains | length > 1"
|
||||||
@@ -61,17 +61,17 @@
|
|||||||
- "(slurp.results[2].content | b64decode) == cert_2_obtain_results.all_chains[cert_2_alternate | int].full_chain"
|
- "(slurp.results[2].content | b64decode) == cert_2_obtain_results.all_chains[cert_2_alternate | int].full_chain"
|
||||||
|
|
||||||
- name: Check that certificate 3 is valid
|
- name: Check that certificate 3 is valid
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_3_valid is not failed
|
- cert_3_valid is not failed
|
||||||
- name: Check that certificate 3 contains correct SANs
|
- name: Check that certificate 3 contains correct SANs
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'DNS:*.example.com' in cert_3_text.stdout"
|
- "'DNS:*.example.com' in cert_3_text.stdout"
|
||||||
- "'DNS:example.org' in cert_3_text.stdout"
|
- "'DNS:example.org' in cert_3_text.stdout"
|
||||||
- "'DNS:t1.example.com' in cert_3_text.stdout"
|
- "'DNS:t1.example.com' in cert_3_text.stdout"
|
||||||
- name: Read certificate 3 files
|
- name: Read certificate 3 files
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/{{ item }}'
|
src: '{{ remote_tmp_dir }}/{{ item }}'
|
||||||
loop:
|
loop:
|
||||||
- cert-3.pem
|
- cert-3.pem
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
- cert-3-fullchain.pem
|
- cert-3-fullchain.pem
|
||||||
register: slurp
|
register: slurp
|
||||||
- name: Check that certificate 1 retrieval got all chains
|
- name: Check that certificate 1 retrieval got all chains
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'all_chains' in cert_3_obtain_results"
|
- "'all_chains' in cert_3_obtain_results"
|
||||||
- "cert_3_obtain_results.all_chains | length > 1"
|
- "cert_3_obtain_results.all_chains | length > 1"
|
||||||
@@ -91,11 +91,11 @@
|
|||||||
- "(slurp.results[2].content | b64decode) == cert_3_obtain_results.all_chains[cert_3_alternate | int].full_chain"
|
- "(slurp.results[2].content | b64decode) == cert_3_obtain_results.all_chains[cert_3_alternate | int].full_chain"
|
||||||
|
|
||||||
- name: Check that certificate 4 is valid
|
- name: Check that certificate 4 is valid
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_4_valid is not failed
|
- cert_4_valid is not failed
|
||||||
- name: Check that certificate 4 contains correct SANs
|
- name: Check that certificate 4 contains correct SANs
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'DNS:example.com' in cert_4_text.stdout"
|
- "'DNS:example.com' in cert_4_text.stdout"
|
||||||
- "'DNS:t1.example.com' in cert_4_text.stdout"
|
- "'DNS:t1.example.com' in cert_4_text.stdout"
|
||||||
@@ -103,72 +103,72 @@
|
|||||||
- "'DNS:example.org' in cert_4_text.stdout"
|
- "'DNS:example.org' in cert_4_text.stdout"
|
||||||
- "'DNS:TesT.example.org' in cert_4_text.stdout"
|
- "'DNS:TesT.example.org' in cert_4_text.stdout"
|
||||||
- name: Check that certificate 4 retrieval did not get all chains
|
- name: Check that certificate 4 retrieval did not get all chains
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'all_chains' not in cert_4_obtain_results"
|
- "'all_chains' not in cert_4_obtain_results"
|
||||||
|
|
||||||
- name: Check that certificate 5 is valid
|
- name: Check that certificate 5 is valid
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_5_valid is not failed
|
- cert_5_valid is not failed
|
||||||
- name: Check that certificate 5 contains correct SANs
|
- name: Check that certificate 5 contains correct SANs
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'DNS:t2.example.com' in cert_5_text.stdout"
|
- "'DNS:t2.example.com' in cert_5_text.stdout"
|
||||||
- name: Check that certificate 5 was not recreated on the first try
|
- name: Check that certificate 5 was not recreated on the first try
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_5_recreate_1 == false
|
- cert_5_recreate_1 == false
|
||||||
- name: Check that certificate 5 was recreated on the second try
|
- name: Check that certificate 5 was recreated on the second try
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_5_recreate_2 == true
|
- cert_5_recreate_2 == true
|
||||||
- name: Check that certificate 5 was recreated on the third try
|
- name: Check that certificate 5 was recreated on the third try
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_5_recreate_3 == true
|
- cert_5_recreate_3 == true
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Check that certificate 6 is valid
|
- name: Check that certificate 6 is valid
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_6_valid is not failed
|
- cert_6_valid is not failed
|
||||||
- name: Check that certificate 6 contains correct SANs
|
- name: Check that certificate 6 contains correct SANs
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'DNS:example.org' in cert_6_text.stdout"
|
- "'DNS:example.org' in cert_6_text.stdout"
|
||||||
when: acme_intermediates[0].subject_key_identifier is defined
|
when: acme_intermediates[0].subject_key_identifier is defined
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Check that certificate 7 is valid
|
- name: Check that certificate 7 is valid
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_7_valid is not failed
|
- cert_7_valid is not failed
|
||||||
- name: Check that certificate 7 contains correct SANs
|
- name: Check that certificate 7 contains correct SANs
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'IP Address:127.0.0.1' in cert_8_text.stdout or 'IP:127.0.0.1' in cert_8_text.stdout"
|
- "'IP Address:127.0.0.1' in cert_8_text.stdout or 'IP:127.0.0.1' in cert_8_text.stdout"
|
||||||
when: acme_roots[2].subject_key_identifier is defined
|
when: acme_roots[2].subject_key_identifier is defined
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Check that certificate 8 is valid
|
- name: Check that certificate 8 is valid
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_8_valid is not failed
|
- cert_8_valid is not failed
|
||||||
- name: Check that certificate 8 contains correct SANs
|
- name: Check that certificate 8 contains correct SANs
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'IP Address:127.0.0.1' in cert_8_text.stdout or 'IP:127.0.0.1' in cert_8_text.stdout"
|
- "'IP Address:127.0.0.1' in cert_8_text.stdout or 'IP:127.0.0.1' in cert_8_text.stdout"
|
||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
- name: Validate that orders were not retrieved
|
- name: Validate that orders were not retrieved
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'account' in account_orders_not"
|
- "'account' in account_orders_not"
|
||||||
- "'orders' not in account_orders_not"
|
- "'orders' not in account_orders_not"
|
||||||
|
|
||||||
- name: Validate that orders were retrieved as list of URLs (1/2)
|
- name: Validate that orders were retrieved as list of URLs (1/2)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'account' in account_orders_urls"
|
- "'account' in account_orders_urls"
|
||||||
- "'orders' not in account_orders_urls"
|
- "'orders' not in account_orders_urls"
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
- "account_orders_urls.order_uris[0] is string"
|
- "account_orders_urls.order_uris[0] is string"
|
||||||
|
|
||||||
- name: Validate that orders were retrieved as list of URLs (2/2)
|
- name: Validate that orders were retrieved as list of URLs (2/2)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'account' in account_orders_urls2"
|
- "'account' in account_orders_urls2"
|
||||||
- "'orders' not in account_orders_urls2"
|
- "'orders' not in account_orders_urls2"
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
- "account_orders_urls2.order_uris[0] is string"
|
- "account_orders_urls2.order_uris[0] is string"
|
||||||
|
|
||||||
- name: Validate that orders were retrieved as list of objects (1/2)
|
- name: Validate that orders were retrieved as list of objects (1/2)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'account' in account_orders_full"
|
- "'account' in account_orders_full"
|
||||||
- "'orders' in account_orders_full"
|
- "'orders' in account_orders_full"
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
- "account_orders_full.order_uris[0] is string"
|
- "account_orders_full.order_uris[0] is string"
|
||||||
|
|
||||||
- name: Validate that orders were retrieved as list of objects (2/2)
|
- name: Validate that orders were retrieved as list of objects (2/2)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'account' in account_orders_full2"
|
- "'account' in account_orders_full2"
|
||||||
- "'orders' in account_orders_full2"
|
- "'orders' in account_orders_full2"
|
||||||
|
|||||||
@@ -9,24 +9,24 @@
|
|||||||
account_email: example@example.org
|
account_email: example@example.org
|
||||||
block:
|
block:
|
||||||
- name: Generate account key
|
- name: Generate account key
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/account-ec256.pem"
|
path: "{{ remote_tmp_dir }}/account-ec256.pem"
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
force: true
|
force: true
|
||||||
- name: Create cert private key
|
- name: Create cert private key
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/{{ certificate_name }}.key"
|
path: "{{ remote_tmp_dir }}/{{ certificate_name }}.key"
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
force: true
|
force: true
|
||||||
- name: Create cert CSR
|
- name: Create cert CSR
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: "{{ remote_tmp_dir }}/{{ certificate_name }}.csr"
|
path: "{{ remote_tmp_dir }}/{{ certificate_name }}.csr"
|
||||||
privatekey_path: "{{ remote_tmp_dir }}/{{ certificate_name }}.key"
|
privatekey_path: "{{ remote_tmp_dir }}/{{ certificate_name }}.key"
|
||||||
subject_alt_name: "{{ subject_alt_name }}"
|
subject_alt_name: "{{ subject_alt_name }}"
|
||||||
- name: Start process of obtaining certificate
|
- name: Start process of obtaining certificate
|
||||||
acme_certificate:
|
community.crypto.acme_certificate:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
register: certificate_data
|
register: certificate_data
|
||||||
|
|
||||||
- name: Inspect order
|
- name: Inspect order
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -52,11 +52,11 @@
|
|||||||
method: get
|
method: get
|
||||||
register: order_1
|
register: order_1
|
||||||
- name: Show order
|
- name: Show order
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_1.output_json
|
var: order_1.output_json
|
||||||
|
|
||||||
- name: Deactivate order (check mode)
|
- name: Deactivate order (check mode)
|
||||||
acme_certificate_deactivate_authz:
|
community.crypto.acme_certificate_deactivate_authz:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
register: deactivate_1
|
register: deactivate_1
|
||||||
|
|
||||||
- name: Inspect order again
|
- name: Inspect order again
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -77,11 +77,11 @@
|
|||||||
method: get
|
method: get
|
||||||
register: order_2
|
register: order_2
|
||||||
- name: Show order
|
- name: Show order
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_2.output_json
|
var: order_2.output_json
|
||||||
|
|
||||||
- name: Deactivate order
|
- name: Deactivate order
|
||||||
acme_certificate_deactivate_authz:
|
community.crypto.acme_certificate_deactivate_authz:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
register: deactivate_2
|
register: deactivate_2
|
||||||
|
|
||||||
- name: Inspect order again
|
- name: Inspect order again
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -101,11 +101,11 @@
|
|||||||
method: get
|
method: get
|
||||||
register: order_3
|
register: order_3
|
||||||
- name: Show order
|
- name: Show order
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_3.output_json
|
var: order_3.output_json
|
||||||
|
|
||||||
- name: Deactivate order (check mode, idempotent)
|
- name: Deactivate order (check mode, idempotent)
|
||||||
acme_certificate_deactivate_authz:
|
community.crypto.acme_certificate_deactivate_authz:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
register: deactivate_3
|
register: deactivate_3
|
||||||
|
|
||||||
- name: Inspect order again
|
- name: Inspect order again
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -126,11 +126,11 @@
|
|||||||
method: get
|
method: get
|
||||||
register: order_4
|
register: order_4
|
||||||
- name: Show order
|
- name: Show order
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_4.output_json
|
var: order_4.output_json
|
||||||
|
|
||||||
- name: Deactivate order (idempotent)
|
- name: Deactivate order (idempotent)
|
||||||
acme_certificate_deactivate_authz:
|
community.crypto.acme_certificate_deactivate_authz:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -140,7 +140,7 @@
|
|||||||
register: deactivate_4
|
register: deactivate_4
|
||||||
|
|
||||||
- name: Inspect order again
|
- name: Inspect order again
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -150,5 +150,5 @@
|
|||||||
method: get
|
method: get
|
||||||
register: order_5
|
register: order_5
|
||||||
- name: Show order
|
- name: Show order
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_5.output_json
|
var: order_5.output_json
|
||||||
|
|||||||
@@ -10,31 +10,31 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
||||||
when: openssl_version.stdout is version('1.0.0', '>=')
|
when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.5', '>=')
|
when: cryptography_version.stdout is version('1.5', '>=')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Checks
|
- name: Checks
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order_1.output_json.status == 'pending'
|
- order_1.output_json.status == 'pending'
|
||||||
- deactivate_1 is changed
|
- deactivate_1 is changed
|
||||||
|
|||||||
@@ -4,23 +4,23 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate random domain name"
|
- name: "({{ select_crypto_backend }}) Generate random domain name"
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
domain_name: "host{{ '%0x' % ((2**32) | random) }}.example.com"
|
domain_name: "host{{ '%0x' % ((2**32) | random) }}.example.com"
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate account key"
|
- name: "({{ select_crypto_backend }}) Generate account key"
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/accountkey.pem"
|
path: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
force: true
|
force: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Parse account keys (to ease debugging some test failures)"
|
- name: "({{ select_crypto_backend }}) Parse account keys (to ease debugging some test failures)"
|
||||||
openssl_privatekey_info:
|
community.crypto.openssl_privatekey_info:
|
||||||
path: "{{ remote_tmp_dir }}/accountkey.pem"
|
path: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
return_private_key_data: true
|
return_private_key_data: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create ACME account"
|
- name: "({{ select_crypto_backend }}) Create ACME account"
|
||||||
acme_account:
|
community.crypto.acme_account:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -31,14 +31,14 @@
|
|||||||
register: account
|
register: account
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate certificate key"
|
- name: "({{ select_crypto_backend }}) Generate certificate key"
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/cert.key"
|
path: "{{ remote_tmp_dir }}/cert.key"
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
force: true
|
force: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate certificate CSR"
|
- name: "({{ select_crypto_backend }}) Generate certificate CSR"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: "{{ remote_tmp_dir }}/cert.csr"
|
path: "{{ remote_tmp_dir }}/cert.csr"
|
||||||
privatekey_path: "{{ remote_tmp_dir }}/cert.key"
|
privatekey_path: "{{ remote_tmp_dir }}/cert.key"
|
||||||
subject:
|
subject:
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
register: csr
|
register: csr
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create certificate order"
|
- name: "({{ select_crypto_backend }}) Create certificate order"
|
||||||
acme_certificate_order_create:
|
community.crypto.acme_certificate_order_create:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -57,11 +57,11 @@
|
|||||||
register: order_1
|
register: order_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Show order information"
|
- name: "({{ select_crypto_backend }}) Show order information"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_1
|
var: order_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check order"
|
- name: "({{ select_crypto_backend }}) Check order"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order_1 is changed
|
- order_1 is changed
|
||||||
- order_1.order_uri.startswith('https://' ~ acme_host ~ ':14000/')
|
- order_1.order_uri.startswith('https://' ~ acme_host ~ ':14000/')
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
- order_1.account_uri == account.account_uri
|
- order_1.account_uri == account.account_uri
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get order information"
|
- name: "({{ select_crypto_backend }}) Get order information"
|
||||||
acme_certificate_order_info:
|
community.crypto.acme_certificate_order_info:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -91,11 +91,11 @@
|
|||||||
register: order_info_1
|
register: order_info_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Show order information"
|
- name: "({{ select_crypto_backend }}) Show order information"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_info_1
|
var: order_info_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check order information"
|
- name: "({{ select_crypto_backend }}) Check order information"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order_info_1 is not changed
|
- order_info_1 is not changed
|
||||||
- order_info_1.authorizations_by_identifier | length == 1
|
- order_info_1.authorizations_by_identifier | length == 1
|
||||||
@@ -120,8 +120,8 @@
|
|||||||
- order_info_1.account_uri == account.account_uri
|
- order_info_1.account_uri == account.account_uri
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create HTTP challenges"
|
- name: "({{ select_crypto_backend }}) Create HTTP challenges"
|
||||||
uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ acme_host }}:5000/http/{{ item.identifier }}/{{ item.challenges['http-01'].resource[('.well-known/acme-challenge/'|length):] }}"
|
url: "http://{{ acme_host }}:5000/http/{{ item.identifier }}/{{ item.challenges['http-01'].resource[('.well-known/acme-challenge/' | length) :] }}"
|
||||||
method: PUT
|
method: PUT
|
||||||
body_format: raw
|
body_format: raw
|
||||||
body: "{{ item.challenges['http-01'].resource_value }}"
|
body: "{{ item.challenges['http-01'].resource_value }}"
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
register: validate_1
|
register: validate_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check validation result"
|
- name: "({{ select_crypto_backend }}) Check validation result"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- validate_1 is changed
|
- validate_1 is changed
|
||||||
- validate_1.account_uri == account.account_uri
|
- validate_1.account_uri == account.account_uri
|
||||||
@@ -153,7 +153,7 @@
|
|||||||
when: ansible_version.full is version('2.12', '<')
|
when: ansible_version.full is version('2.12', '<')
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get order information"
|
- name: "({{ select_crypto_backend }}) Get order information"
|
||||||
acme_certificate_order_info:
|
community.crypto.acme_certificate_order_info:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -163,11 +163,11 @@
|
|||||||
register: order_info_2
|
register: order_info_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Show order information"
|
- name: "({{ select_crypto_backend }}) Show order information"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_info_2
|
var: order_info_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check order information"
|
- name: "({{ select_crypto_backend }}) Check order information"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order_info_2 is not changed
|
- order_info_2 is not changed
|
||||||
- order_info_2.authorizations_by_identifier | length == 1
|
- order_info_2.authorizations_by_identifier | length == 1
|
||||||
@@ -203,7 +203,7 @@
|
|||||||
register: validate_2
|
register: validate_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check validation result"
|
- name: "({{ select_crypto_backend }}) Check validation result"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- validate_2 is not changed
|
- validate_2 is not changed
|
||||||
- validate_2.account_uri == account.account_uri
|
- validate_2.account_uri == account.account_uri
|
||||||
@@ -225,7 +225,7 @@
|
|||||||
register: finalize_1
|
register: finalize_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check finalization result"
|
- name: "({{ select_crypto_backend }}) Check finalization result"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- finalize_1 is changed
|
- finalize_1 is changed
|
||||||
- finalize_1.account_uri == account.account_uri
|
- finalize_1.account_uri == account.account_uri
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
- finalize_1.selected_chain.full_chain == finalize_1.selected_chain.cert + finalize_1.selected_chain.chain
|
- finalize_1.selected_chain.full_chain == finalize_1.selected_chain.cert + finalize_1.selected_chain.chain
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Read files from disk"
|
- name: "({{ select_crypto_backend }}) Read files from disk"
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
src: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
||||||
loop:
|
loop:
|
||||||
- cert
|
- cert
|
||||||
@@ -245,14 +245,14 @@
|
|||||||
register: slurp
|
register: slurp
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Compare finalization result with files on disk"
|
- name: "({{ select_crypto_backend }}) Compare finalization result with files on disk"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- finalize_1.selected_chain.cert == slurp.results[0].content | b64decode
|
- finalize_1.selected_chain.cert == slurp.results[0].content | b64decode
|
||||||
- finalize_1.selected_chain.chain == slurp.results[1].content | b64decode
|
- finalize_1.selected_chain.chain == slurp.results[1].content | b64decode
|
||||||
- finalize_1.selected_chain.full_chain == slurp.results[2].content | b64decode
|
- finalize_1.selected_chain.full_chain == slurp.results[2].content | b64decode
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get order information"
|
- name: "({{ select_crypto_backend }}) Get order information"
|
||||||
acme_certificate_order_info:
|
community.crypto.acme_certificate_order_info:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -262,11 +262,11 @@
|
|||||||
register: order_info_3
|
register: order_info_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Show order information"
|
- name: "({{ select_crypto_backend }}) Show order information"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_info_3
|
var: order_info_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check order information"
|
- name: "({{ select_crypto_backend }}) Check order information"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order_info_3 is not changed
|
- order_info_3 is not changed
|
||||||
- order_info_3.authorizations_by_identifier['dns:' ~ domain_name].identifier.type == 'dns'
|
- order_info_3.authorizations_by_identifier['dns:' ~ domain_name].identifier.type == 'dns'
|
||||||
@@ -304,7 +304,7 @@
|
|||||||
register: finalize_2
|
register: finalize_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check finalization result"
|
- name: "({{ select_crypto_backend }}) Check finalization result"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- finalize_2 is not changed
|
- finalize_2 is not changed
|
||||||
- finalize_2.account_uri == account.account_uri
|
- finalize_2.account_uri == account.account_uri
|
||||||
@@ -316,7 +316,7 @@
|
|||||||
- finalize_2.selected_chain == finalize_1.selected_chain
|
- finalize_2.selected_chain == finalize_1.selected_chain
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get order information"
|
- name: "({{ select_crypto_backend }}) Get order information"
|
||||||
acme_certificate_order_info:
|
community.crypto.acme_certificate_order_info:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -326,11 +326,11 @@
|
|||||||
register: order_info_4
|
register: order_info_4
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Show order information"
|
- name: "({{ select_crypto_backend }}) Show order information"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: order_info_4
|
var: order_info_4
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check order information"
|
- name: "({{ select_crypto_backend }}) Check order information"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order_info_4 is not changed
|
- order_info_4 is not changed
|
||||||
- order_info_4.authorizations_by_identifier['dns:' ~ domain_name].identifier.type == 'dns'
|
- order_info_4.authorizations_by_identifier['dns:' ~ domain_name].identifier.type == 'dns'
|
||||||
@@ -356,7 +356,7 @@
|
|||||||
- when: acme_supports_ari
|
- when: acme_supports_ari
|
||||||
block:
|
block:
|
||||||
- name: "({{ select_crypto_backend }}) Get certificate renewal information"
|
- name: "({{ select_crypto_backend }}) Get certificate renewal information"
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -366,14 +366,14 @@
|
|||||||
register: cert_info
|
register: cert_info
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Verify information"
|
- name: "({{ select_crypto_backend }}) Verify information"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_info.supports_ari == true
|
- cert_info.supports_ari == true
|
||||||
- cert_info.should_renew == false
|
- cert_info.should_renew == false
|
||||||
- cert_info.cert_id is string
|
- cert_info.cert_id is string
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create replacement order 1"
|
- name: "({{ select_crypto_backend }}) Create replacement order 1"
|
||||||
acme_certificate_order_create:
|
community.crypto.acme_certificate_order_create:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -386,7 +386,7 @@
|
|||||||
register: replacement_order_1
|
register: replacement_order_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get replacement order 1 information"
|
- name: "({{ select_crypto_backend }}) Get replacement order 1 information"
|
||||||
acme_certificate_order_info:
|
community.crypto.acme_certificate_order_info:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -396,7 +396,7 @@
|
|||||||
register: order_info_5
|
register: order_info_5
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check replacement order 1"
|
- name: "({{ select_crypto_backend }}) Check replacement order 1"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- replacement_order_1 is changed
|
- replacement_order_1 is changed
|
||||||
- replacement_order_1.order_uri.startswith('https://' ~ acme_host ~ ':14000/')
|
- replacement_order_1.order_uri.startswith('https://' ~ acme_host ~ ':14000/')
|
||||||
@@ -417,7 +417,7 @@
|
|||||||
- replacement_order_1.order_uri not in [order_1.order_uri]
|
- replacement_order_1.order_uri not in [order_1.order_uri]
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check replacement order 1 information"
|
- name: "({{ select_crypto_backend }}) Check replacement order 1 information"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order_info_5 is not changed
|
- order_info_5 is not changed
|
||||||
- order_info_5.authorizations_by_identifier | length == 1
|
- order_info_5.authorizations_by_identifier | length == 1
|
||||||
@@ -446,7 +446,7 @@
|
|||||||
- when: false # TODO get Pebble improved
|
- when: false # TODO get Pebble improved
|
||||||
block:
|
block:
|
||||||
- name: "({{ select_crypto_backend }}) Create replacement order 2 (should fail)"
|
- name: "({{ select_crypto_backend }}) Create replacement order 2 (should fail)"
|
||||||
acme_certificate_order_create:
|
community.crypto.acme_certificate_order_create:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -459,7 +459,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check replacement order 2"
|
- name: "({{ select_crypto_backend }}) Check replacement order 2"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- replacement_order_2 is failed
|
- replacement_order_2 is failed
|
||||||
- >-
|
- >-
|
||||||
@@ -470,7 +470,7 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create replacement order 3 with error handling"
|
- name: "({{ select_crypto_backend }}) Create replacement order 3 with error handling"
|
||||||
acme_certificate_order_create:
|
community.crypto.acme_certificate_order_create:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -482,7 +482,7 @@
|
|||||||
register: replacement_order_3
|
register: replacement_order_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get replacement order 3 information"
|
- name: "({{ select_crypto_backend }}) Get replacement order 3 information"
|
||||||
acme_certificate_order_info:
|
community.crypto.acme_certificate_order_info:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -492,7 +492,7 @@
|
|||||||
register: order_info_6
|
register: order_info_6
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check replacement order 3"
|
- name: "({{ select_crypto_backend }}) Check replacement order 3"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- replacement_order_3 is changed
|
- replacement_order_3 is changed
|
||||||
- replacement_order_3.order_uri.startswith('https://' ~ acme_host ~ ':14000/')
|
- replacement_order_3.order_uri.startswith('https://' ~ acme_host ~ ':14000/')
|
||||||
@@ -515,7 +515,7 @@
|
|||||||
('Stop passing `replaces=' ~ cert_info.cert_id ~ '` due to error 409 urn:ietf:params:acme:error:malformed when creating ACME order') in replacement_order_3.warnings
|
('Stop passing `replaces=' ~ cert_info.cert_id ~ '` due to error 409 urn:ietf:params:acme:error:malformed when creating ACME order') in replacement_order_3.warnings
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check replacement order 3 information"
|
- name: "({{ select_crypto_backend }}) Check replacement order 3 information"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order_info_6 is not changed
|
- order_info_6 is not changed
|
||||||
- order_info_6.authorizations_by_identifier | length == 1
|
- order_info_6.authorizations_by_identifier | length == 1
|
||||||
@@ -540,7 +540,7 @@
|
|||||||
- order_info_6.account_uri == account.account_uri
|
- order_info_6.account_uri == account.account_uri
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Deactivate authzs for replacement order 3"
|
- name: "({{ select_crypto_backend }}) Deactivate authzs for replacement order 3"
|
||||||
acme_certificate_deactivate_authz:
|
community.crypto.acme_certificate_deactivate_authz:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -551,8 +551,8 @@
|
|||||||
# Complete replacement order 1
|
# Complete replacement order 1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create HTTP challenges (replacement order 1)"
|
- name: "({{ select_crypto_backend }}) Create HTTP challenges (replacement order 1)"
|
||||||
uri:
|
ansible.builtin.uri:
|
||||||
url: "http://{{ acme_host }}:5000/http/{{ item.identifier }}/{{ item.challenges['http-01'].resource[('.well-known/acme-challenge/'|length):] }}"
|
url: "http://{{ acme_host }}:5000/http/{{ item.identifier }}/{{ item.challenges['http-01'].resource[('.well-known/acme-challenge/' | length) :] }}"
|
||||||
method: PUT
|
method: PUT
|
||||||
body_format: raw
|
body_format: raw
|
||||||
body: "{{ item.challenges['http-01'].resource_value }}"
|
body: "{{ item.challenges['http-01'].resource_value }}"
|
||||||
@@ -590,7 +590,7 @@
|
|||||||
- when: true
|
- when: true
|
||||||
block:
|
block:
|
||||||
- name: "({{ select_crypto_backend }}) Create replacement order 4 (should fail)"
|
- name: "({{ select_crypto_backend }}) Create replacement order 4 (should fail)"
|
||||||
acme_certificate_order_create:
|
community.crypto.acme_certificate_order_create:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -603,7 +603,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check replacement order 4"
|
- name: "({{ select_crypto_backend }}) Check replacement order 4"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- replacement_order_4 is failed
|
- replacement_order_4 is failed
|
||||||
- replacement_order_4.msg.startswith('Failed to start new order for https://' ~ acme_host)
|
- replacement_order_4.msg.startswith('Failed to start new order for https://' ~ acme_host)
|
||||||
@@ -611,7 +611,7 @@
|
|||||||
' with status 409 Conflict. Error urn:ietf:params:acme:error:malformed: ' in replacement_order_4.msg
|
' with status 409 Conflict. Error urn:ietf:params:acme:error:malformed: ' in replacement_order_4.msg
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create replacement order 5 with error handling"
|
- name: "({{ select_crypto_backend }}) Create replacement order 5 with error handling"
|
||||||
acme_certificate_order_create:
|
community.crypto.acme_certificate_order_create:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -623,7 +623,7 @@
|
|||||||
register: replacement_order_5
|
register: replacement_order_5
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get replacement order 5 information"
|
- name: "({{ select_crypto_backend }}) Get replacement order 5 information"
|
||||||
acme_certificate_order_info:
|
community.crypto.acme_certificate_order_info:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -633,7 +633,7 @@
|
|||||||
register: order_info_7
|
register: order_info_7
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check replacement order 5"
|
- name: "({{ select_crypto_backend }}) Check replacement order 5"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- replacement_order_5 is changed
|
- replacement_order_5 is changed
|
||||||
- replacement_order_5.order_uri.startswith('https://' ~ acme_host ~ ':14000/')
|
- replacement_order_5.order_uri.startswith('https://' ~ acme_host ~ ':14000/')
|
||||||
@@ -656,7 +656,7 @@
|
|||||||
('Stop passing `replaces=' ~ cert_info.cert_id ~ '` due to error 409 urn:ietf:params:acme:error:malformed when creating ACME order') in replacement_order_5.warnings
|
('Stop passing `replaces=' ~ cert_info.cert_id ~ '` due to error 409 urn:ietf:params:acme:error:malformed when creating ACME order') in replacement_order_5.warnings
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check replacement order 5 information"
|
- name: "({{ select_crypto_backend }}) Check replacement order 5 information"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order_info_7 is not changed
|
- order_info_7 is not changed
|
||||||
- order_info_7.authorizations_by_identifier | length == 1
|
- order_info_7.authorizations_by_identifier | length == 1
|
||||||
@@ -681,7 +681,7 @@
|
|||||||
- order_info_7.account_uri == account.account_uri
|
- order_info_7.account_uri == account.account_uri
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Deactivate authzs for replacement order 5"
|
- name: "({{ select_crypto_backend }}) Deactivate authzs for replacement order 5"
|
||||||
acme_certificate_deactivate_authz:
|
community.crypto.acme_certificate_deactivate_authz:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -694,7 +694,7 @@
|
|||||||
- when: acme_supports_profiles
|
- when: acme_supports_profiles
|
||||||
block:
|
block:
|
||||||
- name: "({{ select_crypto_backend }}) Create order with invalid profile (should fail)"
|
- name: "({{ select_crypto_backend }}) Create order with invalid profile (should fail)"
|
||||||
acme_certificate_order_create:
|
community.crypto.acme_certificate_order_create:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -707,7 +707,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check invalid profile order"
|
- name: "({{ select_crypto_backend }}) Check invalid profile order"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- invalid_profile_order is failed
|
- invalid_profile_order is failed
|
||||||
- invalid_profile_order.msg == "The ACME CA does not support selected profile 'does-not-exist'."
|
- invalid_profile_order.msg == "The ACME CA does not support selected profile 'does-not-exist'."
|
||||||
@@ -717,7 +717,7 @@
|
|||||||
- when: not acme_supports_profiles
|
- when: not acme_supports_profiles
|
||||||
block:
|
block:
|
||||||
- name: "({{ select_crypto_backend }}) Create order with profile when server does not support it (should fail)"
|
- name: "({{ select_crypto_backend }}) Create order with profile when server does not support it (should fail)"
|
||||||
acme_certificate_order_create:
|
community.crypto.acme_certificate_order_create:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -729,7 +729,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check profile without server support order"
|
- name: "({{ select_crypto_backend }}) Check profile without server support order"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- profile_without_server_support is failed
|
- profile_without_server_support is failed
|
||||||
- profile_without_server_support.msg == 'The ACME CA does not support profiles. Please omit the "profile" option.'
|
- profile_without_server_support.msg == 'The ACME CA does not support profiles. Please omit the "profile" option.'
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
|
|
||||||
@@ -18,18 +18,18 @@
|
|||||||
when: openssl_version.stdout is version('1.0.0', '>=')
|
when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
## SET UP ACCOUNT KEYS ########################################################################
|
## SET UP ACCOUNT KEYS ########################################################################
|
||||||
- block:
|
- block:
|
||||||
- name: Generate account keys
|
- name: Generate account keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
||||||
type: "{{ item.type }}"
|
type: "{{ item.type }}"
|
||||||
size: "{{ item.size | default(omit) }}"
|
size: "{{ item.size | default(omit) }}"
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
## CREATE ACCOUNTS AND OBTAIN CERTIFICATES ####################################################
|
## CREATE ACCOUNTS AND OBTAIN CERTIFICATES ####################################################
|
||||||
- name: Obtain cert 1
|
- name: Obtain cert 1
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 1 for renewal check
|
certgen_title: Certificate 1 for renewal check
|
||||||
certificate_name: cert-1
|
certificate_name: cert-1
|
||||||
@@ -41,18 +41,18 @@
|
|||||||
|
|
||||||
## OBTAIN CERTIFICATE INFOS ###################################################################
|
## OBTAIN CERTIFICATE INFOS ###################################################################
|
||||||
- name: Dump OpenSSL x509 info
|
- name: Dump OpenSSL x509 info
|
||||||
command:
|
ansible.builtin.command:
|
||||||
cmd: openssl x509 -in {{ remote_tmp_dir }}/cert-1.pem -noout -text
|
cmd: openssl x509 -in {{ remote_tmp_dir }}/cert-1.pem -noout -text
|
||||||
- name: Obtain certificate information
|
- name: Obtain certificate information
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: "{{ remote_tmp_dir }}/cert-1.pem"
|
path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
register: cert_1_info
|
register: cert_1_info
|
||||||
- name: Read certificate
|
- name: Read certificate
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/cert-1.pem'
|
src: '{{ remote_tmp_dir }}/cert-1.pem'
|
||||||
register: slurp_cert_1
|
register: slurp_cert_1
|
||||||
- name: Obtain certificate information (1/11)
|
- name: Obtain certificate information (1/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
register: cert_1_renewal_1
|
register: cert_1_renewal_1
|
||||||
- name: Obtain certificate information (2/11)
|
- name: Obtain certificate information (2/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
remaining_percentage: 0.5
|
remaining_percentage: 0.5
|
||||||
register: cert_1_renewal_2
|
register: cert_1_renewal_2
|
||||||
- name: Obtain certificate information (3/11)
|
- name: Obtain certificate information (3/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_content: "{{ slurp_cert_1.content | b64decode }}"
|
certificate_content: "{{ slurp_cert_1.content | b64decode }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
now: +1800d
|
now: +1800d
|
||||||
register: cert_1_renewal_3
|
register: cert_1_renewal_3
|
||||||
- name: Obtain certificate information (4/11)
|
- name: Obtain certificate information (4/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
remaining_percentage: 0.1
|
remaining_percentage: 0.1
|
||||||
register: cert_1_renewal_4
|
register: cert_1_renewal_4
|
||||||
- name: Obtain certificate information (5/11)
|
- name: Obtain certificate information (5/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
remaining_percentage: 0.01
|
remaining_percentage: 0.01
|
||||||
register: cert_1_renewal_5
|
register: cert_1_renewal_5
|
||||||
- name: Obtain certificate information (6/11)
|
- name: Obtain certificate information (6/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
remaining_percentage: 0.03
|
remaining_percentage: 0.03
|
||||||
register: cert_1_renewal_6
|
register: cert_1_renewal_6
|
||||||
- name: Obtain certificate information (7/11)
|
- name: Obtain certificate information (7/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
now: +1830d
|
now: +1830d
|
||||||
register: cert_1_renewal_7
|
register: cert_1_renewal_7
|
||||||
- name: Obtain certificate information (8/11)
|
- name: Obtain certificate information (8/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
now: +1830d
|
now: +1830d
|
||||||
register: cert_1_renewal_8
|
register: cert_1_renewal_8
|
||||||
- name: Obtain certificate information (9/11)
|
- name: Obtain certificate information (9/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-does-not-exist.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-does-not-exist.pem"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
@@ -137,12 +137,12 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
register: cert_1_renewal_9
|
register: cert_1_renewal_9
|
||||||
- name: Create broken file
|
- name: Create broken file
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
dest: "{{ remote_tmp_dir }}/cert-is-broken.pem"
|
dest: "{{ remote_tmp_dir }}/cert-is-broken.pem"
|
||||||
content: |
|
content: |
|
||||||
--- THIS IS NOT A CERT ---
|
--- THIS IS NOT A CERT ---
|
||||||
- name: Obtain certificate information (10/11)
|
- name: Obtain certificate information (10/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
treat_parsing_error_as_non_existing: false
|
treat_parsing_error_as_non_existing: false
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-is-broken.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-is-broken.pem"
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
register: cert_1_renewal_10
|
register: cert_1_renewal_10
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- name: Obtain certificate information (11/11)
|
- name: Obtain certificate information (11/11)
|
||||||
acme_certificate_renewal_info:
|
community.crypto.acme_certificate_renewal_info:
|
||||||
treat_parsing_error_as_non_existing: true
|
treat_parsing_error_as_non_existing: true
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
certificate_path: "{{ remote_tmp_dir }}/cert-is-broken.pem"
|
certificate_path: "{{ remote_tmp_dir }}/cert-is-broken.pem"
|
||||||
|
|||||||
@@ -13,31 +13,31 @@
|
|||||||
block:
|
block:
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
||||||
when: openssl_version.stdout is version('1.0.0', '>=')
|
when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.5', '>=')
|
when: cryptography_version.stdout is version('1.5', '>=')
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
block:
|
block:
|
||||||
|
|
||||||
- name: Validate results (generic)
|
- name: Validate results (generic)
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_1_renewal_1.should_renew == false
|
- cert_1_renewal_1.should_renew == false
|
||||||
- cert_1_renewal_1.msg == 'The certificate is still valid and no condition was reached'
|
- cert_1_renewal_1.msg == 'The certificate is still valid and no condition was reached'
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
when: not acme_supports_ari
|
when: not acme_supports_ari
|
||||||
|
|
||||||
- name: Validate results without ARI
|
- name: Validate results without ARI
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_1_renewal_1.supports_ari == false
|
- cert_1_renewal_1.supports_ari == false
|
||||||
- cert_1_renewal_2.supports_ari == false
|
- cert_1_renewal_2.supports_ari == false
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
when: not acme_supports_ari
|
when: not acme_supports_ari
|
||||||
|
|
||||||
- name: Validate results with ARI
|
- name: Validate results with ARI
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_1_renewal_1.supports_ari == true
|
- cert_1_renewal_1.supports_ari == true
|
||||||
- cert_1_renewal_2.supports_ari == true
|
- cert_1_renewal_2.supports_ari == true
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
## SET UP ACCOUNT KEYS ########################################################################
|
## SET UP ACCOUNT KEYS ########################################################################
|
||||||
- block:
|
- block:
|
||||||
- name: Generate account keys
|
- name: Generate account keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item.name }}.pem"
|
||||||
type: "{{ item.type }}"
|
type: "{{ item.type }}"
|
||||||
size: "{{ item.size | default(omit) }}"
|
size: "{{ item.size | default(omit) }}"
|
||||||
@@ -28,11 +28,11 @@
|
|||||||
|
|
||||||
## CREATE ACCOUNTS AND OBTAIN CERTIFICATES ####################################################
|
## CREATE ACCOUNTS AND OBTAIN CERTIFICATES ####################################################
|
||||||
- name: Read account key (EC256)
|
- name: Read account key (EC256)
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/account-ec256.pem'
|
src: '{{ remote_tmp_dir }}/account-ec256.pem'
|
||||||
register: slurp_account_key
|
register: slurp_account_key
|
||||||
- name: Obtain cert 1
|
- name: Obtain cert 1
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 1 for revocation
|
certgen_title: Certificate 1 for revocation
|
||||||
certificate_name: cert-1
|
certificate_name: cert-1
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
terms_agreed: true
|
terms_agreed: true
|
||||||
account_email: "example@example.org"
|
account_email: "example@example.org"
|
||||||
- name: Obtain cert 2
|
- name: Obtain cert 2
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 2 for revocation
|
certgen_title: Certificate 2 for revocation
|
||||||
certificate_name: cert-2
|
certificate_name: cert-2
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
terms_agreed: true
|
terms_agreed: true
|
||||||
account_email: "example@example.org"
|
account_email: "example@example.org"
|
||||||
- name: Obtain cert 3
|
- name: Obtain cert 3
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
certgen_title: Certificate 3 for revocation
|
certgen_title: Certificate 3 for revocation
|
||||||
certificate_name: cert-3
|
certificate_name: cert-3
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
## REVOKE CERTIFICATES ########################################################################
|
## REVOKE CERTIFICATES ########################################################################
|
||||||
- name: Revoke certificate 1 via account key
|
- name: Revoke certificate 1 via account key
|
||||||
acme_certificate_revoke:
|
community.crypto.acme_certificate_revoke:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
account_key_src: "{{ remote_tmp_dir }}/account-ec256.pem"
|
||||||
certificate: "{{ remote_tmp_dir }}/cert-1.pem"
|
certificate: "{{ remote_tmp_dir }}/cert-1.pem"
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_1_revoke
|
register: cert_1_revoke
|
||||||
- name: Revoke certificate 2 via certificate private key
|
- name: Revoke certificate 2 via certificate private key
|
||||||
acme_certificate_revoke:
|
community.crypto.acme_certificate_revoke:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
private_key_src: "{{ remote_tmp_dir }}/cert-2.key"
|
private_key_src: "{{ remote_tmp_dir }}/cert-2.key"
|
||||||
private_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
private_key_passphrase: "{{ 'hunter2' if select_crypto_backend != 'openssl' else omit }}"
|
||||||
@@ -105,11 +105,11 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: cert_2_revoke
|
register: cert_2_revoke
|
||||||
- name: Read account key (RSA)
|
- name: Read account key (RSA)
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/account-rsa.pem'
|
src: '{{ remote_tmp_dir }}/account-rsa.pem'
|
||||||
register: slurp_account_key
|
register: slurp_account_key
|
||||||
- name: Revoke certificate 3 via account key (fullchain)
|
- name: Revoke certificate 3 via account key (fullchain)
|
||||||
acme_certificate_revoke:
|
community.crypto.acme_certificate_revoke:
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
account_key_content: "{{ slurp_account_key.content | b64decode }}"
|
account_key_content: "{{ slurp_account_key.content | b64decode }}"
|
||||||
certificate: "{{ remote_tmp_dir }}/cert-3-fullchain.pem"
|
certificate: "{{ remote_tmp_dir }}/cert-3-fullchain.pem"
|
||||||
|
|||||||
@@ -10,31 +10,31 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
||||||
when: openssl_version.stdout is version('1.0.0', '>=')
|
when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.5', '>=')
|
when: cryptography_version.stdout is version('1.5', '>=')
|
||||||
|
|||||||
@@ -4,17 +4,17 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Check that certificate 1 was revoked
|
- name: Check that certificate 1 was revoked
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_1_revoke is changed
|
- cert_1_revoke is changed
|
||||||
- cert_1_revoke is not failed
|
- cert_1_revoke is not failed
|
||||||
- name: Check that certificate 2 was revoked
|
- name: Check that certificate 2 was revoked
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_2_revoke is changed
|
- cert_2_revoke is changed
|
||||||
- cert_2_revoke is not failed
|
- cert_2_revoke is not failed
|
||||||
- name: Check that certificate 3 was revoked
|
- name: Check that certificate 3 was revoked
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert_3_revoke is changed
|
- cert_3_revoke is changed
|
||||||
- cert_3_revoke is not failed
|
- cert_3_revoke is not failed
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Generate ECC256 account keys
|
- name: Generate ECC256 account keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/account-ec256.pem"
|
path: "{{ remote_tmp_dir }}/account-ec256.pem"
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
force: true
|
force: true
|
||||||
- name: Obtain cert 1
|
- name: Obtain cert 1
|
||||||
include_tasks: obtain-cert.yml
|
ansible.builtin.include_tasks: obtain-cert.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: auto
|
select_crypto_backend: auto
|
||||||
certgen_title: Certificate 1
|
certgen_title: Certificate 1
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Generate account keys
|
- name: Generate account keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
loop: "{{ account_keys }}"
|
loop: "{{ account_keys }}"
|
||||||
|
|
||||||
- name: Parse account keys (to ease debugging some test failures)
|
- name: Parse account keys (to ease debugging some test failures)
|
||||||
openssl_privatekey_info:
|
community.crypto.openssl_privatekey_info:
|
||||||
path: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
path: "{{ remote_tmp_dir }}/{{ item }}.pem"
|
||||||
return_private_key_data: true
|
return_private_key_data: true
|
||||||
loop: "{{ account_keys }}"
|
loop: "{{ account_keys }}"
|
||||||
@@ -23,32 +23,32 @@
|
|||||||
- accountkey
|
- accountkey
|
||||||
|
|
||||||
- name: Get directory
|
- name: Get directory
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
method: directory-only
|
method: directory-only
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: directory
|
register: directory
|
||||||
- debug: var=directory
|
- ansible.builtin.debug: var=directory
|
||||||
|
|
||||||
- name: Create an account
|
- name: Create an account
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
|
||||||
url: "{{ directory.directory.newAccount}}"
|
url: "{{ directory.directory.newAccount }}"
|
||||||
method: post
|
method: post
|
||||||
content: '{"termsOfServiceAgreed":true}'
|
content: '{"termsOfServiceAgreed":true}'
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: account_creation
|
register: account_creation
|
||||||
# account_creation.headers.location contains the account URI
|
# account_creation.headers.location contains the account URI
|
||||||
# if creation was successful
|
# if creation was successful
|
||||||
- debug: var=account_creation
|
- ansible.builtin.debug: var=account_creation
|
||||||
|
|
||||||
- name: Get account information
|
- name: Get account information
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -58,10 +58,10 @@
|
|||||||
method: get
|
method: get
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: account_get
|
register: account_get
|
||||||
- debug: var=account_get
|
- ansible.builtin.debug: var=account_get
|
||||||
|
|
||||||
- name: Update account contacts
|
- name: Update account contacts
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -78,10 +78,10 @@
|
|||||||
contact:
|
contact:
|
||||||
- mailto:me@example.com
|
- mailto:me@example.com
|
||||||
register: account_update
|
register: account_update
|
||||||
- debug: var=account_update
|
- ansible.builtin.debug: var=account_update
|
||||||
|
|
||||||
- name: Create certificate order
|
- name: Create certificate order
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -102,10 +102,10 @@
|
|||||||
- type: dns
|
- type: dns
|
||||||
value: example.org
|
value: example.org
|
||||||
register: new_order
|
register: new_order
|
||||||
- debug: var=new_order
|
- ansible.builtin.debug: var=new_order
|
||||||
|
|
||||||
- name: Get order information
|
- name: Get order information
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -115,10 +115,10 @@
|
|||||||
method: get
|
method: get
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: order
|
register: order
|
||||||
- debug: var=order
|
- ansible.builtin.debug: var=order
|
||||||
|
|
||||||
- name: Get authzs for order
|
- name: Get authzs for order
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -129,10 +129,10 @@
|
|||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
loop: "{{ order.output_json.authorizations }}"
|
loop: "{{ order.output_json.authorizations }}"
|
||||||
register: authz
|
register: authz
|
||||||
- debug: var=authz
|
- ansible.builtin.debug: var=authz
|
||||||
|
|
||||||
- name: Get HTTP-01 challenge for authz
|
- name: Get HTTP-01 challenge for authz
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -143,10 +143,10 @@
|
|||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: http01challenge
|
register: http01challenge
|
||||||
loop: "{{ authz.results | map(attribute='output_json') | list }}"
|
loop: "{{ authz.results | map(attribute='output_json') | list }}"
|
||||||
- debug: var=http01challenge
|
- ansible.builtin.debug: var=http01challenge
|
||||||
|
|
||||||
- name: Activate HTTP-01 challenge manually
|
- name: Activate HTTP-01 challenge manually
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -158,10 +158,10 @@
|
|||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: activation
|
register: activation
|
||||||
loop: "{{ http01challenge.results | map(attribute='output_json') | list }}"
|
loop: "{{ http01challenge.results | map(attribute='output_json') | list }}"
|
||||||
- debug: var=activation
|
- ansible.builtin.debug: var=activation
|
||||||
|
|
||||||
- name: Get HTTP-01 challenge results
|
- name: Get HTTP-01 challenge results
|
||||||
acme_inspect:
|
community.crypto.acme_inspect:
|
||||||
acme_directory: "{{ acme_directory_url }}"
|
acme_directory: "{{ acme_directory_url }}"
|
||||||
acme_version: 2
|
acme_version: 2
|
||||||
validate_certs: false
|
validate_certs: false
|
||||||
@@ -175,4 +175,4 @@
|
|||||||
until: "validation_result.output_json.status not in ['pending', 'processing']"
|
until: "validation_result.output_json.status not in ['pending', 'processing']"
|
||||||
retries: 20
|
retries: 20
|
||||||
delay: 1
|
delay: 1
|
||||||
- debug: var=validation_result
|
- ansible.builtin.debug: var=validation_result
|
||||||
|
|||||||
@@ -10,31 +10,31 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
# Old 0.9.8 versions have insufficient CLI support for signing with EC keys
|
||||||
when: openssl_version.stdout is version('1.0.0', '>=')
|
when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.5', '>=')
|
when: cryptography_version.stdout is version('1.5', '>=')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Check directory output
|
- name: Check directory output
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- directory is not changed
|
- directory is not changed
|
||||||
- "'directory' in directory"
|
- "'directory' in directory"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
- "'output_json' not in directory"
|
- "'output_json' not in directory"
|
||||||
|
|
||||||
- name: Check account creation output
|
- name: Check account creation output
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_creation is changed
|
- account_creation is changed
|
||||||
- "'directory' in account_creation"
|
- "'directory' in account_creation"
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
- account_creation.output_text | from_json == account_creation.output_json
|
- account_creation.output_text | from_json == account_creation.output_json
|
||||||
|
|
||||||
- name: Check account get output
|
- name: Check account get output
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_get is not changed
|
- account_get is not changed
|
||||||
- "'directory' in account_get"
|
- "'directory' in account_get"
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
- account_get.output_json == account_creation.output_json
|
- account_get.output_json == account_creation.output_json
|
||||||
|
|
||||||
- name: Check account update output
|
- name: Check account update output
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- account_update is changed
|
- account_update is changed
|
||||||
- "'directory' in account_update"
|
- "'directory' in account_update"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
- account_update.output_json.contact[0] in ['mailto:me@example.com', 'mailto:*******@example.com']
|
- account_update.output_json.contact[0] in ['mailto:me@example.com', 'mailto:*******@example.com']
|
||||||
|
|
||||||
- name: Check certificate request output
|
- name: Check certificate request output
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- new_order is changed
|
- new_order is changed
|
||||||
- "'directory' in new_order"
|
- "'directory' in new_order"
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
- "'finalize' in new_order.output_json"
|
- "'finalize' in new_order.output_json"
|
||||||
|
|
||||||
- name: Check get order output
|
- name: Check get order output
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- order is not changed
|
- order is not changed
|
||||||
- "'directory' in order"
|
- "'directory' in order"
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
# - new_order.output_json == order.output_json
|
# - new_order.output_json == order.output_json
|
||||||
|
|
||||||
- name: Check get authz output
|
- name: Check get authz output
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- item is not changed
|
- item is not changed
|
||||||
- "'directory' in item"
|
- "'directory' in item"
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
loop: "{{ authz.results }}"
|
loop: "{{ authz.results }}"
|
||||||
|
|
||||||
- name: Check get challenge output
|
- name: Check get challenge output
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- item is not changed
|
- item is not changed
|
||||||
- "'directory' in item"
|
- "'directory' in item"
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
loop: "{{ http01challenge.results }}"
|
loop: "{{ http01challenge.results }}"
|
||||||
|
|
||||||
- name: Check challenge activation output
|
- name: Check challenge activation output
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- item is changed
|
- item is changed
|
||||||
- "'directory' in item"
|
- "'directory' in item"
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
loop: "{{ activation.results }}"
|
loop: "{{ activation.results }}"
|
||||||
|
|
||||||
- name: Check validation result
|
- name: Check validation result
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- item is not changed
|
- item is not changed
|
||||||
- "'directory' in item"
|
- "'directory' in item"
|
||||||
|
|||||||
@@ -9,14 +9,14 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Generate CSR for {{ certificate.name }}
|
- name: Generate CSR for {{ certificate.name }}
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/{{ certificate.name }}.csr'
|
path: '{{ remote_tmp_dir }}/{{ certificate.name }}.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/{{ certificate.name }}.key'
|
privatekey_path: '{{ remote_tmp_dir }}/{{ certificate.name }}.key'
|
||||||
subject: '{{ certificate.subject }}'
|
subject: '{{ certificate.subject }}'
|
||||||
useCommonNameForSAN: false
|
useCommonNameForSAN: false
|
||||||
|
|
||||||
- name: Generate certificate for {{ certificate.name }}
|
- name: Generate certificate for {{ certificate.name }}
|
||||||
x509_certificate:
|
community.crypto.x509_certificate:
|
||||||
path: '{{ remote_tmp_dir }}/{{ certificate.name }}.pem'
|
path: '{{ remote_tmp_dir }}/{{ certificate.name }}.pem'
|
||||||
csr_path: '{{ remote_tmp_dir }}/{{ certificate.name }}.csr'
|
csr_path: '{{ remote_tmp_dir }}/{{ certificate.name }}.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/{{ certificate.name }}.key'
|
privatekey_path: '{{ remote_tmp_dir }}/{{ certificate.name }}.key'
|
||||||
|
|||||||
@@ -10,25 +10,25 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Create private keys
|
- name: Create private keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/{{ item.name }}.key'
|
path: '{{ remote_tmp_dir }}/{{ item.name }}.key'
|
||||||
size: '{{ default_rsa_key_size_certificates }}'
|
size: '{{ default_rsa_key_size_certificates }}'
|
||||||
loop: '{{ certificates }}'
|
loop: '{{ certificates }}'
|
||||||
|
|
||||||
- name: Generate certificates
|
- name: Generate certificates
|
||||||
include_tasks: create-single-certificate.yml
|
ansible.builtin.include_tasks: create-single-certificate.yml
|
||||||
loop: '{{ certificates }}'
|
loop: '{{ certificates }}'
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: certificate
|
loop_var: certificate
|
||||||
|
|
||||||
- name: Read certificates
|
- name: Read certificates
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/{{ item.name }}.pem'
|
src: '{{ remote_tmp_dir }}/{{ item.name }}.pem'
|
||||||
loop: '{{ certificates }}'
|
loop: '{{ certificates }}'
|
||||||
register: certificates_read
|
register: certificates_read
|
||||||
|
|
||||||
- name: Store read certificates
|
- name: Store read certificates
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
read_certificates: >-
|
read_certificates: >-
|
||||||
{{ certificates_read.results | map(attribute='content') | map('b64decode')
|
{{ certificates_read.results | map(attribute='content') | map('b64decode')
|
||||||
| zip(certificates | map(attribute='name'))
|
| zip(certificates | map(attribute='name'))
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Case A => works
|
- name: Case A => works
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: "{{ read_certificates['d-leaf'] }}"
|
input_chain: "{{ read_certificates['d-leaf'] }}"
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- '{{ remote_tmp_dir }}/b-intermediate.pem'
|
- '{{ remote_tmp_dir }}/b-intermediate.pem'
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
- name: Case B => doesn't work, but this is expected
|
- name: Case B => doesn't work, but this is expected
|
||||||
failed_when: false
|
failed_when: false
|
||||||
register: caseb
|
register: caseb
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: "{{ read_certificates['d-leaf'] }}"
|
input_chain: "{{ read_certificates['d-leaf'] }}"
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- '{{ remote_tmp_dir }}/c-intermediate.pem'
|
- '{{ remote_tmp_dir }}/c-intermediate.pem'
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
- '{{ remote_tmp_dir }}/a-root.pem'
|
- '{{ remote_tmp_dir }}/a-root.pem'
|
||||||
|
|
||||||
- name: Assert that case B failed
|
- name: Assert that case B failed
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that: "'Cannot complete chain' in caseb.msg"
|
that: "'Cannot complete chain' in caseb.msg"
|
||||||
|
|
||||||
- name: Case C => works
|
- name: Case C => works
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: "{{ read_certificates['d-leaf'] }}"
|
input_chain: "{{ read_certificates['d-leaf'] }}"
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- '{{ remote_tmp_dir }}/c-intermediate.pem'
|
- '{{ remote_tmp_dir }}/c-intermediate.pem'
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
- '{{ remote_tmp_dir }}/a-root.pem'
|
- '{{ remote_tmp_dir }}/a-root.pem'
|
||||||
|
|
||||||
- name: Case D => works as well after PR 403
|
- name: Case D => works as well after PR 403
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: "{{ read_certificates['d-leaf'] }}"
|
input_chain: "{{ read_certificates['d-leaf'] }}"
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- '{{ remote_tmp_dir }}/b-intermediate.pem'
|
- '{{ remote_tmp_dir }}/b-intermediate.pem'
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Find root for cert 1 using directory
|
- name: Find root for cert 1 using directory
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: '{{ fullchain | trim }}'
|
input_chain: '{{ fullchain | trim }}'
|
||||||
root_certificates:
|
root_certificates:
|
||||||
- '{{ remote_tmp_dir }}/files/roots/'
|
- '{{ remote_tmp_dir }}/files/roots/'
|
||||||
register: cert1_root
|
register: cert1_root
|
||||||
- name: Verify root for cert 1
|
- name: Verify root for cert 1
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert1_root.complete_chain | join('') == (fullchain ~ root)
|
- cert1_root.complete_chain | join('') == (fullchain ~ root)
|
||||||
- cert1_root.root == root
|
- cert1_root.root == root
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Find rootchain for cert 1 using intermediate and root PEM
|
- name: Find rootchain for cert 1 using intermediate and root PEM
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: '{{ cert }}'
|
input_chain: '{{ cert }}'
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- '{{ remote_tmp_dir }}/files/cert1-chain.pem'
|
- '{{ remote_tmp_dir }}/files/cert1-chain.pem'
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
- '{{ remote_tmp_dir }}/files/roots.pem'
|
- '{{ remote_tmp_dir }}/files/roots.pem'
|
||||||
register: cert1_rootchain
|
register: cert1_rootchain
|
||||||
- name: Verify rootchain for cert 1
|
- name: Verify rootchain for cert 1
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert1_rootchain.complete_chain | join('') == (cert ~ chain ~ root)
|
- cert1_rootchain.complete_chain | join('') == (cert ~ chain ~ root)
|
||||||
- cert1_rootchain.chain[:-1] | join('') == chain
|
- cert1_rootchain.chain[:-1] | join('') == chain
|
||||||
@@ -46,13 +46,13 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Find root for cert 2 using directory
|
- name: Find root for cert 2 using directory
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: "{{ fullchain | trim }}"
|
input_chain: "{{ fullchain | trim }}"
|
||||||
root_certificates:
|
root_certificates:
|
||||||
- '{{ remote_tmp_dir }}/files/roots/'
|
- '{{ remote_tmp_dir }}/files/roots/'
|
||||||
register: cert2_root
|
register: cert2_root
|
||||||
- name: Verify root for cert 2
|
- name: Verify root for cert 2
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert2_root.complete_chain | join('') == (fullchain ~ root)
|
- cert2_root.complete_chain | join('') == (fullchain ~ root)
|
||||||
- cert2_root.root == root
|
- cert2_root.root == root
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Find rootchain for cert 2 using intermediate and root PEM
|
- name: Find rootchain for cert 2 using intermediate and root PEM
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: '{{ cert }}'
|
input_chain: '{{ cert }}'
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- '{{ remote_tmp_dir }}/files/cert2-chain.pem'
|
- '{{ remote_tmp_dir }}/files/cert2-chain.pem'
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
- '{{ remote_tmp_dir }}/files/roots.pem'
|
- '{{ remote_tmp_dir }}/files/roots.pem'
|
||||||
register: cert2_rootchain
|
register: cert2_rootchain
|
||||||
- name: Verify rootchain for cert 2
|
- name: Verify rootchain for cert 2
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert2_rootchain.complete_chain | join('') == (cert ~ chain ~ root)
|
- cert2_rootchain.complete_chain | join('') == (cert ~ chain ~ root)
|
||||||
- cert2_rootchain.chain[:-1] | join('') == chain
|
- cert2_rootchain.chain[:-1] | join('') == chain
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Find alternate rootchain for cert 2 using intermediate and root PEM
|
- name: Find alternate rootchain for cert 2 using intermediate and root PEM
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: '{{ cert }}'
|
input_chain: '{{ cert }}'
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- '{{ remote_tmp_dir }}/files/cert2-altchain.pem'
|
- '{{ remote_tmp_dir }}/files/cert2-altchain.pem'
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
- '{{ remote_tmp_dir }}/files/roots.pem'
|
- '{{ remote_tmp_dir }}/files/roots.pem'
|
||||||
register: cert2_rootchain_alt
|
register: cert2_rootchain_alt
|
||||||
- name: Verify rootchain for cert 2
|
- name: Verify rootchain for cert 2
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert2_rootchain_alt.complete_chain | join('') == (cert ~ chain ~ root)
|
- cert2_rootchain_alt.complete_chain | join('') == (cert ~ chain ~ root)
|
||||||
- cert2_rootchain_alt.chain[:-1] | join('') == chain
|
- cert2_rootchain_alt.chain[:-1] | join('') == chain
|
||||||
@@ -102,13 +102,13 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Find alternate rootchain for cert 2 when complete chain is already presented to the module
|
- name: Find alternate rootchain for cert 2 when complete chain is already presented to the module
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: '{{ cert ~ chain ~ root }}'
|
input_chain: '{{ cert ~ chain ~ root }}'
|
||||||
root_certificates:
|
root_certificates:
|
||||||
- '{{ remote_tmp_dir }}/files/roots.pem'
|
- '{{ remote_tmp_dir }}/files/roots.pem'
|
||||||
register: cert2_complete_chain
|
register: cert2_complete_chain
|
||||||
- name: Verify rootchain for cert 2
|
- name: Verify rootchain for cert 2
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert2_complete_chain.complete_chain | join('') == (cert ~ chain ~ root)
|
- cert2_complete_chain.complete_chain | join('') == (cert ~ chain ~ root)
|
||||||
- cert2_complete_chain.chain == []
|
- cert2_complete_chain.chain == []
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
root: "{{ lookup('file', 'cert2-altroot.pem', rstrip=False) }}"
|
root: "{{ lookup('file', 'cert2-altroot.pem', rstrip=False) }}"
|
||||||
|
|
||||||
- name: Check failure when no intermediate certificate can be found
|
- name: Check failure when no intermediate certificate can be found
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: '{{ lookup("file", "cert2.pem", rstrip=true) }}'
|
input_chain: '{{ lookup("file", "cert2.pem", rstrip=true) }}'
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- '{{ remote_tmp_dir }}/files/cert1-chain.pem'
|
- '{{ remote_tmp_dir }}/files/cert1-chain.pem'
|
||||||
@@ -128,13 +128,13 @@
|
|||||||
register: cert2_no_intermediate
|
register: cert2_no_intermediate
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- name: Verify failure
|
- name: Verify failure
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert2_no_intermediate is failed
|
- cert2_no_intermediate is failed
|
||||||
- "cert2_no_intermediate.msg.startswith('Cannot complete chain. Stuck at certificate ')"
|
- "cert2_no_intermediate.msg.startswith('Cannot complete chain. Stuck at certificate ')"
|
||||||
|
|
||||||
- name: Check failure when infinite loop is found
|
- name: Check failure when infinite loop is found
|
||||||
certificate_complete_chain:
|
community.crypto.certificate_complete_chain:
|
||||||
input_chain: '{{ lookup("file", "cert1-fullchain.pem", rstrip=true) }}'
|
input_chain: '{{ lookup("file", "cert1-fullchain.pem", rstrip=true) }}'
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- '{{ remote_tmp_dir }}/files/roots.pem'
|
- '{{ remote_tmp_dir }}/files/roots.pem'
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
register: cert2_infinite_loop
|
register: cert2_infinite_loop
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- name: Verify failure
|
- name: Verify failure
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- cert2_infinite_loop is failed
|
- cert2_infinite_loop is failed
|
||||||
- "cert2_infinite_loop.msg == 'Found cycle while building certificate chain'"
|
- "cert2_infinite_loop.msg == 'Found cycle while building certificate chain'"
|
||||||
|
|||||||
@@ -16,17 +16,17 @@
|
|||||||
state: directory
|
state: directory
|
||||||
when: ansible_version.string is version('2.10', '<')
|
when: ansible_version.string is version('2.10', '<')
|
||||||
- name: Copy test files to testhost
|
- name: Copy test files to testhost
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: '{{ role_path }}/files/'
|
src: '{{ role_path }}/files/'
|
||||||
dest: '{{ remote_tmp_dir }}/files/'
|
dest: '{{ remote_tmp_dir }}/files/'
|
||||||
|
|
||||||
- name: Run tests with copied certificates
|
- name: Run tests with copied certificates
|
||||||
import_tasks: existing.yml
|
ansible.builtin.import_tasks: existing.yml
|
||||||
|
|
||||||
- name: Create more certificates
|
- name: Create more certificates
|
||||||
import_tasks: create.yml
|
ansible.builtin.import_tasks: create.yml
|
||||||
|
|
||||||
- name: Run tests with created certificates
|
- name: Run tests with created certificates
|
||||||
import_tasks: created.yml
|
ansible.builtin.import_tasks: created.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.5', '>=')
|
when: cryptography_version.stdout is version('1.5', '>=')
|
||||||
|
|||||||
@@ -9,19 +9,19 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Retrieve information
|
- name: Retrieve information
|
||||||
crypto_info:
|
community.crypto.crypto_info:
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Display information
|
- name: Display information
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
var: result
|
var: result
|
||||||
|
|
||||||
- name: Register cryptography version
|
- name: Register cryptography version
|
||||||
command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'"
|
ansible.builtin.command: "{{ ansible_python.executable }} -c 'import cryptography; print(cryptography.__version__)'"
|
||||||
register: local_cryptography_version
|
register: local_cryptography_version
|
||||||
|
|
||||||
- name: Determine complex version-based capabilities
|
- name: Determine complex version-based capabilities
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
supports_ed25519: >-
|
supports_ed25519: >-
|
||||||
{{
|
{{
|
||||||
local_cryptography_version.stdout is version("2.6", ">=")
|
local_cryptography_version.stdout is version("2.6", ">=")
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
- name: Verify cryptography information
|
- name: Verify cryptography information
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.python_cryptography_installed
|
- result.python_cryptography_installed
|
||||||
- "'python_cryptography_import_error' not in result"
|
- "'python_cryptography_import_error' not in result"
|
||||||
@@ -63,15 +63,15 @@
|
|||||||
- result.python_cryptography_capabilities.has_x448 == (local_cryptography_version.stdout is version('2.5', '>='))
|
- result.python_cryptography_capabilities.has_x448 == (local_cryptography_version.stdout is version('2.5', '>='))
|
||||||
|
|
||||||
- name: Find OpenSSL binary
|
- name: Find OpenSSL binary
|
||||||
command: which openssl
|
ansible.builtin.command: which openssl
|
||||||
register: local_openssl_path
|
register: local_openssl_path
|
||||||
|
|
||||||
- name: Find OpenSSL version
|
- name: Find OpenSSL version
|
||||||
command: openssl version
|
ansible.builtin.command: openssl version
|
||||||
register: local_openssl_version_full
|
register: local_openssl_version_full
|
||||||
|
|
||||||
- name: Verify OpenSSL information
|
- name: Verify OpenSSL information
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.openssl_present
|
- result.openssl_present
|
||||||
- result.openssl.path == local_openssl_path.stdout
|
- result.openssl.path == local_openssl_path.stdout
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: "Get CSR info"
|
- name: "Get CSR info"
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/csr_1.csr') | community.crypto.openssl_csr_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/csr_1.csr') | community.crypto.openssl_csr_info }}
|
||||||
result_idna: >-
|
result_idna: >-
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
{{ lookup('file', remote_tmp_dir ~ '/csr_1.csr') | community.crypto.openssl_csr_info(name_encoding='unicode') }}
|
{{ lookup('file', remote_tmp_dir ~ '/csr_1.csr') | community.crypto.openssl_csr_info(name_encoding='unicode') }}
|
||||||
|
|
||||||
- name: "Check whether subject and extensions behaves as expected"
|
- name: "Check whether subject and extensions behaves as expected"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.subject.organizationalUnitName == 'ACME Department'
|
- result.subject.organizationalUnitName == 'ACME Department'
|
||||||
- "['organizationalUnitName', 'Crypto Department'] in result.subject_ordered"
|
- "['organizationalUnitName', 'Crypto Department'] in result.subject_ordered"
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
- result.extensions_by_oid['2.5.29.37'].value == 'MHQGCCsGAQUFBwMBBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEFBQcDBAYIKwYBBQUHAwgGCCsGAQUFBwMJBgRVHSUABggrBgEFBQcBAwYIKwYBBQUHAwoGCCsGAQUFBwMHBggrBgEFBQcBAg=='
|
- result.extensions_by_oid['2.5.29.37'].value == 'MHQGCCsGAQUFBwMBBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEFBQcDBAYIKwYBBQUHAwgGCCsGAQUFBwMJBgRVHSUABggrBgEFBQcBAwYIKwYBBQUHAwoGCCsGAQUFBwMHBggrBgEFBQcBAg=='
|
||||||
|
|
||||||
- name: "Check SubjectKeyIdentifier and AuthorityKeyIdentifier"
|
- name: "Check SubjectKeyIdentifier and AuthorityKeyIdentifier"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.subject_key_identifier == "00:11:22:33"
|
- result.subject_key_identifier == "00:11:22:33"
|
||||||
- result.authority_key_identifier == "44:55:66:77"
|
- result.authority_key_identifier == "44:55:66:77"
|
||||||
@@ -57,17 +57,17 @@
|
|||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
- name: "Get CSR info"
|
- name: "Get CSR info"
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/csr_2.csr') | community.crypto.openssl_csr_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/csr_2.csr') | community.crypto.openssl_csr_info }}
|
||||||
|
|
||||||
- name: "Get CSR info"
|
- name: "Get CSR info"
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/csr_3.csr') | community.crypto.openssl_csr_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/csr_3.csr') | community.crypto.openssl_csr_info }}
|
||||||
|
|
||||||
- name: "Check AuthorityKeyIdentifier"
|
- name: "Check AuthorityKeyIdentifier"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.authority_key_identifier is none
|
- result.authority_key_identifier is none
|
||||||
- result.authority_cert_issuer == expected_authority_cert_issuer
|
- result.authority_cert_issuer == expected_authority_cert_issuer
|
||||||
@@ -79,12 +79,12 @@
|
|||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
- name: "Get CSR info"
|
- name: "Get CSR info"
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/csr_4.csr') | community.crypto.openssl_csr_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/csr_4.csr') | community.crypto.openssl_csr_info }}
|
||||||
|
|
||||||
- name: "Check AuthorityKeyIdentifier"
|
- name: "Check AuthorityKeyIdentifier"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.authority_key_identifier == "44:55:66:77"
|
- result.authority_key_identifier == "44:55:66:77"
|
||||||
- result.authority_cert_issuer is none
|
- result.authority_cert_issuer is none
|
||||||
@@ -92,53 +92,53 @@
|
|||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
- name: Get invalid certificate info
|
- name: Get invalid certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ [] | community.crypto.openssl_csr_info }}
|
{{ [] | community.crypto.openssl_csr_info }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The community.crypto.openssl_csr_info input must be a text type, not ")
|
- output.msg is search("The community.crypto.openssl_csr_info input must be a text type, not ")
|
||||||
|
|
||||||
- name: Get invalid certificate info
|
- name: Get invalid certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'foo' | community.crypto.openssl_csr_info }}
|
{{ 'foo' | community.crypto.openssl_csr_info }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("Unable to load (?:request|PEM file)(?:\.|$)")
|
- output.msg is search("Unable to load (?:request|PEM file)(?:\.|$)")
|
||||||
|
|
||||||
- name: Get invalid certificate info
|
- name: Get invalid certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'foo' | community.crypto.openssl_csr_info(name_encoding=[]) }}
|
{{ 'foo' | community.crypto.openssl_csr_info(name_encoding=[]) }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The name_encoding option must be of a text type, not ")
|
- output.msg is search("The name_encoding option must be of a text type, not ")
|
||||||
|
|
||||||
- name: Get invalid name_encoding parameter
|
- name: Get invalid name_encoding parameter
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'bar' | community.crypto.openssl_csr_info(name_encoding='foo') }}
|
{{ 'bar' | community.crypto.openssl_csr_info(name_encoding='foo') }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The name_encoding option must be one of the values \"ignore\", \"idna\", or \"unicode\", not \"foo\"$")
|
- output.msg is search("The name_encoding option must be one of the values \"ignore\", \"idna\", or \"unicode\", not \"foo\"$")
|
||||||
|
|||||||
@@ -9,23 +9,23 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Make sure the Python idna library is installed
|
- name: Make sure the Python idna library is installed
|
||||||
pip:
|
ansible.builtin.pip:
|
||||||
name: idna
|
name: idna
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Generate privatekey
|
- name: Generate privatekey
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: Generate privatekey with password
|
- name: Generate privatekey with password
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
passphrase: hunter2
|
passphrase: hunter2
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: Generate CSR 1
|
- name: Generate CSR 1
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
- "IP:1.2.3.4"
|
- "IP:1.2.3.4"
|
||||||
|
|
||||||
- name: Generate CSR 2
|
- name: Generate CSR 2
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_2.csr'
|
path: '{{ remote_tmp_dir }}/csr_2.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
privatekey_passphrase: hunter2
|
privatekey_passphrase: hunter2
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
- "CA:TRUE"
|
- "CA:TRUE"
|
||||||
|
|
||||||
- name: Generate CSR 3
|
- name: Generate CSR 3
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_3.csr'
|
path: '{{ remote_tmp_dir }}/csr_3.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
useCommonNameForSAN: false
|
useCommonNameForSAN: false
|
||||||
@@ -121,12 +121,12 @@
|
|||||||
- "IP:1.2.3.4"
|
- "IP:1.2.3.4"
|
||||||
|
|
||||||
- name: Generate CSR 4
|
- name: Generate CSR 4
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_4.csr'
|
path: '{{ remote_tmp_dir }}/csr_4.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
useCommonNameForSAN: false
|
useCommonNameForSAN: false
|
||||||
authority_key_identifier: '{{ "44:55:66:77" if cryptography_version.stdout is version("1.3", ">=") else omit }}'
|
authority_key_identifier: '{{ "44:55:66:77" if cryptography_version.stdout is version("1.3", ">=") else omit }}'
|
||||||
|
|
||||||
- name: Running tests
|
- name: Running tests
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Get key 1 info
|
- name: Get key 1 info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/privatekey_1.pem') | community.crypto.openssl_privatekey_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/privatekey_1.pem') | community.crypto.openssl_privatekey_info }}
|
||||||
|
|
||||||
- name: Check that RSA key info is ok
|
- name: Check that RSA key info is ok
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'public_key' in result"
|
- "'public_key' in result"
|
||||||
- "'public_key_fingerprints' in result"
|
- "'public_key_fingerprints' in result"
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
- "'private_data' not in result"
|
- "'private_data' not in result"
|
||||||
|
|
||||||
- name: Get key 2 info
|
- name: Get key 2 info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/privatekey_2.pem') | community.crypto.openssl_privatekey_info(return_private_key_data=true) }}
|
{{ lookup('file', remote_tmp_dir ~ '/privatekey_2.pem') | community.crypto.openssl_privatekey_info(return_private_key_data=true) }}
|
||||||
|
|
||||||
- name: Check that RSA key info is ok
|
- name: Check that RSA key info is ok
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'public_key' in result"
|
- "'public_key' in result"
|
||||||
- "'public_key_fingerprints' in result"
|
- "'public_key_fingerprints' in result"
|
||||||
@@ -41,26 +41,26 @@
|
|||||||
- "result.private_data.exponent > 5"
|
- "result.private_data.exponent > 5"
|
||||||
|
|
||||||
- name: Get key 3 info (without passphrase)
|
- name: Get key 3 info (without passphrase)
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result_: >-
|
result_: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/privatekey_3.pem') | community.crypto.openssl_privatekey_info(return_private_key_data=true) }}
|
{{ lookup('file', remote_tmp_dir ~ '/privatekey_3.pem') | community.crypto.openssl_privatekey_info(return_private_key_data=true) }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Check that loading passphrase protected key without passphrase failed
|
- name: Check that loading passphrase protected key without passphrase failed
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is failed
|
- result is failed
|
||||||
- >-
|
- >-
|
||||||
'Wrong or empty passphrase provided for private key' in result.msg
|
'Wrong or empty passphrase provided for private key' in result.msg
|
||||||
|
|
||||||
- name: Get key 3 info (with passphrase)
|
- name: Get key 3 info (with passphrase)
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/privatekey_3.pem') | community.crypto.openssl_privatekey_info(passphrase='hunter2', return_private_key_data=true) }}
|
{{ lookup('file', remote_tmp_dir ~ '/privatekey_3.pem') | community.crypto.openssl_privatekey_info(passphrase='hunter2', return_private_key_data=true) }}
|
||||||
|
|
||||||
- name: Check that RSA key info is ok
|
- name: Check that RSA key info is ok
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'public_key' in result"
|
- "'public_key' in result"
|
||||||
- "'public_key_fingerprints' in result"
|
- "'public_key_fingerprints' in result"
|
||||||
@@ -74,12 +74,12 @@
|
|||||||
- "result.private_data.exponent > 5"
|
- "result.private_data.exponent > 5"
|
||||||
|
|
||||||
- name: Get key 4 info
|
- name: Get key 4 info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/privatekey_4.pem') | community.crypto.openssl_privatekey_info(return_private_key_data=true) }}
|
{{ lookup('file', remote_tmp_dir ~ '/privatekey_4.pem') | community.crypto.openssl_privatekey_info(return_private_key_data=true) }}
|
||||||
|
|
||||||
- name: Check that ECC key info is ok
|
- name: Check that ECC key info is ok
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'public_key' in result"
|
- "'public_key' in result"
|
||||||
- "'public_key_fingerprints' in result"
|
- "'public_key_fingerprints' in result"
|
||||||
@@ -94,12 +94,12 @@
|
|||||||
- "result.private_data.multiplier > 1024"
|
- "result.private_data.multiplier > 1024"
|
||||||
|
|
||||||
- name: Get key 5 info
|
- name: Get key 5 info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/privatekey_5.pem') | community.crypto.openssl_privatekey_info(return_private_key_data=true) }}
|
{{ lookup('file', remote_tmp_dir ~ '/privatekey_5.pem') | community.crypto.openssl_privatekey_info(return_private_key_data=true) }}
|
||||||
|
|
||||||
- name: Check that DSA key info is ok
|
- name: Check that DSA key info is ok
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'public_key' in result"
|
- "'public_key' in result"
|
||||||
- "'public_key_fingerprints' in result"
|
- "'public_key_fingerprints' in result"
|
||||||
|
|||||||
@@ -9,34 +9,34 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Generate privatekey 1
|
- name: Generate privatekey 1
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_1.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_1.pem'
|
||||||
|
|
||||||
- name: Generate privatekey 2 (less bits)
|
- name: Generate privatekey 2 (less bits)
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_2.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_2.pem'
|
||||||
type: RSA
|
type: RSA
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: Generate privatekey 3 (with password)
|
- name: Generate privatekey 3 (with password)
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_3.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_3.pem'
|
||||||
passphrase: hunter2
|
passphrase: hunter2
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: Generate privatekey 4 (ECC)
|
- name: Generate privatekey 4 (ECC)
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_4.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_4.pem'
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: "{{ (ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6') | ternary('secp521r1', 'secp256k1') }}"
|
curve: "{{ (ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6') | ternary('secp521r1', 'secp256k1') }}"
|
||||||
# ^ cryptography on CentOS6 doesn't support secp256k1, so we use secp521r1 instead
|
# ^ cryptography on CentOS6 doesn't support secp256k1, so we use secp521r1 instead
|
||||||
|
|
||||||
- name: Generate privatekey 5 (DSA)
|
- name: Generate privatekey 5 (DSA)
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_5.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_5.pem'
|
||||||
type: DSA
|
type: DSA
|
||||||
size: 1024
|
size: 1024
|
||||||
|
|
||||||
- name: Running tests
|
- name: Running tests
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
when: cryptography_version.stdout is version('1.2.3', '>=')
|
when: cryptography_version.stdout is version('1.2.3', '>=')
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Get key 1 info
|
- name: Get key 1 info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/publickey_1.pem') | community.crypto.openssl_publickey_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/publickey_1.pem') | community.crypto.openssl_publickey_info }}
|
||||||
|
|
||||||
- name: Check that RSA key info is ok
|
- name: Check that RSA key info is ok
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'fingerprints' in result"
|
- "'fingerprints' in result"
|
||||||
- "'type' in result"
|
- "'type' in result"
|
||||||
@@ -19,12 +19,12 @@
|
|||||||
- "result.public_data.exponent > 5"
|
- "result.public_data.exponent > 5"
|
||||||
|
|
||||||
- name: Get key 2 info
|
- name: Get key 2 info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/publickey_2.pem') | community.crypto.openssl_publickey_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/publickey_2.pem') | community.crypto.openssl_publickey_info }}
|
||||||
|
|
||||||
- name: Check that RSA key info is ok
|
- name: Check that RSA key info is ok
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'fingerprints' in result"
|
- "'fingerprints' in result"
|
||||||
- "'type' in result"
|
- "'type' in result"
|
||||||
@@ -35,12 +35,12 @@
|
|||||||
- "result.public_data.exponent > 5"
|
- "result.public_data.exponent > 5"
|
||||||
|
|
||||||
- name: Get key 3 info
|
- name: Get key 3 info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/publickey_3.pem') | community.crypto.openssl_publickey_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/publickey_3.pem') | community.crypto.openssl_publickey_info }}
|
||||||
|
|
||||||
- name: Check that ECC key info is ok
|
- name: Check that ECC key info is ok
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'fingerprints' in result"
|
- "'fingerprints' in result"
|
||||||
- "'type' in result"
|
- "'type' in result"
|
||||||
@@ -52,12 +52,12 @@
|
|||||||
- "result.public_data.exponent_size == (521 if (ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6') else 256)"
|
- "result.public_data.exponent_size == (521 if (ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6') else 256)"
|
||||||
|
|
||||||
- name: Get key 4 info
|
- name: Get key 4 info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/publickey_4.pem') | community.crypto.openssl_publickey_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/publickey_4.pem') | community.crypto.openssl_publickey_info }}
|
||||||
|
|
||||||
- name: Check that DSA key info is ok
|
- name: Check that DSA key info is ok
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'fingerprints' in result"
|
- "'fingerprints' in result"
|
||||||
- "'type' in result"
|
- "'type' in result"
|
||||||
@@ -69,27 +69,27 @@
|
|||||||
- "result.public_data.y > 2"
|
- "result.public_data.y > 2"
|
||||||
|
|
||||||
- name: Get invalid key info
|
- name: Get invalid key info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ [] | community.crypto.openssl_publickey_info }}
|
{{ [] | community.crypto.openssl_publickey_info }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The community.crypto.openssl_publickey_info input must be a text type, not ")
|
- output.msg is search("The community.crypto.openssl_publickey_info input must be a text type, not ")
|
||||||
|
|
||||||
- name: Get invalid key info
|
- name: Get invalid key info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'foo' | community.crypto.openssl_publickey_info }}
|
{{ 'foo' | community.crypto.openssl_publickey_info }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- 'output.msg is search("Error while deserializing key: ")'
|
- 'output.msg is search("Error while deserializing key: ")'
|
||||||
|
|||||||
@@ -9,17 +9,17 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Generate privatekey 1
|
- name: Generate privatekey 1
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_1.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_1.pem'
|
||||||
|
|
||||||
- name: Generate privatekey 2 (less bits)
|
- name: Generate privatekey 2 (less bits)
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_2.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_2.pem'
|
||||||
type: RSA
|
type: RSA
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: Generate privatekey 3 (ECC)
|
- name: Generate privatekey 3 (ECC)
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_3.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_3.pem'
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: "{{ (ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6') | ternary('secp521r1', 'secp256k1') }}"
|
curve: "{{ (ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6') | ternary('secp521r1', 'secp256k1') }}"
|
||||||
@@ -27,13 +27,13 @@
|
|||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- name: Generate privatekey 4 (DSA)
|
- name: Generate privatekey 4 (DSA)
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_4.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_4.pem'
|
||||||
type: DSA
|
type: DSA
|
||||||
size: 1024
|
size: 1024
|
||||||
|
|
||||||
- name: Generate public keys
|
- name: Generate public keys
|
||||||
openssl_publickey:
|
community.crypto.openssl_publickey:
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey_{{ item }}.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey_{{ item }}.pem'
|
||||||
path: '{{ remote_tmp_dir }}/publickey_{{ item }}.pem'
|
path: '{{ remote_tmp_dir }}/publickey_{{ item }}.pem'
|
||||||
loop:
|
loop:
|
||||||
@@ -43,5 +43,5 @@
|
|||||||
- 4
|
- 4
|
||||||
|
|
||||||
- name: Running tests
|
- name: Running tests
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
when: cryptography_version.stdout is version('1.2.3', '>=')
|
when: cryptography_version.stdout is version('1.2.3', '>=')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Test parse_serial filter
|
- name: Test parse_serial filter
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- >-
|
- >-
|
||||||
'0' | community.crypto.parse_serial == 0
|
'0' | community.crypto.parse_serial == 0
|
||||||
@@ -22,35 +22,35 @@
|
|||||||
'1:2:3' | community.crypto.parse_serial == 66051
|
'1:2:3' | community.crypto.parse_serial == 66051
|
||||||
|
|
||||||
- name: "Test error 1: empty string"
|
- name: "Test error 1: empty string"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ '' | community.crypto.parse_serial }}
|
{{ '' | community.crypto.parse_serial }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: error_1
|
register: error_1
|
||||||
|
|
||||||
- name: "Test error 2: invalid type"
|
- name: "Test error 2: invalid type"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ [] | community.crypto.parse_serial }}
|
{{ [] | community.crypto.parse_serial }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: error_2
|
register: error_2
|
||||||
|
|
||||||
- name: "Test error 3: invalid values (range)"
|
- name: "Test error 3: invalid values (range)"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ '100' | community.crypto.parse_serial }}
|
{{ '100' | community.crypto.parse_serial }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: error_3
|
register: error_3
|
||||||
|
|
||||||
- name: "Test error 4: invalid values (digits)"
|
- name: "Test error 4: invalid values (digits)"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ 'abcdefg' | community.crypto.parse_serial }}
|
{{ 'abcdefg' | community.crypto.parse_serial }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: error_4
|
register: error_4
|
||||||
|
|
||||||
- name: Validate errors
|
- name: Validate errors
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- >-
|
- >-
|
||||||
error_1 is failed and "The 1st part '' is not a hexadecimal number in range [0, 255]: invalid literal" in error_1.msg
|
error_1 is failed and "The 1st part '' is not a hexadecimal number in range [0, 255]: invalid literal" in error_1.msg
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Run tests that raise no errors
|
- name: Run tests that raise no errors
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- >-
|
- >-
|
||||||
'' | community.crypto.split_pem == []
|
'' | community.crypto.split_pem == []
|
||||||
@@ -49,13 +49,13 @@
|
|||||||
AAb=
|
AAb=
|
||||||
|
|
||||||
- name: Invalid input
|
- name: Invalid input
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ [] | community.crypto.split_pem }}"
|
msg: "{{ [] | community.crypto.split_pem }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Validate error
|
- name: Validate error
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The community.crypto.split_pem input must be a text type, not ")
|
- output.msg is search("The community.crypto.split_pem input must be a text type, not ")
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Test to_serial filter
|
- name: Test to_serial filter
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- 0 | community.crypto.to_serial == '00'
|
- 0 | community.crypto.to_serial == '00'
|
||||||
- 1 | community.crypto.to_serial == '01'
|
- 1 | community.crypto.to_serial == '01'
|
||||||
@@ -13,21 +13,21 @@
|
|||||||
- 65536 | community.crypto.to_serial == '01:00:00'
|
- 65536 | community.crypto.to_serial == '01:00:00'
|
||||||
|
|
||||||
- name: "Test error 1: negative number"
|
- name: "Test error 1: negative number"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ (-1) | community.crypto.to_serial }}
|
{{ (-1) | community.crypto.to_serial }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: error_1
|
register: error_1
|
||||||
|
|
||||||
- name: "Test error 2: invalid type"
|
- name: "Test error 2: invalid type"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ [] | community.crypto.to_serial }}
|
{{ [] | community.crypto.to_serial }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: error_2
|
register: error_2
|
||||||
|
|
||||||
- name: Validate error
|
- name: Validate error
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- >-
|
- >-
|
||||||
error_1 is failed and "The input for the community.crypto.to_serial filter must not be negative" in error_1.msg
|
error_1 is failed and "The input for the community.crypto.to_serial filter must not be negative" in error_1.msg
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Get certificate info
|
- name: Get certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/cert_1.pem') | community.crypto.x509_certificate_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/cert_1.pem') | community.crypto.x509_certificate_info }}
|
||||||
result_idna: >-
|
result_idna: >-
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
{{ lookup('file', remote_tmp_dir ~ '/cert_1.pem') | community.crypto.x509_certificate_info(name_encoding='unicode') }}
|
{{ lookup('file', remote_tmp_dir ~ '/cert_1.pem') | community.crypto.x509_certificate_info(name_encoding='unicode') }}
|
||||||
|
|
||||||
- name: Check whether issuer and subject and extensions behave as expected
|
- name: Check whether issuer and subject and extensions behave as expected
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.issuer.organizationalUnitName == 'ACME Department'
|
- result.issuer.organizationalUnitName == 'ACME Department'
|
||||||
- "['organizationalUnitName', 'Crypto Department'] in result.issuer_ordered"
|
- "['organizationalUnitName', 'Crypto Department'] in result.issuer_ordered"
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
- result.extensions_by_oid['2.5.29.37'].value == 'MHQGCCsGAQUFBwMBBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEFBQcDBAYIKwYBBQUHAwgGCCsGAQUFBwMJBgRVHSUABggrBgEFBQcBAwYIKwYBBQUHAwoGCCsGAQUFBwMHBggrBgEFBQcBAg=='
|
- result.extensions_by_oid['2.5.29.37'].value == 'MHQGCCsGAQUFBwMBBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEFBQcDBAYIKwYBBQUHAwgGCCsGAQUFBwMJBgRVHSUABggrBgEFBQcBAwYIKwYBBQUHAwoGCCsGAQUFBwMHBggrBgEFBQcBAg=='
|
||||||
|
|
||||||
- name: Check SubjectKeyIdentifier and AuthorityKeyIdentifier
|
- name: Check SubjectKeyIdentifier and AuthorityKeyIdentifier
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.subject_key_identifier == "00:11:22:33"
|
- result.subject_key_identifier == "00:11:22:33"
|
||||||
- result.authority_key_identifier == "44:55:66:77"
|
- result.authority_key_identifier == "44:55:66:77"
|
||||||
@@ -89,17 +89,17 @@
|
|||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
- name: Get certificate info
|
- name: Get certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/cert_2.pem') | community.crypto.x509_certificate_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/cert_2.pem') | community.crypto.x509_certificate_info }}
|
||||||
|
|
||||||
- name: Get certificate info
|
- name: Get certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/cert_3.pem') | community.crypto.x509_certificate_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/cert_3.pem') | community.crypto.x509_certificate_info }}
|
||||||
|
|
||||||
- name: Check AuthorityKeyIdentifier
|
- name: Check AuthorityKeyIdentifier
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.authority_key_identifier is none
|
- result.authority_key_identifier is none
|
||||||
- result.authority_cert_issuer == expected_authority_cert_issuer
|
- result.authority_cert_issuer == expected_authority_cert_issuer
|
||||||
@@ -111,12 +111,12 @@
|
|||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
- name: Get certificate info
|
- name: Get certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/cert_4.pem') | community.crypto.x509_certificate_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/cert_4.pem') | community.crypto.x509_certificate_info }}
|
||||||
|
|
||||||
- name: Check AuthorityKeyIdentifier
|
- name: Check AuthorityKeyIdentifier
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.authority_key_identifier == "44:55:66:77"
|
- result.authority_key_identifier == "44:55:66:77"
|
||||||
- result.authority_cert_issuer is none
|
- result.authority_cert_issuer is none
|
||||||
@@ -124,11 +124,11 @@
|
|||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
- name: Get certificate info for packaged cert 1
|
- name: Get certificate info for packaged cert 1
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ lookup('file', role_path ~ '/../x509_certificate_info/files/cert1.pem') | community.crypto.x509_certificate_info }}
|
{{ lookup('file', role_path ~ '/../x509_certificate_info/files/cert1.pem') | community.crypto.x509_certificate_info }}
|
||||||
- name: Check extensions
|
- name: Check extensions
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'ocsp_uri' in result"
|
- "'ocsp_uri' in result"
|
||||||
- "result.ocsp_uri == 'http://ocsp.foobarbaz.example.com'"
|
- "result.ocsp_uri == 'http://ocsp.foobarbaz.example.com'"
|
||||||
@@ -165,59 +165,59 @@
|
|||||||
- result.extensions_by_oid['2.5.29.37'].critical == false
|
- result.extensions_by_oid['2.5.29.37'].critical == false
|
||||||
- result.extensions_by_oid['2.5.29.37'].value == 'MBQGCCsGAQUFBwMBBggrBgEFBQcDAg=='
|
- result.extensions_by_oid['2.5.29.37'].value == 'MBQGCCsGAQUFBwMBBggrBgEFBQcDAg=='
|
||||||
- name: Check fingerprints
|
- name: Check fingerprints
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- (result.fingerprints.sha256 == '08:26:60:3d:29:11:f2:88:09:3f:40:71:bb:67:cb:59:9c:6e:cf:e0:49:22:ab:e8:60:bd:f6:9a:01:e3:0e:2c' if result.fingerprints.sha256 is defined else true)
|
- (result.fingerprints.sha256 == '08:26:60:3d:29:11:f2:88:09:3f:40:71:bb:67:cb:59:9c:6e:cf:e0:49:22:ab:e8:60:bd:f6:9a:01:e3:0e:2c' if result.fingerprints.sha256 is defined else true)
|
||||||
- (result.fingerprints.sha1 == '5a:32:7f:22:61:f3:2e:ad:a7:d8:77:07:1c:7f:08:cd:ab:7f:bc:11' if result.fingerprints.sha1 is defined else true)
|
- (result.fingerprints.sha1 == '5a:32:7f:22:61:f3:2e:ad:a7:d8:77:07:1c:7f:08:cd:ab:7f:bc:11' if result.fingerprints.sha1 is defined else true)
|
||||||
|
|
||||||
- name: Get invalid certificate info
|
- name: Get invalid certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ [] | community.crypto.x509_certificate_info }}
|
{{ [] | community.crypto.x509_certificate_info }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The community.crypto.x509_certificate_info input must be a text type, not ")
|
- output.msg is search("The community.crypto.x509_certificate_info input must be a text type, not ")
|
||||||
|
|
||||||
- name: Get invalid certificate info
|
- name: Get invalid certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'foo' | community.crypto.x509_certificate_info }}
|
{{ 'foo' | community.crypto.x509_certificate_info }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("Unable to load (?:certificate|PEM file)(?:\.|$)")
|
- output.msg is search("Unable to load (?:certificate|PEM file)(?:\.|$)")
|
||||||
|
|
||||||
- name: Get invalid certificate info
|
- name: Get invalid certificate info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'foo' | community.crypto.x509_certificate_info(name_encoding=[]) }}
|
{{ 'foo' | community.crypto.x509_certificate_info(name_encoding=[]) }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The name_encoding option must be of a text type, not ")
|
- output.msg is search("The name_encoding option must be of a text type, not ")
|
||||||
|
|
||||||
- name: Get invalid name_encoding parameter
|
- name: Get invalid name_encoding parameter
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'bar' | community.crypto.x509_certificate_info(name_encoding='foo') }}
|
{{ 'bar' | community.crypto.x509_certificate_info(name_encoding='foo') }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The name_encoding option must be one of the values \"ignore\", \"idna\", or \"unicode\", not \"foo\"$")
|
- output.msg is search("The name_encoding option must be one of the values \"ignore\", \"idna\", or \"unicode\", not \"foo\"$")
|
||||||
|
|||||||
@@ -9,24 +9,24 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Make sure the Python idna library is installed
|
- name: Make sure the Python idna library is installed
|
||||||
pip:
|
ansible.builtin.pip:
|
||||||
name: idna
|
name: idna
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Generate privatekey
|
- name: Generate privatekey
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
size: '{{ default_rsa_key_size_certificates }}'
|
size: '{{ default_rsa_key_size_certificates }}'
|
||||||
|
|
||||||
- name: Generate privatekey with password
|
- name: Generate privatekey with password
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
passphrase: hunter2
|
passphrase: hunter2
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
size: '{{ default_rsa_key_size_certificates }}'
|
size: '{{ default_rsa_key_size_certificates }}'
|
||||||
|
|
||||||
- name: Generate CSR 1
|
- name: Generate CSR 1
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
- "IP:1.2.3.4"
|
- "IP:1.2.3.4"
|
||||||
|
|
||||||
- name: Generate CSR 2
|
- name: Generate CSR 2
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_2.csr'
|
path: '{{ remote_tmp_dir }}/csr_2.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
privatekey_passphrase: hunter2
|
privatekey_passphrase: hunter2
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
- "CA:TRUE"
|
- "CA:TRUE"
|
||||||
|
|
||||||
- name: Generate CSR 3
|
- name: Generate CSR 3
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_3.csr'
|
path: '{{ remote_tmp_dir }}/csr_3.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
useCommonNameForSAN: false
|
useCommonNameForSAN: false
|
||||||
@@ -124,14 +124,14 @@
|
|||||||
- "IP:1.2.3.4"
|
- "IP:1.2.3.4"
|
||||||
|
|
||||||
- name: Generate CSR 4
|
- name: Generate CSR 4
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_4.csr'
|
path: '{{ remote_tmp_dir }}/csr_4.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
useCommonNameForSAN: false
|
useCommonNameForSAN: false
|
||||||
authority_key_identifier: '{{ "44:55:66:77" if cryptography_version.stdout is version("1.3", ">=") else omit }}'
|
authority_key_identifier: '{{ "44:55:66:77" if cryptography_version.stdout is version("1.3", ">=") else omit }}'
|
||||||
|
|
||||||
- name: Generate selfsigned certificates
|
- name: Generate selfsigned certificates
|
||||||
x509_certificate:
|
community.crypto.x509_certificate:
|
||||||
path: '{{ remote_tmp_dir }}/cert_{{ item }}.pem'
|
path: '{{ remote_tmp_dir }}/cert_{{ item }}.pem'
|
||||||
csr_path: '{{ remote_tmp_dir }}/csr_{{ item }}.csr'
|
csr_path: '{{ remote_tmp_dir }}/csr_{{ item }}.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
@@ -146,5 +146,5 @@
|
|||||||
- 4
|
- 4
|
||||||
|
|
||||||
- name: Running tests
|
- name: Running tests
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
when: cryptography_version.stdout is version('1.6', '>=')
|
when: cryptography_version.stdout is version('1.6', '>=')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Create CRL 1
|
- name: Create CRL 1
|
||||||
x509_crl:
|
community.crypto.x509_crl:
|
||||||
path: '{{ remote_tmp_dir }}/ca-crl1.crl'
|
path: '{{ remote_tmp_dir }}/ca-crl1.crl'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
||||||
issuer:
|
issuer:
|
||||||
@@ -23,17 +23,17 @@
|
|||||||
revocation_date: 20191001000000Z
|
revocation_date: 20191001000000Z
|
||||||
|
|
||||||
- name: Retrieve CRL 1 infos
|
- name: Retrieve CRL 1 infos
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
crl_1_info_1: >-
|
crl_1_info_1: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/ca-crl1.crl') | community.crypto.x509_crl_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/ca-crl1.crl') | community.crypto.x509_crl_info }}
|
||||||
|
|
||||||
- name: Retrieve CRL 1 infos
|
- name: Retrieve CRL 1 infos
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
crl_1_info_2: >-
|
crl_1_info_2: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/ca-crl1.crl') | b64encode | community.crypto.x509_crl_info }}
|
{{ lookup('file', remote_tmp_dir ~ '/ca-crl1.crl') | b64encode | community.crypto.x509_crl_info }}
|
||||||
|
|
||||||
- name: Validate CRL 1 info
|
- name: Validate CRL 1 info
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- crl_1_info_1.format == 'pem'
|
- crl_1_info_1.format == 'pem'
|
||||||
- crl_1_info_1.digest == 'ecdsa-with-SHA256'
|
- crl_1_info_1.digest == 'ecdsa-with-SHA256'
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
- crl_1_info_1 == crl_1_info_2
|
- crl_1_info_1 == crl_1_info_2
|
||||||
|
|
||||||
- name: Recreate CRL 1 as DER file
|
- name: Recreate CRL 1 as DER file
|
||||||
x509_crl:
|
community.crypto.x509_crl:
|
||||||
path: '{{ remote_tmp_dir }}/ca-crl1.crl'
|
path: '{{ remote_tmp_dir }}/ca-crl1.crl'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
||||||
format: der
|
format: der
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
revocation_date: 20191001000000Z
|
revocation_date: 20191001000000Z
|
||||||
|
|
||||||
- name: Read ca-crl1.crl
|
- name: Read ca-crl1.crl
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: "{{ remote_tmp_dir }}/ca-crl1.crl"
|
src: "{{ remote_tmp_dir }}/ca-crl1.crl"
|
||||||
register: content
|
register: content
|
||||||
|
|
||||||
@@ -102,19 +102,19 @@
|
|||||||
when: ansible_version.string is version('2.11', '>=') or ansible_python.version.major > 2
|
when: ansible_version.string is version('2.11', '>=') or ansible_python.version.major > 2
|
||||||
|
|
||||||
- name: Retrieve CRL 1 infos from DER (Base64 encoded)
|
- name: Retrieve CRL 1 infos from DER (Base64 encoded)
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
crl_1_info_5: >-
|
crl_1_info_5: >-
|
||||||
{{ content.content | community.crypto.x509_crl_info }}
|
{{ content.content | community.crypto.x509_crl_info }}
|
||||||
|
|
||||||
- name: Validate CRL 1
|
- name: Validate CRL 1
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- crl_1_info_4 is not defined or crl_1_info_4.format == 'der'
|
- crl_1_info_4 is not defined or crl_1_info_4.format == 'der'
|
||||||
- crl_1_info_5.format == 'der'
|
- crl_1_info_5.format == 'der'
|
||||||
- crl_1_info_4 is not defined or crl_1_info_4 == crl_1_info_5
|
- crl_1_info_4 is not defined or crl_1_info_4 == crl_1_info_5
|
||||||
|
|
||||||
- name: Create CRL 2
|
- name: Create CRL 2
|
||||||
x509_crl:
|
community.crypto.x509_crl:
|
||||||
path: '{{ remote_tmp_dir }}/ca-crl2.crl'
|
path: '{{ remote_tmp_dir }}/ca-crl2.crl'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
||||||
issuer_ordered:
|
issuer_ordered:
|
||||||
@@ -135,12 +135,12 @@
|
|||||||
register: crl_2_change
|
register: crl_2_change
|
||||||
|
|
||||||
- name: Retrieve CRL 2 infos
|
- name: Retrieve CRL 2 infos
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
crl_2_info_1: >-
|
crl_2_info_1: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/ca-crl2.crl') | community.crypto.x509_crl_info(list_revoked_certificates=false) }}
|
{{ lookup('file', remote_tmp_dir ~ '/ca-crl2.crl') | community.crypto.x509_crl_info(list_revoked_certificates=false) }}
|
||||||
|
|
||||||
- name: Create CRL 2 (changed order)
|
- name: Create CRL 2 (changed order)
|
||||||
x509_crl:
|
community.crypto.x509_crl:
|
||||||
path: '{{ remote_tmp_dir }}/ca-crl2.crl'
|
path: '{{ remote_tmp_dir }}/ca-crl2.crl'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
||||||
issuer_ordered:
|
issuer_ordered:
|
||||||
@@ -161,12 +161,12 @@
|
|||||||
register: crl_2_change_order
|
register: crl_2_change_order
|
||||||
|
|
||||||
- name: Retrieve CRL 2 infos again
|
- name: Retrieve CRL 2 infos again
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
crl_2_info_2: >-
|
crl_2_info_2: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/ca-crl2.crl') | community.crypto.x509_crl_info(list_revoked_certificates=false) }}
|
{{ lookup('file', remote_tmp_dir ~ '/ca-crl2.crl') | community.crypto.x509_crl_info(list_revoked_certificates=false) }}
|
||||||
|
|
||||||
- name: Validate CRL 2 info
|
- name: Validate CRL 2 info
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'revoked_certificates' not in crl_2_info_1"
|
- "'revoked_certificates' not in crl_2_info_1"
|
||||||
- >
|
- >
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
]
|
]
|
||||||
|
|
||||||
- name: Create CRL 3
|
- name: Create CRL 3
|
||||||
x509_crl:
|
community.crypto.x509_crl:
|
||||||
path: '{{ remote_tmp_dir }}/ca-crl3.crl'
|
path: '{{ remote_tmp_dir }}/ca-crl3.crl'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
||||||
issuer:
|
issuer:
|
||||||
@@ -215,7 +215,7 @@
|
|||||||
register: crl_3
|
register: crl_3
|
||||||
|
|
||||||
- name: Create CRL 3 (IDNA encoding)
|
- name: Create CRL 3 (IDNA encoding)
|
||||||
x509_crl:
|
community.crypto.x509_crl:
|
||||||
path: '{{ remote_tmp_dir }}/ca-crl3.crl'
|
path: '{{ remote_tmp_dir }}/ca-crl3.crl'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
||||||
issuer:
|
issuer:
|
||||||
@@ -240,7 +240,7 @@
|
|||||||
register: crl_3_idna
|
register: crl_3_idna
|
||||||
|
|
||||||
- name: Create CRL 3 (Unicode encoding)
|
- name: Create CRL 3 (Unicode encoding)
|
||||||
x509_crl:
|
community.crypto.x509_crl:
|
||||||
path: '{{ remote_tmp_dir }}/ca-crl3.crl'
|
path: '{{ remote_tmp_dir }}/ca-crl3.crl'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
privatekey_path: '{{ remote_tmp_dir }}/ca.key'
|
||||||
issuer:
|
issuer:
|
||||||
@@ -265,7 +265,7 @@
|
|||||||
register: crl_3_unicode
|
register: crl_3_unicode
|
||||||
|
|
||||||
- name: Retrieve CRL 3 infos
|
- name: Retrieve CRL 3 infos
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
crl_3_info: >-
|
crl_3_info: >-
|
||||||
{{ lookup('file', remote_tmp_dir ~ '/ca-crl3.crl') | community.crypto.x509_crl_info(list_revoked_certificates=true) }}
|
{{ lookup('file', remote_tmp_dir ~ '/ca-crl3.crl') | community.crypto.x509_crl_info(list_revoked_certificates=true) }}
|
||||||
crl_3_info_idna: >-
|
crl_3_info_idna: >-
|
||||||
@@ -274,73 +274,73 @@
|
|||||||
{{ lookup('file', remote_tmp_dir ~ '/ca-crl3.crl') | community.crypto.x509_crl_info(list_revoked_certificates=true, name_encoding='unicode') }}
|
{{ lookup('file', remote_tmp_dir ~ '/ca-crl3.crl') | community.crypto.x509_crl_info(list_revoked_certificates=true, name_encoding='unicode') }}
|
||||||
|
|
||||||
- name: Validate CRL 3 info
|
- name: Validate CRL 3 info
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- crl_3.revoked_certificates == crl_3_info.revoked_certificates
|
- crl_3.revoked_certificates == crl_3_info.revoked_certificates
|
||||||
- crl_3_idna.revoked_certificates == crl_3_info_idna.revoked_certificates
|
- crl_3_idna.revoked_certificates == crl_3_info_idna.revoked_certificates
|
||||||
- crl_3_unicode.revoked_certificates == crl_3_info_unicode.revoked_certificates
|
- crl_3_unicode.revoked_certificates == crl_3_info_unicode.revoked_certificates
|
||||||
|
|
||||||
- name: Get invalid CRL info
|
- name: Get invalid CRL info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ [] | community.crypto.x509_crl_info }}
|
{{ [] | community.crypto.x509_crl_info }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The community.crypto.x509_crl_info input must be a text type, not ")
|
- output.msg is search("The community.crypto.x509_crl_info input must be a text type, not ")
|
||||||
|
|
||||||
- name: Get invalid CRL info
|
- name: Get invalid CRL info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'foo' | community.crypto.x509_crl_info }}
|
{{ 'foo' | community.crypto.x509_crl_info }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("Error while decoding CRL")
|
- output.msg is search("Error while decoding CRL")
|
||||||
|
|
||||||
- name: Get invalid CRL info
|
- name: Get invalid CRL info
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'foo' | community.crypto.x509_crl_info(name_encoding=[]) }}
|
{{ 'foo' | community.crypto.x509_crl_info(name_encoding=[]) }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The name_encoding option must be of a text type, not ")
|
- output.msg is search("The name_encoding option must be of a text type, not ")
|
||||||
|
|
||||||
- name: Get invalid name_encoding parameter
|
- name: Get invalid name_encoding parameter
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'bar' | community.crypto.x509_crl_info(name_encoding='foo') }}
|
{{ 'bar' | community.crypto.x509_crl_info(name_encoding='foo') }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The name_encoding option must be one of the values \"ignore\", \"idna\", or \"unicode\", not \"foo\"$")
|
- output.msg is search("The name_encoding option must be one of the values \"ignore\", \"idna\", or \"unicode\", not \"foo\"$")
|
||||||
|
|
||||||
- name: Get invalid list_revoked_certificates parameter
|
- name: Get invalid list_revoked_certificates parameter
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
result: >-
|
result: >-
|
||||||
{{ 'bar' | community.crypto.x509_crl_info(list_revoked_certificates=[]) }}
|
{{ 'bar' | community.crypto.x509_crl_info(list_revoked_certificates=[]) }}
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Check that task failed and error message is OK
|
- name: Check that task failed and error message is OK
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output is failed
|
- output is failed
|
||||||
- output.msg is search("The list_revoked_certificates option must be a boolean, not ")
|
- output.msg is search("The list_revoked_certificates option must be a boolean, not ")
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Make sure the Python idna library is installed
|
- name: Make sure the Python idna library is installed
|
||||||
pip:
|
ansible.builtin.pip:
|
||||||
name: idna
|
name: idna
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
certificates:
|
certificates:
|
||||||
- name: ca
|
- name: ca
|
||||||
subject:
|
subject:
|
||||||
@@ -39,14 +39,14 @@
|
|||||||
- DNS:b64.ansible.com
|
- DNS:b64.ansible.com
|
||||||
|
|
||||||
- name: Generate private keys
|
- name: Generate private keys
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/{{ item.name }}.key'
|
path: '{{ remote_tmp_dir }}/{{ item.name }}.key'
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
loop: "{{ certificates }}"
|
loop: "{{ certificates }}"
|
||||||
|
|
||||||
- name: Generate CSRs
|
- name: Generate CSRs
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/{{ item.name }}.csr'
|
path: '{{ remote_tmp_dir }}/{{ item.name }}.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/{{ item.name }}.key'
|
privatekey_path: '{{ remote_tmp_dir }}/{{ item.name }}.key'
|
||||||
subject: "{{ item.subject | default(omit) }}"
|
subject: "{{ item.subject | default(omit) }}"
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
loop: "{{ certificates }}"
|
loop: "{{ certificates }}"
|
||||||
|
|
||||||
- name: Generate CA certificates
|
- name: Generate CA certificates
|
||||||
x509_certificate:
|
community.crypto.x509_certificate:
|
||||||
path: '{{ remote_tmp_dir }}/{{ item.name }}.pem'
|
path: '{{ remote_tmp_dir }}/{{ item.name }}.pem'
|
||||||
csr_path: '{{ remote_tmp_dir }}/{{ item.name }}.csr'
|
csr_path: '{{ remote_tmp_dir }}/{{ item.name }}.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/{{ item.name }}.key'
|
privatekey_path: '{{ remote_tmp_dir }}/{{ item.name }}.key'
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
when: item.is_ca | default(false)
|
when: item.is_ca | default(false)
|
||||||
|
|
||||||
- name: Generate other certificates
|
- name: Generate other certificates
|
||||||
x509_certificate:
|
community.crypto.x509_certificate:
|
||||||
path: '{{ remote_tmp_dir }}/{{ item.name }}.pem'
|
path: '{{ remote_tmp_dir }}/{{ item.name }}.pem'
|
||||||
csr_path: '{{ remote_tmp_dir }}/{{ item.name }}.csr'
|
csr_path: '{{ remote_tmp_dir }}/{{ item.name }}.csr'
|
||||||
provider: ownca
|
provider: ownca
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
when: not (item.is_ca | default(false))
|
when: not (item.is_ca | default(false))
|
||||||
|
|
||||||
- name: Get certificate infos
|
- name: Get certificate infos
|
||||||
x509_certificate_info:
|
community.crypto.x509_certificate_info:
|
||||||
path: '{{ remote_tmp_dir }}/{{ item }}.pem'
|
path: '{{ remote_tmp_dir }}/{{ item }}.pem'
|
||||||
loop:
|
loop:
|
||||||
- cert-1
|
- cert-1
|
||||||
@@ -86,6 +86,6 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests
|
- name: Running tests
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
|
|
||||||
when: cryptography_version.stdout is version('1.2', '>=')
|
when: cryptography_version.stdout is version('1.2', '>=')
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# and should not be used as examples of how to write Ansible roles #
|
# and should not be used as examples of how to write Ansible roles #
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
skip_tests: false
|
skip_tests: false
|
||||||
has_get_certificate_chain: >-
|
has_get_certificate_chain: >-
|
||||||
{{ ansible_facts.python_version is version('3.10.0', '>=') }}
|
{{ ansible_facts.python_version is version('3.10.0', '>=') }}
|
||||||
@@ -16,14 +16,14 @@
|
|||||||
- block:
|
- block:
|
||||||
|
|
||||||
- name: Get servers certificate with backend auto-detection
|
- name: Get servers certificate with backend auto-detection
|
||||||
get_certificate:
|
community.crypto.get_certificate:
|
||||||
host: "{{ httpbin_host }}"
|
host: "{{ httpbin_host }}"
|
||||||
port: 443
|
port: 443
|
||||||
asn1_base64: "{{ true if ansible_version.full is version('2.18', '>=') else omit }}"
|
asn1_base64: "{{ true if ansible_version.full is version('2.18', '>=') else omit }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
skip_tests: |
|
skip_tests: |
|
||||||
{{
|
{{
|
||||||
result is failed and (
|
result is failed and (
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is success or skip_tests
|
- result is success or skip_tests
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
|
|
||||||
- include_tasks: ../tests/validate.yml
|
- ansible.builtin.include_tasks: ../tests/validate.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,16 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Get servers certificate for SNI test part 1
|
- name: Get servers certificate for SNI test part 1
|
||||||
get_certificate:
|
community.crypto.get_certificate:
|
||||||
host: "{{ httpbin_host }}"
|
host: "{{ httpbin_host }}"
|
||||||
port: 443
|
port: 443
|
||||||
server_name: "{{ sni_host }}"
|
server_name: "{{ sni_host }}"
|
||||||
asn1_base64: true
|
asn1_base64: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- debug: var=result
|
- ansible.builtin.debug: var=result
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
# This module should never change anything
|
# This module should never change anything
|
||||||
- result is not changed
|
- result is not changed
|
||||||
@@ -22,16 +22,16 @@
|
|||||||
- "'{{ sni_host }}' == result.subject.CN"
|
- "'{{ sni_host }}' == result.subject.CN"
|
||||||
|
|
||||||
- name: Get servers certificate for SNI test part 2
|
- name: Get servers certificate for SNI test part 2
|
||||||
get_certificate:
|
community.crypto.get_certificate:
|
||||||
host: "{{ sni_host }}"
|
host: "{{ sni_host }}"
|
||||||
port: 443
|
port: 443
|
||||||
server_name: "{{ httpbin_host }}"
|
server_name: "{{ httpbin_host }}"
|
||||||
asn1_base64: true
|
asn1_base64: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- debug: var=result
|
- ansible.builtin.debug: var=result
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
# This module should never change anything
|
# This module should never change anything
|
||||||
- result is not changed
|
- result is not changed
|
||||||
@@ -40,16 +40,16 @@
|
|||||||
- "'{{ httpbin_host }}' == result.subject.CN"
|
- "'{{ httpbin_host }}' == result.subject.CN"
|
||||||
|
|
||||||
- name: Get servers certificate
|
- name: Get servers certificate
|
||||||
get_certificate:
|
community.crypto.get_certificate:
|
||||||
host: "{{ httpbin_host }}"
|
host: "{{ httpbin_host }}"
|
||||||
port: 443
|
port: 443
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
asn1_base64: true
|
asn1_base64: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- debug: var=result
|
- ansible.builtin.debug: var=result
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
# This module should never change anything
|
# This module should never change anything
|
||||||
- result is not changed
|
- result is not changed
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
- "'North Carolina' == result.subject.ST"
|
- "'North Carolina' == result.subject.ST"
|
||||||
|
|
||||||
- name: Connect to http port (will fail because there is no SSL cert to get)
|
- name: Connect to http port (will fail because there is no SSL cert to get)
|
||||||
get_certificate:
|
community.crypto.get_certificate:
|
||||||
host: "{{ httpbin_host }}"
|
host: "{{ httpbin_host }}"
|
||||||
port: 80
|
port: 80
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
- result is failed
|
- result is failed
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
or 'record layer failure' in result.msg
|
or 'record layer failure' in result.msg
|
||||||
|
|
||||||
- name: Test timeout option
|
- name: Test timeout option
|
||||||
get_certificate:
|
community.crypto.get_certificate:
|
||||||
host: "{{ httpbin_host }}"
|
host: "{{ httpbin_host }}"
|
||||||
port: 1234
|
port: 1234
|
||||||
timeout: 1
|
timeout: 1
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
- result is failed
|
- result is failed
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
- "'Failed to get cert from port with error: timed out' == result.msg or 'Connection refused' in result.msg"
|
- "'Failed to get cert from port with error: timed out' == result.msg or 'Connection refused' in result.msg"
|
||||||
|
|
||||||
- name: Test failure if ca_cert is not a valid file
|
- name: Test failure if ca_cert is not a valid file
|
||||||
get_certificate:
|
community.crypto.get_certificate:
|
||||||
host: "{{ httpbin_host }}"
|
host: "{{ httpbin_host }}"
|
||||||
port: 443
|
port: 443
|
||||||
ca_cert: dn.e
|
ca_cert: dn.e
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
- result is failed
|
- result is failed
|
||||||
@@ -112,12 +112,12 @@
|
|||||||
- "'ca_cert file does not exist' == result.msg"
|
- "'ca_cert file does not exist' == result.msg"
|
||||||
|
|
||||||
- name: Download CA Cert as pem from server
|
- name: Download CA Cert as pem from server
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "http://ansible.http.tests/cacert.pem"
|
url: "http://ansible.http.tests/cacert.pem"
|
||||||
dest: "{{ remote_tmp_dir }}/temp.pem"
|
dest: "{{ remote_tmp_dir }}/temp.pem"
|
||||||
|
|
||||||
- name: Get servers certificate comparing it to its own ca_cert file
|
- name: Get servers certificate comparing it to its own ca_cert file
|
||||||
get_certificate:
|
community.crypto.get_certificate:
|
||||||
ca_cert: '{{ remote_tmp_dir }}/temp.pem'
|
ca_cert: '{{ remote_tmp_dir }}/temp.pem'
|
||||||
host: "{{ httpbin_host }}"
|
host: "{{ httpbin_host }}"
|
||||||
port: 443
|
port: 443
|
||||||
@@ -126,19 +126,19 @@
|
|||||||
get_certificate_chain: "{{ has_get_certificate_chain }}"
|
get_certificate_chain: "{{ has_get_certificate_chain }}"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
- result is not failed
|
- result is not failed
|
||||||
|
|
||||||
- name: Read CA cert
|
- name: Read CA cert
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/temp.pem'
|
src: '{{ remote_tmp_dir }}/temp.pem'
|
||||||
register: cacert
|
register: cacert
|
||||||
when: has_get_certificate_chain
|
when: has_get_certificate_chain
|
||||||
|
|
||||||
- name: Validate get_certificate_chain=true results
|
- name: Validate get_certificate_chain=true results
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.verified_chain is sequence
|
- result.verified_chain is sequence
|
||||||
- result.unverified_chain is sequence
|
- result.unverified_chain is sequence
|
||||||
@@ -149,20 +149,20 @@
|
|||||||
when: has_get_certificate_chain
|
when: has_get_certificate_chain
|
||||||
|
|
||||||
- name: Validate get_certificate_chain=false results
|
- name: Validate get_certificate_chain=false results
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.verified_chain is undefined
|
- result.verified_chain is undefined
|
||||||
- result.unverified_chain is undefined
|
- result.unverified_chain is undefined
|
||||||
when: not has_get_certificate_chain
|
when: not has_get_certificate_chain
|
||||||
|
|
||||||
- name: Generate bogus CA privatekey
|
- name: Generate bogus CA privatekey
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/bogus_ca.key'
|
path: '{{ remote_tmp_dir }}/bogus_ca.key'
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp256r1
|
curve: secp256r1
|
||||||
|
|
||||||
- name: Generate bogus CA CSR
|
- name: Generate bogus CA CSR
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/bogus_ca.csr'
|
path: '{{ remote_tmp_dir }}/bogus_ca.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/bogus_ca.key'
|
privatekey_path: '{{ remote_tmp_dir }}/bogus_ca.key'
|
||||||
subject:
|
subject:
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
basic_constraints_critical: true
|
basic_constraints_critical: true
|
||||||
|
|
||||||
- name: Generate selfsigned bogus CA certificate
|
- name: Generate selfsigned bogus CA certificate
|
||||||
x509_certificate:
|
community.crypto.x509_certificate:
|
||||||
path: '{{ remote_tmp_dir }}/bogus_ca.pem'
|
path: '{{ remote_tmp_dir }}/bogus_ca.pem'
|
||||||
csr_path: '{{ remote_tmp_dir }}/bogus_ca.csr'
|
csr_path: '{{ remote_tmp_dir }}/bogus_ca.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/bogus_ca.key'
|
privatekey_path: '{{ remote_tmp_dir }}/bogus_ca.key'
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
selfsigned_digest: sha256
|
selfsigned_digest: sha256
|
||||||
|
|
||||||
- name: Get servers certificate comparing it to an invalid ca_cert file
|
- name: Get servers certificate comparing it to an invalid ca_cert file
|
||||||
get_certificate:
|
community.crypto.get_certificate:
|
||||||
ca_cert: '{{ remote_tmp_dir }}/bogus_ca.pem'
|
ca_cert: '{{ remote_tmp_dir }}/bogus_ca.pem'
|
||||||
host: "{{ httpbin_host }}"
|
host: "{{ httpbin_host }}"
|
||||||
port: 443
|
port: 443
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is not changed
|
- result is not changed
|
||||||
- result is failed
|
- result is failed
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Copy keyfiles
|
- name: Copy keyfiles
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: '{{ item }}'
|
src: '{{ item }}'
|
||||||
dest: '{{ remote_tmp_dir }}/{{ item }}'
|
dest: '{{ remote_tmp_dir }}/{{ item }}'
|
||||||
loop:
|
loop:
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
- keyfile2
|
- keyfile2
|
||||||
|
|
||||||
- name: Include OS-specific variables
|
- name: Include OS-specific variables
|
||||||
include_vars: '{{ lookup("first_found", search) }}'
|
ansible.builtin.include_vars: '{{ lookup("first_found", search) }}'
|
||||||
vars:
|
vars:
|
||||||
search:
|
search:
|
||||||
files:
|
files:
|
||||||
@@ -30,62 +30,62 @@
|
|||||||
- vars
|
- vars
|
||||||
|
|
||||||
- name: Make sure cryptsetup is installed
|
- name: Make sure cryptsetup is installed
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: '{{ cryptsetup_package }}'
|
name: '{{ cryptsetup_package }}'
|
||||||
state: present
|
state: present
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Install additionally required packages
|
- name: Install additionally required packages
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: '{{ luks_extra_packages }}'
|
name: '{{ luks_extra_packages }}'
|
||||||
state: present
|
state: present
|
||||||
become: true
|
become: true
|
||||||
when: luks_extra_packages | length > 0
|
when: luks_extra_packages | length > 0
|
||||||
|
|
||||||
- name: Determine cryptsetup version
|
- name: Determine cryptsetup version
|
||||||
command: cryptsetup --version
|
ansible.builtin.command: cryptsetup --version
|
||||||
register: cryptsetup_version
|
register: cryptsetup_version
|
||||||
|
|
||||||
- name: Extract cryptsetup version
|
- name: Extract cryptsetup version
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cryptsetup_version: >-
|
cryptsetup_version: >-
|
||||||
{{ cryptsetup_version.stdout_lines[0] | regex_search('cryptsetup ([0-9]+\.[0-9]+\.[0-9]+)') | split | last }}
|
{{ cryptsetup_version.stdout_lines[0] | regex_search('cryptsetup ([0-9]+\.[0-9]+\.[0-9]+)') | split | last }}
|
||||||
|
|
||||||
- name: Create cryptfile
|
- name: Create cryptfile
|
||||||
command: dd if=/dev/zero of={{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile bs=1M count=32
|
ansible.builtin.command: dd if=/dev/zero of={{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile bs=1M count=32
|
||||||
|
|
||||||
- name: Figure out next loopback device
|
- name: Figure out next loopback device
|
||||||
command: losetup -f
|
ansible.builtin.command: losetup -f
|
||||||
become: true
|
become: true
|
||||||
register: cryptfile_device_output
|
register: cryptfile_device_output
|
||||||
|
|
||||||
- name: Create lookback device
|
- name: Create lookback device
|
||||||
command: losetup -f {{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile
|
ansible.builtin.command: losetup -f {{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Store some common data for tests
|
- name: Store some common data for tests
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cryptfile_device: "{{ cryptfile_device_output.stdout_lines[0] }}"
|
cryptfile_device: "{{ cryptfile_device_output.stdout_lines[0] }}"
|
||||||
cryptfile_passphrase1: "uNiJ9vKG2mUOEWDiQVuBHJlfMHE"
|
cryptfile_passphrase1: "uNiJ9vKG2mUOEWDiQVuBHJlfMHE"
|
||||||
cryptfile_passphrase2: "HW4Ak2HtE2vvne0qjJMPTtmbV4M"
|
cryptfile_passphrase2: "HW4Ak2HtE2vvne0qjJMPTtmbV4M"
|
||||||
cryptfile_passphrase3: "qQJqsjabO9pItV792k90VvX84MM"
|
cryptfile_passphrase3: "qQJqsjabO9pItV792k90VvX84MM"
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- include_tasks: run-test.yml
|
- ansible.builtin.include_tasks: run-test.yml
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- "tests/*.yml"
|
- "tests/*.yml"
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- name: Make sure LUKS device is gone
|
- name: Make sure LUKS device is gone
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: absent
|
state: absent
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- command: losetup -d "{{ cryptfile_device }}"
|
- ansible.builtin.command: losetup -d "{{ cryptfile_device }}"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- file:
|
- ansible.builtin.file:
|
||||||
dest: "{{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile"
|
dest: "{{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Make sure LUKS device is gone
|
- name: Make sure LUKS device is gone
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: absent
|
state: absent
|
||||||
become: true
|
become: true
|
||||||
- name: "Loading tasks from {{ item }}"
|
- name: "Loading tasks from {{ item }}"
|
||||||
include_tasks: "{{ item }}"
|
ansible.builtin.include_tasks: "{{ item }}"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Create (check)
|
- name: Create (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_check
|
register: create_check
|
||||||
- name: Create
|
- name: Create
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create
|
register: create
|
||||||
- name: Create (idempotent)
|
- name: Create (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_idem
|
register: create_idem
|
||||||
- name: Create (idempotent, check)
|
- name: Create (idempotent, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
become: true
|
become: true
|
||||||
register: create_idem_check
|
register: create_idem_check
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- create_check is changed
|
- create_check is changed
|
||||||
- create is changed
|
- create is changed
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
- create_idem_check is not changed
|
- create_idem_check is not changed
|
||||||
|
|
||||||
- name: Open (check)
|
- name: Open (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -57,28 +57,28 @@
|
|||||||
become: true
|
become: true
|
||||||
register: open_check
|
register: open_check
|
||||||
- name: Open
|
- name: Open
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
become: true
|
become: true
|
||||||
register: open
|
register: open
|
||||||
- name: Open (idempotent)
|
- name: Open (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
become: true
|
become: true
|
||||||
register: open_idem
|
register: open_idem
|
||||||
- name: Open (idempotent, check)
|
- name: Open (idempotent, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
check_mode: true
|
check_mode: true
|
||||||
become: true
|
become: true
|
||||||
register: open_idem_check
|
register: open_idem_check
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_check is changed
|
- open_check is changed
|
||||||
- open is changed
|
- open is changed
|
||||||
@@ -86,32 +86,32 @@
|
|||||||
- open_idem_check is not changed
|
- open_idem_check is not changed
|
||||||
|
|
||||||
- name: Closed (via name, check)
|
- name: Closed (via name, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
name: "{{ open.name }}"
|
name: "{{ open.name }}"
|
||||||
state: closed
|
state: closed
|
||||||
check_mode: true
|
check_mode: true
|
||||||
become: true
|
become: true
|
||||||
register: close_check
|
register: close_check
|
||||||
- name: Closed (via name)
|
- name: Closed (via name)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
name: "{{ open.name }}"
|
name: "{{ open.name }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
register: close
|
register: close
|
||||||
- name: Closed (via name, idempotent)
|
- name: Closed (via name, idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
name: "{{ open.name }}"
|
name: "{{ open.name }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
register: close_idem
|
register: close_idem
|
||||||
- name: Closed (via name, idempotent, check)
|
- name: Closed (via name, idempotent, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
name: "{{ open.name }}"
|
name: "{{ open.name }}"
|
||||||
state: closed
|
state: closed
|
||||||
check_mode: true
|
check_mode: true
|
||||||
become: true
|
become: true
|
||||||
register: close_idem_check
|
register: close_idem_check
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- close_check is changed
|
- close_check is changed
|
||||||
- close is changed
|
- close is changed
|
||||||
@@ -119,39 +119,39 @@
|
|||||||
- close_idem_check is not changed
|
- close_idem_check is not changed
|
||||||
|
|
||||||
- name: Re-open
|
- name: Re-open
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Closed (via device, check)
|
- name: Closed (via device, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
check_mode: true
|
check_mode: true
|
||||||
become: true
|
become: true
|
||||||
register: close_check
|
register: close_check
|
||||||
- name: Closed (via device)
|
- name: Closed (via device)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
register: close
|
register: close
|
||||||
- name: Closed (via device, idempotent)
|
- name: Closed (via device, idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
register: close_idem
|
register: close_idem
|
||||||
- name: Closed (via device, idempotent, check)
|
- name: Closed (via device, idempotent, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
check_mode: true
|
check_mode: true
|
||||||
become: true
|
become: true
|
||||||
register: close_idem_check
|
register: close_idem_check
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- close_check is changed
|
- close_check is changed
|
||||||
- close is changed
|
- close is changed
|
||||||
@@ -159,39 +159,39 @@
|
|||||||
- close_idem_check is not changed
|
- close_idem_check is not changed
|
||||||
|
|
||||||
- name: Re-opened
|
- name: Re-opened
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Absent (check)
|
- name: Absent (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: absent
|
state: absent
|
||||||
check_mode: true
|
check_mode: true
|
||||||
become: true
|
become: true
|
||||||
register: absent_check
|
register: absent_check
|
||||||
- name: Absent
|
- name: Absent
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: absent
|
state: absent
|
||||||
become: true
|
become: true
|
||||||
register: absent
|
register: absent
|
||||||
- name: Absent (idempotence)
|
- name: Absent (idempotence)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: absent
|
state: absent
|
||||||
become: true
|
become: true
|
||||||
register: absent_idem
|
register: absent_idem
|
||||||
- name: Absent (idempotence, check)
|
- name: Absent (idempotence, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: absent
|
state: absent
|
||||||
check_mode: true
|
check_mode: true
|
||||||
become: true
|
become: true
|
||||||
register: absent_idem_check
|
register: absent_idem_check
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- absent_check is changed
|
- absent_check is changed
|
||||||
- absent is changed
|
- absent is changed
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Fix name
|
- name: Fix name
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
cryptname: "crypt{{ '%0x' % ((2**32) | random) }}"
|
cryptname: "crypt{{ '%0x' % ((2**32) | random) }}"
|
||||||
|
|
||||||
- name: Create
|
- name: Create
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
name: "{{ cryptname }}"
|
name: "{{ cryptname }}"
|
||||||
state: present
|
state: present
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create
|
register: create
|
||||||
- name: Open
|
- name: Open
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
name: "{{ cryptname }}"
|
name: "{{ cryptname }}"
|
||||||
state: opened
|
state: opened
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: open
|
register: open
|
||||||
- name: Open (idempotent)
|
- name: Open (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
name: "{{ cryptname }}"
|
name: "{{ cryptname }}"
|
||||||
state: opened
|
state: opened
|
||||||
@@ -34,25 +34,25 @@
|
|||||||
become: true
|
become: true
|
||||||
register: open_idem
|
register: open_idem
|
||||||
- name: Closed (via name)
|
- name: Closed (via name)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
name: "{{ cryptname }}"
|
name: "{{ cryptname }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
register: close
|
register: close
|
||||||
- name: Closed (via name, idempotent)
|
- name: Closed (via name, idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
name: "{{ cryptname }}"
|
name: "{{ cryptname }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
register: close_idem
|
register: close_idem
|
||||||
- name: Absent
|
- name: Absent
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
name: "{{ cryptname }}"
|
name: "{{ cryptname }}"
|
||||||
state: absent
|
state: absent
|
||||||
become: true
|
become: true
|
||||||
register: absent
|
register: absent
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- create is changed
|
- create is changed
|
||||||
- open is changed
|
- open is changed
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Create with invalid device name (check)
|
- name: Create with invalid device name (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: /dev/asdfasdfasdf
|
device: /dev/asdfasdfasdf
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_check
|
register: create_check
|
||||||
- name: Create with invalid device name
|
- name: Create with invalid device name
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: /dev/asdfasdfasdf
|
device: /dev/asdfasdfasdf
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
become: true
|
become: true
|
||||||
register: create
|
register: create
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- create_check is failed
|
- create_check is failed
|
||||||
- create is failed
|
- create is failed
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
- "'o such file or directory' in create.msg"
|
- "'o such file or directory' in create.msg"
|
||||||
|
|
||||||
- name: Create with something which is not a device (check)
|
- name: Create with something which is not a device (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: /tmp/
|
device: /tmp/
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_check
|
register: create_check
|
||||||
- name: Create with something which is not a device
|
- name: Create with something which is not a device
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: /tmp/
|
device: /tmp/
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
become: true
|
become: true
|
||||||
register: create
|
register: create
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- create_check is failed
|
- create_check is failed
|
||||||
- create is failed
|
- create is failed
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Create with keyfile1
|
- name: Create with keyfile1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -15,36 +15,36 @@
|
|||||||
# Access: keyfile1
|
# Access: keyfile1
|
||||||
|
|
||||||
- name: Try to open with keyfile1
|
- name: Try to open with keyfile1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
- name: Close
|
- name: Close
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Try to open with keyfile2
|
- name: Try to open with keyfile2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is failed
|
- open_try is failed
|
||||||
|
|
||||||
- name: Give access to keyfile2
|
- name: Give access to keyfile2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
register: result_1
|
register: result_1
|
||||||
|
|
||||||
- name: Give access to keyfile2 (idempotent)
|
- name: Give access to keyfile2 (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: result_2
|
register: result_2
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result_1 is changed
|
- result_1 is changed
|
||||||
- result_2 is not changed
|
- result_2 is not changed
|
||||||
@@ -71,28 +71,28 @@
|
|||||||
# Access: keyfile1 and keyfile2
|
# Access: keyfile1 and keyfile2
|
||||||
|
|
||||||
- name: Try to open with keyfile2
|
- name: Try to open with keyfile2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
- name: Close
|
- name: Close
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Dump LUKS header
|
- name: Dump LUKS header
|
||||||
command: "cryptsetup luksDump {{ cryptfile_device }}"
|
ansible.builtin.command: "cryptsetup luksDump {{ cryptfile_device }}"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Remove access from keyfile1
|
- name: Remove access from keyfile1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
register: result_1
|
register: result_1
|
||||||
|
|
||||||
- name: Remove access from keyfile1 (idempotent)
|
- name: Remove access from keyfile1 (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: result_2
|
register: result_2
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result_1 is changed
|
- result_1 is changed
|
||||||
- result_2 is not changed
|
- result_2 is not changed
|
||||||
@@ -117,40 +117,40 @@
|
|||||||
# Access: keyfile2
|
# Access: keyfile2
|
||||||
|
|
||||||
- name: Try to open with keyfile1
|
- name: Try to open with keyfile1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is failed
|
- open_try is failed
|
||||||
|
|
||||||
- name: Try to open with keyfile2
|
- name: Try to open with keyfile2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
- name: Close
|
- name: Close
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Dump LUKS header
|
- name: Dump LUKS header
|
||||||
command: "cryptsetup luksDump {{ cryptfile_device }}"
|
ansible.builtin.command: "cryptsetup luksDump {{ cryptfile_device }}"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Remove access from keyfile2
|
- name: Remove access from keyfile2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
@@ -158,7 +158,7 @@
|
|||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: remove_last_key
|
register: remove_last_key
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- remove_last_key is failed
|
- remove_last_key is failed
|
||||||
- "'force_remove_last_key' in remove_last_key.msg"
|
- "'force_remove_last_key' in remove_last_key.msg"
|
||||||
@@ -166,24 +166,24 @@
|
|||||||
# Access: keyfile2
|
# Access: keyfile2
|
||||||
|
|
||||||
- name: Try to open with keyfile2
|
- name: Try to open with keyfile2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
- name: Close
|
- name: Close
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Remove access from keyfile2
|
- name: Remove access from keyfile2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
@@ -194,13 +194,13 @@
|
|||||||
# Access: none
|
# Access: none
|
||||||
|
|
||||||
- name: Try to open with keyfile2
|
- name: Try to open with keyfile2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is failed
|
- open_try is failed
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Create with keyfile3
|
- name: Create with keyfile3
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
passphrase: "{{ keyfile3 }}"
|
passphrase: "{{ keyfile3 }}"
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
register: create_passphrase_1
|
register: create_passphrase_1
|
||||||
|
|
||||||
- name: Create with keyfile3 (without argon2i)
|
- name: Create with keyfile3 (without argon2i)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
passphrase: "{{ keyfile3 }}"
|
passphrase: "{{ keyfile3 }}"
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
when: create_passphrase_1 is failed
|
when: create_passphrase_1 is failed
|
||||||
|
|
||||||
- name: Open with keyfile3
|
- name: Open with keyfile3
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
passphrase: "{{ keyfile3 }}"
|
passphrase: "{{ keyfile3 }}"
|
||||||
@@ -40,29 +40,29 @@
|
|||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
- name: Close
|
- name: Close
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Try to open with passphrase1
|
- name: Try to open with passphrase1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
passphrase: "{{ cryptfile_passphrase1 }}"
|
passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is failed
|
- open_try is failed
|
||||||
|
|
||||||
- name: Give access to passphrase1
|
- name: Give access to passphrase1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
passphrase: "{{ keyfile3 }}"
|
passphrase: "{{ keyfile3 }}"
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Remove access for keyfile3
|
- name: Remove access for keyfile3
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
remove_passphrase: "{{ keyfile3 }}"
|
remove_passphrase: "{{ keyfile3 }}"
|
||||||
@@ -81,25 +81,25 @@
|
|||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Try to open with keyfile3
|
- name: Try to open with keyfile3
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
passphrase: "{{ keyfile3 }}"
|
passphrase: "{{ keyfile3 }}"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is failed
|
- open_try is failed
|
||||||
|
|
||||||
- name: Open with passphrase1
|
- name: Open with passphrase1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
passphrase: "{{ cryptfile_passphrase1 }}"
|
passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Create luks with keyslot 4 (check)
|
- name: Create luks with keyslot 4 (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_luks_slot4_check
|
register: create_luks_slot4_check
|
||||||
- name: Create luks with keyslot 4
|
- name: Create luks with keyslot 4
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_luks_slot4
|
register: create_luks_slot4
|
||||||
- name: Create luks with keyslot 4 (idempotent)
|
- name: Create luks with keyslot 4 (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_luks_slot4_idem
|
register: create_luks_slot4_idem
|
||||||
- name: Create luks with keyslot 4 (idempotent, check)
|
- name: Create luks with keyslot 4 (idempotent, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -46,10 +46,10 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_luks_slot4_idem_check
|
register: create_luks_slot4_idem_check
|
||||||
- name: Dump luks header
|
- name: Dump luks header
|
||||||
command: "cryptsetup luksDump {{ cryptfile_device }}"
|
ansible.builtin.command: "cryptsetup luksDump {{ cryptfile_device }}"
|
||||||
become: true
|
become: true
|
||||||
register: luks_header_slot4
|
register: luks_header_slot4
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- create_luks_slot4_check is changed
|
- create_luks_slot4_check is changed
|
||||||
- create_luks_slot4 is changed
|
- create_luks_slot4 is changed
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
- "'Key Slot 4: ENABLED' in luks_header_slot4.stdout or '4: luks2' in luks_header_slot4.stdout"
|
- "'Key Slot 4: ENABLED' in luks_header_slot4.stdout or '4: luks2' in luks_header_slot4.stdout"
|
||||||
|
|
||||||
- name: Add key in slot 2 (check)
|
- name: Add key in slot 2 (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: add_luks_slot2_check
|
register: add_luks_slot2_check
|
||||||
- name: Add key in slot 2
|
- name: Add key in slot 2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: add_luks_slot2
|
register: add_luks_slot2
|
||||||
- name: Add key in slot 2 (idempotent)
|
- name: Add key in slot 2 (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: add_luks_slot2_idem
|
register: add_luks_slot2_idem
|
||||||
- name: Add key in slot 2 (idempotent, check)
|
- name: Add key in slot 2 (idempotent, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -104,10 +104,10 @@
|
|||||||
become: true
|
become: true
|
||||||
register: add_luks_slot2_idem_check
|
register: add_luks_slot2_idem_check
|
||||||
- name: Dump luks header
|
- name: Dump luks header
|
||||||
command: "cryptsetup luksDump {{ cryptfile_device }}"
|
ansible.builtin.command: "cryptsetup luksDump {{ cryptfile_device }}"
|
||||||
become: true
|
become: true
|
||||||
register: luks_header_slot2
|
register: luks_header_slot2
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- add_luks_slot2_check is changed
|
- add_luks_slot2_check is changed
|
||||||
- add_luks_slot2 is changed
|
- add_luks_slot2 is changed
|
||||||
@@ -116,27 +116,27 @@
|
|||||||
- "'Key Slot 2: ENABLED' in luks_header_slot2.stdout or '2: luks2' in luks_header_slot2.stdout"
|
- "'Key Slot 2: ENABLED' in luks_header_slot2.stdout or '2: luks2' in luks_header_slot2.stdout"
|
||||||
|
|
||||||
- name: Check remove slot 4 without key
|
- name: Check remove slot 4 without key
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
remove_keyslot: 4
|
remove_keyslot: 4
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
become: true
|
become: true
|
||||||
register: kill_slot4_nokey
|
register: kill_slot4_nokey
|
||||||
- name: Check remove slot 4 with slot 4 key
|
- name: Check remove slot 4 with slot 4 key
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
remove_keyslot: 4
|
remove_keyslot: 4
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
become: true
|
become: true
|
||||||
register: kill_slot4_key_slot4
|
register: kill_slot4_key_slot4
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- kill_slot4_nokey is failed
|
- kill_slot4_nokey is failed
|
||||||
- kill_slot4_key_slot4 is failed
|
- kill_slot4_key_slot4 is failed
|
||||||
|
|
||||||
- name: Remove key in slot 4 (check)
|
- name: Remove key in slot 4 (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
remove_keyslot: 4
|
remove_keyslot: 4
|
||||||
@@ -144,21 +144,21 @@
|
|||||||
become: true
|
become: true
|
||||||
register: kill_luks_slot4_check
|
register: kill_luks_slot4_check
|
||||||
- name: Remove key in slot 4
|
- name: Remove key in slot 4
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
remove_keyslot: 4
|
remove_keyslot: 4
|
||||||
become: true
|
become: true
|
||||||
register: kill_luks_slot4
|
register: kill_luks_slot4
|
||||||
- name: Remove key in slot 4 (idempotent)
|
- name: Remove key in slot 4 (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
remove_keyslot: 4
|
remove_keyslot: 4
|
||||||
become: true
|
become: true
|
||||||
register: kill_luks_slot4_idem
|
register: kill_luks_slot4_idem
|
||||||
- name: Remove key in slot 4 (idempotent)
|
- name: Remove key in slot 4 (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
remove_keyslot: 4
|
remove_keyslot: 4
|
||||||
@@ -166,10 +166,10 @@
|
|||||||
become: true
|
become: true
|
||||||
register: kill_luks_slot4_idem_check
|
register: kill_luks_slot4_idem_check
|
||||||
- name: Dump luks header
|
- name: Dump luks header
|
||||||
command: "cryptsetup luksDump {{ cryptfile_device }}"
|
ansible.builtin.command: "cryptsetup luksDump {{ cryptfile_device }}"
|
||||||
become: true
|
become: true
|
||||||
register: luks_header_slot4_removed
|
register: luks_header_slot4_removed
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- kill_luks_slot4_check is changed
|
- kill_luks_slot4_check is changed
|
||||||
- kill_luks_slot4 is changed
|
- kill_luks_slot4 is changed
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
- "'Key Slot 4: DISABLED' in luks_header_slot4_removed.stdout or not '4: luks' in luks_header_slot4_removed.stdout"
|
- "'Key Slot 4: DISABLED' in luks_header_slot4_removed.stdout or not '4: luks' in luks_header_slot4_removed.stdout"
|
||||||
|
|
||||||
- name: Add key in slot 0
|
- name: Add key in slot 0
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
@@ -189,17 +189,17 @@
|
|||||||
become: true
|
become: true
|
||||||
register: add_luks_slot0
|
register: add_luks_slot0
|
||||||
- name: Remove key in slot 0
|
- name: Remove key in slot 0
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
keyfile: "{{ remote_tmp_dir }}/keyfile2"
|
||||||
remove_keyslot: 0
|
remove_keyslot: 0
|
||||||
become: true
|
become: true
|
||||||
register: kill_luks_slot0
|
register: kill_luks_slot0
|
||||||
- name: Dump luks header
|
- name: Dump luks header
|
||||||
command: "cryptsetup luksDump {{ cryptfile_device }}"
|
ansible.builtin.command: "cryptsetup luksDump {{ cryptfile_device }}"
|
||||||
become: true
|
become: true
|
||||||
register: luks_header_slot0_removed
|
register: luks_header_slot0_removed
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- add_luks_slot0 is changed
|
- add_luks_slot0 is changed
|
||||||
- kill_luks_slot0 is changed
|
- kill_luks_slot0 is changed
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Create new luks
|
- name: Create new luks
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
iteration_time: 0.1
|
iteration_time: 0.1
|
||||||
become: true
|
become: true
|
||||||
- name: Add new keyslot with same keyfile (check)
|
- name: Add new keyslot with same keyfile (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
new_keyslot: 1
|
new_keyslot: 1
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
register: keyslot_duplicate_check
|
register: keyslot_duplicate_check
|
||||||
- name: Add new keyslot with same keyfile
|
- name: Add new keyslot with same keyfile
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
new_keyslot: 1
|
new_keyslot: 1
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: keyslot_duplicate
|
register: keyslot_duplicate
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- keyslot_duplicate_check is failed
|
- keyslot_duplicate_check is failed
|
||||||
- "'Trying to add key that is already present in another slot' in keyslot_duplicate_check.msg"
|
- "'Trying to add key that is already present in another slot' in keyslot_duplicate_check.msg"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Check invalid slot (luks1, 8)
|
- name: Check invalid slot (luks1, 8)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
type: luks1
|
type: luks1
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_luks1_slot8
|
register: create_luks1_slot8
|
||||||
- name: Check invalid slot (luks2, 32)
|
- name: Check invalid slot (luks2, 32)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
type: luks2
|
type: luks2
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_luks2_slot32
|
register: create_luks2_slot32
|
||||||
- name: Check invalid slot (no luks type, 8)
|
- name: Check invalid slot (no luks type, 8)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -38,14 +38,14 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
become: true
|
become: true
|
||||||
register: create_luks_slot8
|
register: create_luks_slot8
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- create_luks1_slot8 is failed
|
- create_luks1_slot8 is failed
|
||||||
- create_luks2_slot32 is failed
|
- create_luks2_slot32 is failed
|
||||||
- create_luks_slot8 is failed
|
- create_luks_slot8 is failed
|
||||||
|
|
||||||
- name: Check valid slot (luks2, 8)
|
- name: Check valid slot (luks2, 8)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
type: luks2
|
type: luks2
|
||||||
@@ -57,12 +57,12 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: create_luks2_slot8
|
register: create_luks2_slot8
|
||||||
- name: Make sure that the previous task only fails if LUKS2 is not supported
|
- name: Make sure that the previous task only fails if LUKS2 is not supported
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'Unknown option --type' in create_luks2_slot8.msg"
|
- "'Unknown option --type' in create_luks2_slot8.msg"
|
||||||
when: create_luks2_slot8 is failed
|
when: create_luks2_slot8 is failed
|
||||||
- name: Check add valid slot (no luks type, 10)
|
- name: Check add valid slot (no luks type, 10)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_luks_slot10
|
register: create_luks_slot10
|
||||||
when: create_luks2_slot8 is changed
|
when: create_luks2_slot8 is changed
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- create_luks_slot10 is changed
|
- create_luks_slot10 is changed
|
||||||
when: create_luks2_slot8 is changed
|
when: create_luks2_slot8 is changed
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Create with keysize
|
- name: Create with keysize
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_with_keysize
|
register: create_with_keysize
|
||||||
- name: Create with keysize (idempotent)
|
- name: Create with keysize (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_idem_with_keysize
|
register: create_idem_with_keysize
|
||||||
- name: Create with different keysize (idempotent since we do not update keysize)
|
- name: Create with different keysize (idempotent since we do not update keysize)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_idem_with_diff_keysize
|
register: create_idem_with_diff_keysize
|
||||||
- name: Create with ambiguous arguments
|
- name: Create with ambiguous arguments
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_with_ambiguous
|
register: create_with_ambiguous
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- create_with_keysize is changed
|
- create_with_keysize is changed
|
||||||
- create_idem_with_keysize is not changed
|
- create_idem_with_keysize is not changed
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Create with passphrase1
|
- name: Create with passphrase1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
passphrase: "{{ cryptfile_passphrase1 }}"
|
passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
@@ -20,13 +20,13 @@
|
|||||||
register: create_passphrase_1
|
register: create_passphrase_1
|
||||||
|
|
||||||
- name: Make sure that the previous task only fails if LUKS2 is not supported
|
- name: Make sure that the previous task only fails if LUKS2 is not supported
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'Unknown option --type' in create_passphrase_1.msg"
|
- "'Unknown option --type' in create_passphrase_1.msg"
|
||||||
when: create_passphrase_1 is failed
|
when: create_passphrase_1 is failed
|
||||||
|
|
||||||
- name: Create with passphrase1 (without argon2i)
|
- name: Create with passphrase1 (without argon2i)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
passphrase: "{{ cryptfile_passphrase1 }}"
|
passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
when: create_passphrase_1 is failed
|
when: create_passphrase_1 is failed
|
||||||
|
|
||||||
- name: Open with passphrase1
|
- name: Open with passphrase1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
# Encode passphrase with Base64 to test passphrase_encoding
|
# Encode passphrase with Base64 to test passphrase_encoding
|
||||||
@@ -45,17 +45,17 @@
|
|||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
- name: Close
|
- name: Close
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Give access with ambiguous new_ arguments
|
- name: Give access with ambiguous new_ arguments
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
passphrase: "{{ cryptfile_passphrase1 }}"
|
passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
@@ -66,24 +66,24 @@
|
|||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: new_try
|
register: new_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- new_try is failed
|
- new_try is failed
|
||||||
|
|
||||||
- name: Try to open with passphrase2
|
- name: Try to open with passphrase2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
passphrase: "{{ cryptfile_passphrase2 }}"
|
passphrase: "{{ cryptfile_passphrase2 }}"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is failed
|
- open_try is failed
|
||||||
|
|
||||||
- name: Give access to passphrase2
|
- name: Give access to passphrase2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
passphrase: "{{ cryptfile_passphrase1 }}"
|
passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
register: result_1
|
register: result_1
|
||||||
|
|
||||||
- name: Give access to passphrase2 (idempotent)
|
- name: Give access to passphrase2 (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
passphrase: "{{ cryptfile_passphrase1 }}"
|
passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
@@ -102,42 +102,42 @@
|
|||||||
become: true
|
become: true
|
||||||
register: result_2
|
register: result_2
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result_1 is changed
|
- result_1 is changed
|
||||||
- result_2 is not changed
|
- result_2 is not changed
|
||||||
|
|
||||||
- name: Open with passphrase2
|
- name: Open with passphrase2
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
passphrase: "{{ cryptfile_passphrase2 }}"
|
passphrase: "{{ cryptfile_passphrase2 }}"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
- name: Close
|
- name: Close
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Try to open with keyfile1
|
- name: Try to open with keyfile1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is failed
|
- open_try is failed
|
||||||
|
|
||||||
- name: Give access to keyfile1 from passphrase1
|
- name: Give access to keyfile1 from passphrase1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
passphrase: "{{ cryptfile_passphrase1 }}"
|
passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Remove access with ambiguous remove_ arguments
|
- name: Remove access with ambiguous remove_ arguments
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
remove_keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
remove_keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -155,29 +155,29 @@
|
|||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: remove_try
|
register: remove_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- remove_try is failed
|
- remove_try is failed
|
||||||
|
|
||||||
- name: Open with keyfile1
|
- name: Open with keyfile1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
- name: Close
|
- name: Close
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Remove access for passphrase1
|
- name: Remove access for passphrase1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
remove_passphrase: "{{ cryptfile_passphrase1 }}"
|
remove_passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
@@ -185,44 +185,44 @@
|
|||||||
register: result_1
|
register: result_1
|
||||||
|
|
||||||
- name: Remove access for passphrase1 (idempotent)
|
- name: Remove access for passphrase1 (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
remove_passphrase: "{{ cryptfile_passphrase1 }}"
|
remove_passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
become: true
|
become: true
|
||||||
register: result_2
|
register: result_2
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result_1 is changed
|
- result_1 is changed
|
||||||
- result_2 is not changed
|
- result_2 is not changed
|
||||||
|
|
||||||
- name: Try to open with passphrase1
|
- name: Try to open with passphrase1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
passphrase: "{{ cryptfile_passphrase1 }}"
|
passphrase: "{{ cryptfile_passphrase1 }}"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is failed
|
- open_try is failed
|
||||||
|
|
||||||
- name: Try to open with passphrase3
|
- name: Try to open with passphrase3
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
passphrase: "{{ cryptfile_passphrase3 }}"
|
passphrase: "{{ cryptfile_passphrase3 }}"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is failed
|
- open_try is failed
|
||||||
|
|
||||||
- name: Give access to passphrase3 from keyfile1
|
- name: Give access to passphrase3 from keyfile1
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -232,18 +232,18 @@
|
|||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Open with passphrase3
|
- name: Open with passphrase3
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
passphrase: "{{ cryptfile_passphrase3 }}"
|
passphrase: "{{ cryptfile_passphrase3 }}"
|
||||||
become: true
|
become: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: open_try
|
register: open_try
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- open_try is not failed
|
- open_try is not failed
|
||||||
- name: Close
|
- name: Close
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: closed
|
state: closed
|
||||||
become: true
|
become: true
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
- name: On kernel >= 5.9 use performance flags
|
- name: On kernel >= 5.9 use performance flags
|
||||||
block:
|
block:
|
||||||
- name: Create and open (check)
|
- name: Create and open (check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_open_check
|
register: create_open_check
|
||||||
- name: Create and open
|
- name: Create and open
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_open
|
register: create_open
|
||||||
- name: Create and open (idempotent)
|
- name: Create and open (idempotent)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: opened
|
state: opened
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: create_open_idem
|
register: create_open_idem
|
||||||
- name: Create and open (idempotent, check)
|
- name: Create and open (idempotent, check)
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
device: "{{ cryptfile_device }}"
|
device: "{{ cryptfile_device }}"
|
||||||
state: present
|
state: present
|
||||||
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
keyfile: "{{ remote_tmp_dir }}/keyfile1"
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
become: true
|
become: true
|
||||||
register: create_open_idem_check
|
register: create_open_idem_check
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- create_open_check is changed
|
- create_open_check is changed
|
||||||
- create_open is changed
|
- create_open is changed
|
||||||
@@ -75,10 +75,10 @@
|
|||||||
- create_open_idem_check is not changed
|
- create_open_idem_check is not changed
|
||||||
|
|
||||||
- name: Dump LUKS Header
|
- name: Dump LUKS Header
|
||||||
command: "cryptsetup luksDump {{ cryptfile_device }}"
|
ansible.builtin.command: "cryptsetup luksDump {{ cryptfile_device }}"
|
||||||
become: true
|
become: true
|
||||||
register: luks_header
|
register: luks_header
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'no-read-workqueue' in luks_header.stdout"
|
- "'no-read-workqueue' in luks_header.stdout"
|
||||||
- "'no-write-workqueue' in luks_header.stdout"
|
- "'no-write-workqueue' in luks_header.stdout"
|
||||||
@@ -87,10 +87,10 @@
|
|||||||
- "'allow-discards' in luks_header.stdout"
|
- "'allow-discards' in luks_header.stdout"
|
||||||
|
|
||||||
- name: Dump device mapper table
|
- name: Dump device mapper table
|
||||||
command: "dmsetup table {{ create_open.name }}"
|
ansible.builtin.command: "dmsetup table {{ create_open.name }}"
|
||||||
become: true
|
become: true
|
||||||
register: dm_table
|
register: dm_table
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'no_read_workqueue' in dm_table.stdout"
|
- "'no_read_workqueue' in dm_table.stdout"
|
||||||
- "'no_write_workqueue' in dm_table.stdout"
|
- "'no_write_workqueue' in dm_table.stdout"
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
- "'allow_discards' in dm_table.stdout"
|
- "'allow_discards' in dm_table.stdout"
|
||||||
|
|
||||||
- name: Closed and Removed
|
- name: Closed and Removed
|
||||||
luks_device:
|
community.crypto.luks_device:
|
||||||
name: "{{ cryptfile_device }}"
|
name: "{{ cryptfile_device }}"
|
||||||
state: absent
|
state: absent
|
||||||
become: true
|
become: true
|
||||||
|
|||||||
@@ -9,39 +9,39 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Declare global variables
|
- name: Declare global variables
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
signing_key: '{{ remote_tmp_dir }}/id_key'
|
signing_key: '{{ remote_tmp_dir }}/id_key'
|
||||||
public_key: '{{ remote_tmp_dir }}/id_key.pub'
|
public_key: '{{ remote_tmp_dir }}/id_key.pub'
|
||||||
certificate_path: '{{ remote_tmp_dir }}/id_cert'
|
certificate_path: '{{ remote_tmp_dir }}/id_cert'
|
||||||
|
|
||||||
- name: Generate keypair
|
- name: Generate keypair
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ signing_key }}"
|
path: "{{ signing_key }}"
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Import idempotency tests
|
- name: Import idempotency tests
|
||||||
import_tasks: ../tests/idempotency.yml
|
ansible.builtin.import_tasks: ../tests/idempotency.yml
|
||||||
|
|
||||||
- name: Import key_idempotency tests
|
- name: Import key_idempotency tests
|
||||||
import_tasks: ../tests/key_idempotency.yml
|
ansible.builtin.import_tasks: ../tests/key_idempotency.yml
|
||||||
|
|
||||||
- name: Import options tests
|
- name: Import options tests
|
||||||
import_tasks: ../tests/options_idempotency.yml
|
ansible.builtin.import_tasks: ../tests/options_idempotency.yml
|
||||||
|
|
||||||
- name: Import regenerate tests
|
- name: Import regenerate tests
|
||||||
import_tasks: ../tests/regenerate.yml
|
ansible.builtin.import_tasks: ../tests/regenerate.yml
|
||||||
|
|
||||||
- name: Import remove tests
|
- name: Import remove tests
|
||||||
import_tasks: ../tests/remove.yml
|
ansible.builtin.import_tasks: ../tests/remove.yml
|
||||||
when: not (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "6")
|
when: not (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "6")
|
||||||
|
|
||||||
- name: Import ssh-agent tests
|
- name: Import ssh-agent tests
|
||||||
import_tasks: ../tests/ssh-agent.yml
|
ansible.builtin.import_tasks: ../tests/ssh-agent.yml
|
||||||
when: openssh_version is version("7.6",">=")
|
when: openssh_version is version("7.6",">=")
|
||||||
|
|
||||||
- name: Remove keypair
|
- name: Remove keypair
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ signing_key }}"
|
path: "{{ signing_key }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# and should not be used as examples of how to write Ansible roles #
|
# and should not be used as examples of how to write Ansible roles #
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
test_cases:
|
test_cases:
|
||||||
- test_name: Generate cert - force option (check_mode)
|
- test_name: Generate cert - force option (check_mode)
|
||||||
force: true
|
force: true
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
changed: true
|
changed: true
|
||||||
|
|
||||||
- name: Execute idempotency tests
|
- name: Execute idempotency tests
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
force: "{{ test_case.force | default(omit) }}"
|
force: "{{ test_case.force | default(omit) }}"
|
||||||
identifier: "{{ test_case.identifier | default(omit) }}"
|
identifier: "{{ test_case.identifier | default(omit) }}"
|
||||||
options: "{{ test_case.options | default(omit) }}"
|
options: "{{ test_case.options | default(omit) }}"
|
||||||
@@ -275,7 +275,7 @@
|
|||||||
loop_var: test_case
|
loop_var: test_case
|
||||||
|
|
||||||
- name: Assert task statuses
|
- name: Assert task statuses
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == test_cases[index].changed
|
- result.changed == test_cases[index].changed
|
||||||
loop: "{{ idempotency_test_output.results }}"
|
loop: "{{ idempotency_test_output.results }}"
|
||||||
@@ -284,6 +284,6 @@
|
|||||||
loop_var: result
|
loop_var: result
|
||||||
|
|
||||||
- name: Remove certificate
|
- name: Remove certificate
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
state: absent
|
state: absent
|
||||||
@@ -8,16 +8,16 @@
|
|||||||
# and should not be used as examples of how to write Ansible roles #
|
# and should not be used as examples of how to write Ansible roles #
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
new_signing_key: "{{ remote_tmp_dir }}/new_key"
|
new_signing_key: "{{ remote_tmp_dir }}/new_key"
|
||||||
new_public_key: "{{ remote_tmp_dir }}/new_key.pub"
|
new_public_key: "{{ remote_tmp_dir }}/new_key.pub"
|
||||||
|
|
||||||
- name: Generate new test key
|
- name: Generate new test key
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ new_signing_key }}"
|
path: "{{ new_signing_key }}"
|
||||||
|
|
||||||
- name: Generate cert with original keys
|
- name: Generate cert with original keys
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Generate cert with updated signature algorithm
|
- name: Generate cert with updated signature algorithm
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -38,12 +38,12 @@
|
|||||||
register: updated_signature_algorithm
|
register: updated_signature_algorithm
|
||||||
|
|
||||||
- name: Assert signature algorithm update causes change
|
- name: Assert signature algorithm update causes change
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- updated_signature_algorithm is changed
|
- updated_signature_algorithm is changed
|
||||||
|
|
||||||
- name: Generate cert with updated signature algorithm (idempotent)
|
- name: Generate cert with updated signature algorithm (idempotent)
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -54,13 +54,13 @@
|
|||||||
register: updated_signature_algorithm_idempotent
|
register: updated_signature_algorithm_idempotent
|
||||||
|
|
||||||
- name: Assert signature algorithm update is idempotent
|
- name: Assert signature algorithm update is idempotent
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- updated_signature_algorithm_idempotent is not changed
|
- updated_signature_algorithm_idempotent is not changed
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Generate cert with original signature algorithm
|
- name: Generate cert with original signature algorithm
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
register: second_signature_algorithm
|
register: second_signature_algorithm
|
||||||
|
|
||||||
- name: Assert second signature algorithm update causes change
|
- name: Assert second signature algorithm update causes change
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- second_signature_algorithm is changed
|
- second_signature_algorithm is changed
|
||||||
# RHEL9, Fedora 41 and Rocky 9 disable the SHA-1 algorithms by default, making this test fail with a 'libcrypt' error.
|
# RHEL9, Fedora 41 and Rocky 9 disable the SHA-1 algorithms by default, making this test fail with a 'libcrypt' error.
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
- not (ansible_facts['distribution'] == "Fedora" and (ansible_facts['distribution_major_version'] | int) >= 41)
|
- not (ansible_facts['distribution'] == "Fedora" and (ansible_facts['distribution_major_version'] | int) >= 41)
|
||||||
|
|
||||||
- name: Omit signature algorithm
|
- name: Omit signature algorithm
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -91,12 +91,12 @@
|
|||||||
register: omitted_signature_algorithm
|
register: omitted_signature_algorithm
|
||||||
|
|
||||||
- name: Assert omitted_signature_algorithm does not cause change
|
- name: Assert omitted_signature_algorithm does not cause change
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- omitted_signature_algorithm is not changed
|
- omitted_signature_algorithm is not changed
|
||||||
|
|
||||||
- name: Revert to original certificate
|
- name: Revert to original certificate
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
when: openssh_version is version("7.3", ">=")
|
when: openssh_version is version("7.3", ">=")
|
||||||
|
|
||||||
- name: Generate cert with new signing key
|
- name: Generate cert with new signing key
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
register: new_signing_key_output
|
register: new_signing_key_output
|
||||||
|
|
||||||
- name: Generate cert with new public key
|
- name: Generate cert with new public key
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ new_public_key }}"
|
public_key: "{{ new_public_key }}"
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
register: new_public_key_output
|
register: new_public_key_output
|
||||||
|
|
||||||
- name: Generate cert with new signing key - full idempotency
|
- name: Generate cert with new signing key - full idempotency
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
register: new_signing_key_full_idempotency_output
|
register: new_signing_key_full_idempotency_output
|
||||||
|
|
||||||
- name: Generate cert with new pubic key - full idempotency
|
- name: Generate cert with new pubic key - full idempotency
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ new_public_key }}"
|
public_key: "{{ new_public_key }}"
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
register: new_public_key_full_idempotency_output
|
register: new_public_key_full_idempotency_output
|
||||||
|
|
||||||
- name: Assert changes to public key or signing key results in no change unless idempotency=full
|
- name: Assert changes to public key or signing key results in no change unless idempotency=full
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- new_signing_key_output is not changed
|
- new_signing_key_output is not changed
|
||||||
- new_public_key_output is not changed
|
- new_public_key_output is not changed
|
||||||
@@ -157,11 +157,11 @@
|
|||||||
- new_public_key_full_idempotency_output is changed
|
- new_public_key_full_idempotency_output is changed
|
||||||
|
|
||||||
- name: Remove certificate
|
- name: Remove certificate
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Remove new keypair
|
- name: Remove new keypair
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ new_signing_key }}"
|
path: "{{ new_signing_key }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Generate cert with no options
|
- name: Generate cert with no options
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
register: no_options
|
register: no_options
|
||||||
|
|
||||||
- name: Generate cert with no options with explicit directives
|
- name: Generate cert with no options with explicit directives
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
register: no_options_explicit_directives
|
register: no_options_explicit_directives
|
||||||
|
|
||||||
- name: Generate cert with explicit extension
|
- name: Generate cert with explicit extension
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
register: explicit_extension_before
|
register: explicit_extension_before
|
||||||
|
|
||||||
- name: Generate cert with explicit extension (idempotency)
|
- name: Generate cert with explicit extension (idempotency)
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
register: explicit_extension_after
|
register: explicit_extension_after
|
||||||
|
|
||||||
- name: Generate cert with explicit extension and corresponding directive
|
- name: Generate cert with explicit extension and corresponding directive
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
register: explicit_extension_and_directive
|
register: explicit_extension_and_directive
|
||||||
|
|
||||||
- name: Generate cert with default options
|
- name: Generate cert with default options
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
register: default_options
|
register: default_options
|
||||||
|
|
||||||
- name: Generate cert with relative timestamp
|
- name: Generate cert with relative timestamp
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
register: relative_timestamp
|
register: relative_timestamp
|
||||||
|
|
||||||
- name: Generate cert with ignore_timestamp true
|
- name: Generate cert with ignore_timestamp true
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
register: relative_timestamp_true
|
register: relative_timestamp_true
|
||||||
|
|
||||||
- name: Generate cert with ignore_timestamp false
|
- name: Generate cert with ignore_timestamp false
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
register: relative_timestamp_false
|
register: relative_timestamp_false
|
||||||
|
|
||||||
- name: Generate cert with ignore_timestamp true
|
- name: Generate cert with ignore_timestamp true
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
register: relative_timestamp_invalid_at
|
register: relative_timestamp_invalid_at
|
||||||
|
|
||||||
- name: Generate host cert full_idempotence
|
- name: Generate host cert full_idempotence
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: host
|
type: host
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -153,7 +153,7 @@
|
|||||||
regenerate: full_idempotence
|
regenerate: full_idempotence
|
||||||
|
|
||||||
- name: Generate host cert full_idempotence again
|
- name: Generate host cert full_idempotence again
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: host
|
type: host
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
register: host_cert_full_idempotence
|
register: host_cert_full_idempotence
|
||||||
|
|
||||||
- name: Assert options results
|
- name: Assert options results
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- no_options is changed
|
- no_options is changed
|
||||||
- no_options_explicit_directives is not changed
|
- no_options_explicit_directives is not changed
|
||||||
@@ -179,6 +179,6 @@
|
|||||||
- host_cert_full_idempotence is not changed
|
- host_cert_full_idempotence is not changed
|
||||||
|
|
||||||
- name: Remove certificate
|
- name: Remove certificate
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# and should not be used as examples of how to write Ansible roles #
|
# and should not be used as examples of how to write Ansible roles #
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
test_cases:
|
test_cases:
|
||||||
- test_name: Generate certificate
|
- test_name: Generate certificate
|
||||||
type: user
|
type: user
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
changed: true
|
changed: true
|
||||||
|
|
||||||
- name: Execute regenerate tests
|
- name: Execute regenerate tests
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
force: "{{ test_case.force | default(omit) }}"
|
force: "{{ test_case.force | default(omit) }}"
|
||||||
options: "{{ test_case.options | default(omit) }}"
|
options: "{{ test_case.options | default(omit) }}"
|
||||||
path: "{{ test_case.path | default(omit) }}"
|
path: "{{ test_case.path | default(omit) }}"
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
loop_var: test_case
|
loop_var: test_case
|
||||||
|
|
||||||
- name: Assert task statuses
|
- name: Assert task statuses
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == test_cases[index].changed
|
- result.changed == test_cases[index].changed
|
||||||
loop: "{{ regenerate_tests_output.results }}"
|
loop: "{{ regenerate_tests_output.results }}"
|
||||||
@@ -135,6 +135,6 @@
|
|||||||
loop_var: result
|
loop_var: result
|
||||||
|
|
||||||
- name: Remove certificate
|
- name: Remove certificate
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
path: "{{ certificate_path }}"
|
path: "{{ certificate_path }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# and should not be used as examples of how to write Ansible roles #
|
# and should not be used as examples of how to write Ansible roles #
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
test_cases:
|
test_cases:
|
||||||
- test_name: Generate certificate
|
- test_name: Generate certificate
|
||||||
type: user
|
type: user
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
changed: false
|
changed: false
|
||||||
|
|
||||||
- name: Execute remove tests
|
- name: Execute remove tests
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
options: "{{ test_case.options | default(omit) }}"
|
options: "{{ test_case.options | default(omit) }}"
|
||||||
path: "{{ test_case.path | default(omit) }}"
|
path: "{{ test_case.path | default(omit) }}"
|
||||||
public_key: "{{ test_case.public_key | default(omit) }}"
|
public_key: "{{ test_case.public_key | default(omit) }}"
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
loop_var: test_case
|
loop_var: test_case
|
||||||
|
|
||||||
- name: Assert task statuses
|
- name: Assert task statuses
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == test_cases[index].changed
|
- result.changed == test_cases[index].changed
|
||||||
loop: "{{ remove_test_output.results }}"
|
loop: "{{ remove_test_output.results }}"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
block:
|
block:
|
||||||
- name: Generate always valid cert using agent without key in agent (should fail)
|
- name: Generate always valid cert using agent without key in agent (should fail)
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
signing_key: "{{ signing_key }}"
|
signing_key: "{{ signing_key }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -26,16 +26,16 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Make sure cert creation with agent fails if key not in agent
|
- name: Make sure cert creation with agent fails if key not in agent
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- rc_no_key_in_agent is failed
|
- rc_no_key_in_agent is failed
|
||||||
- "'agent contains no identities' in rc_no_key_in_agent.msg or 'not found in agent' in rc_no_key_in_agent.msg"
|
- "'agent contains no identities' in rc_no_key_in_agent.msg or 'not found in agent' in rc_no_key_in_agent.msg"
|
||||||
|
|
||||||
- name: Add key to agent
|
- name: Add key to agent
|
||||||
command: 'ssh-add {{ signing_key }}'
|
ansible.builtin.command: 'ssh-add {{ signing_key }}'
|
||||||
|
|
||||||
- name: Generate always valid cert with agent (check mode)
|
- name: Generate always valid cert with agent (check mode)
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
signing_key: "{{ signing_key }}"
|
signing_key: "{{ signing_key }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
|
|
||||||
- name: Generate always valid cert with agent
|
- name: Generate always valid cert with agent
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
signing_key: "{{ signing_key }}"
|
signing_key: "{{ signing_key }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
valid_to: forever
|
valid_to: forever
|
||||||
|
|
||||||
- name: Generate always valid cert with agent (idempotent)
|
- name: Generate always valid cert with agent (idempotent)
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
signing_key: "{{ signing_key }}"
|
signing_key: "{{ signing_key }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -67,13 +67,13 @@
|
|||||||
register: rc_cert_with_agent_idempotent
|
register: rc_cert_with_agent_idempotent
|
||||||
|
|
||||||
- name: Check agent idempotency
|
- name: Check agent idempotency
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- rc_cert_with_agent_idempotent is not changed
|
- rc_cert_with_agent_idempotent is not changed
|
||||||
msg: OpenSSH certificate generation without serial number is idempotent.
|
msg: OpenSSH certificate generation without serial number is idempotent.
|
||||||
|
|
||||||
- name: Generate always valid cert with agent (idempotent, check mode)
|
- name: Generate always valid cert with agent (idempotent, check mode)
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
type: user
|
type: user
|
||||||
signing_key: "{{ signing_key }}"
|
signing_key: "{{ signing_key }}"
|
||||||
public_key: "{{ public_key }}"
|
public_key: "{{ public_key }}"
|
||||||
@@ -84,6 +84,6 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
|
|
||||||
- name: Remove certificate
|
- name: Remove certificate
|
||||||
openssh_cert:
|
community.crypto.openssh_cert:
|
||||||
state: absent
|
state: absent
|
||||||
path: '{{ remote_tmp_dir }}/id_cert_with_agent'
|
path: '{{ remote_tmp_dir }}/id_cert_with_agent'
|
||||||
|
|||||||
@@ -9,42 +9,42 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Backend auto-detection test
|
- name: Backend auto-detection test
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/auto_backend_key'
|
path: '{{ remote_tmp_dir }}/auto_backend_key'
|
||||||
state: "{{ item }}"
|
state: "{{ item }}"
|
||||||
loop: ['present', 'absent']
|
loop: ['present', 'absent']
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
backends: ['opensshbin']
|
backends: ['opensshbin']
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
backends: "{{ backends + ['cryptography'] }}"
|
backends: "{{ backends + ['cryptography'] }}"
|
||||||
when: cryptography_version.stdout is version('3.0', '>=') and bcrypt_version.stdout is version('3.1.5', '>=')
|
when: cryptography_version.stdout is version('3.0', '>=') and bcrypt_version.stdout is version('3.1.5', '>=')
|
||||||
|
|
||||||
- include_tasks: ../tests/core.yml
|
- ansible.builtin.include_tasks: ../tests/core.yml
|
||||||
loop: "{{ backends }}"
|
loop: "{{ backends }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: backend
|
loop_var: backend
|
||||||
|
|
||||||
- include_tasks: ../tests/invalid.yml
|
- ansible.builtin.include_tasks: ../tests/invalid.yml
|
||||||
loop: "{{ backends }}"
|
loop: "{{ backends }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: backend
|
loop_var: backend
|
||||||
|
|
||||||
- include_tasks: ../tests/options.yml
|
- ansible.builtin.include_tasks: ../tests/options.yml
|
||||||
loop: "{{ backends }}"
|
loop: "{{ backends }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: backend
|
loop_var: backend
|
||||||
|
|
||||||
- include_tasks: ../tests/regenerate.yml
|
- ansible.builtin.include_tasks: ../tests/regenerate.yml
|
||||||
loop: "{{ backends }}"
|
loop: "{{ backends }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: backend
|
loop_var: backend
|
||||||
|
|
||||||
- include_tasks: ../tests/state.yml
|
- ansible.builtin.include_tasks: ../tests/state.yml
|
||||||
loop: "{{ backends }}"
|
loop: "{{ backends }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: backend
|
loop_var: backend
|
||||||
|
|
||||||
- include_tasks: ../tests/cryptography_backend.yml
|
- ansible.builtin.include_tasks: ../tests/cryptography_backend.yml
|
||||||
when: cryptography_version.stdout is version('3.0', '>=') and bcrypt_version.stdout is version('3.1.5', '>=')
|
when: cryptography_version.stdout is version('3.0', '>=') and bcrypt_version.stdout is version('3.1.5', '>=')
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key (check mode)"
|
- name: "({{ backend }}) Generate key (check mode)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/core"
|
path: "{{ remote_tmp_dir }}/core"
|
||||||
size: 1280
|
size: 1280
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
@@ -17,14 +17,14 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key"
|
- name: "({{ backend }}) Generate key"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/core"
|
path: "{{ remote_tmp_dir }}/core"
|
||||||
size: 1280
|
size: 1280
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
register: core_output
|
register: core_output
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key (check mode idempotent)"
|
- name: "({{ backend }}) Generate key (check mode idempotent)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/core"
|
path: "{{ remote_tmp_dir }}/core"
|
||||||
size: 1280
|
size: 1280
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
@@ -32,18 +32,18 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key (idempotent)"
|
- name: "({{ backend }}) Generate key (idempotent)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/core'
|
path: '{{ remote_tmp_dir }}/core'
|
||||||
size: 1280
|
size: 1280
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
register: idempotency_core_output
|
register: idempotency_core_output
|
||||||
|
|
||||||
- name: "({{ backend }}) Log key return values"
|
- name: "({{ backend }}) Log key return values"
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ core_output }}"
|
msg: "{{ core_output }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert core behavior"
|
- name: "({{ backend }}) Assert core behavior"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- check_core_output is changed
|
- check_core_output is changed
|
||||||
- core_output is changed
|
- core_output is changed
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
- idempotency_core_output is not changed
|
- idempotency_core_output is not changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key returns fingerprint"
|
- name: "({{ backend }}) Assert key returns fingerprint"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- core_output['fingerprint'] is string
|
- core_output['fingerprint'] is string
|
||||||
- core_output['fingerprint'].startswith('SHA256:')
|
- core_output['fingerprint'].startswith('SHA256:')
|
||||||
@@ -60,44 +60,44 @@
|
|||||||
when: not (backend == 'opensshbin' and openssh_version is version('6.8', '<'))
|
when: not (backend == 'opensshbin' and openssh_version is version('6.8', '<'))
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key returns public_key"
|
- name: "({{ backend }}) Assert key returns public_key"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- core_output['public_key'] is string
|
- core_output['public_key'] is string
|
||||||
- core_output['public_key'].startswith('ssh-rsa ')
|
- core_output['public_key'].startswith('ssh-rsa ')
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key returns size value"
|
- name: "({{ backend }}) Assert key returns size value"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- core_output['size']|type_debug == 'int'
|
- core_output['size']|type_debug == 'int'
|
||||||
- core_output['size'] == 1280
|
- core_output['size'] == 1280
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key returns key type"
|
- name: "({{ backend }}) Assert key returns key type"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- core_output['type'] is string
|
- core_output['type'] is string
|
||||||
- core_output['type'] == 'rsa'
|
- core_output['type'] == 'rsa'
|
||||||
|
|
||||||
- name: "({{ backend }}) Retrieve key size from 'ssh-keygen'"
|
- name: "({{ backend }}) Retrieve key size from 'ssh-keygen'"
|
||||||
shell: "ssh-keygen -lf {{ remote_tmp_dir }}/core | grep -o -E '^[0-9]+'"
|
ansible.builtin.shell: "ssh-keygen -lf {{ remote_tmp_dir }}/core | grep -o -E '^[0-9]+'"
|
||||||
register: core_size_ssh_keygen
|
register: core_size_ssh_keygen
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key size matches 'ssh-keygen' output"
|
- name: "({{ backend }}) Assert key size matches 'ssh-keygen' output"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- core_size_ssh_keygen.stdout == '1280'
|
- core_size_ssh_keygen.stdout == '1280'
|
||||||
|
|
||||||
- name: "({{ backend }}) Read core.pub"
|
- name: "({{ backend }}) Read core.pub"
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/core.pub'
|
src: '{{ remote_tmp_dir }}/core.pub'
|
||||||
register: slurp
|
register: slurp
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert public key module return equal to the public key content"
|
- name: "({{ backend }}) Assert public key module return equal to the public key content"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "core_output.public_key == (slurp.content | b64decode).strip('\n ')"
|
- "core_output.public_key == (slurp.content | b64decode).strip('\n ')"
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove key"
|
- name: "({{ backend }}) Remove key"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/core'
|
path: '{{ remote_tmp_dir }}/core'
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: Generate a password protected key
|
- name: Generate a password protected key
|
||||||
command: 'ssh-keygen -f {{ remote_tmp_dir }}/password_protected -N {{ passphrase }}'
|
ansible.builtin.command: 'ssh-keygen -f {{ remote_tmp_dir }}/password_protected -N {{ passphrase }}'
|
||||||
|
|
||||||
- name: Modify the password protected key with passphrase
|
- name: Modify the password protected key with passphrase
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/password_protected'
|
path: '{{ remote_tmp_dir }}/password_protected'
|
||||||
size: 1024
|
size: 1024
|
||||||
passphrase: "{{ passphrase }}"
|
passphrase: "{{ passphrase }}"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
register: password_protected_output
|
register: password_protected_output
|
||||||
|
|
||||||
- name: Check password protected key idempotency
|
- name: Check password protected key idempotency
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/password_protected'
|
path: '{{ remote_tmp_dir }}/password_protected'
|
||||||
size: 1024
|
size: 1024
|
||||||
passphrase: "{{ passphrase }}"
|
passphrase: "{{ passphrase }}"
|
||||||
@@ -23,29 +23,29 @@
|
|||||||
register: password_protected_idempotency_output
|
register: password_protected_idempotency_output
|
||||||
|
|
||||||
- name: Ensure that ssh-keygen can read keys generated with passphrase
|
- name: Ensure that ssh-keygen can read keys generated with passphrase
|
||||||
command: 'ssh-keygen -yf {{ remote_tmp_dir }}/password_protected -P {{ passphrase }}'
|
ansible.builtin.command: 'ssh-keygen -yf {{ remote_tmp_dir }}/password_protected -P {{ passphrase }}'
|
||||||
register: password_protected_ssh_keygen_output
|
register: password_protected_ssh_keygen_output
|
||||||
|
|
||||||
- name: Check that password protected key with passphrase was regenerated
|
- name: Check that password protected key with passphrase was regenerated
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- password_protected_output is changed
|
- password_protected_output is changed
|
||||||
- password_protected_idempotency_output is not changed
|
- password_protected_idempotency_output is not changed
|
||||||
- password_protected_ssh_keygen_output is success
|
- password_protected_ssh_keygen_output is success
|
||||||
|
|
||||||
- name: Remove password protected key
|
- name: Remove password protected key
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/password_protected'
|
path: '{{ remote_tmp_dir }}/password_protected'
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Generate an unprotected key
|
- name: Generate an unprotected key
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/unprotected'
|
path: '{{ remote_tmp_dir }}/unprotected'
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
|
|
||||||
- name: Modify unprotected key with passphrase
|
- name: Modify unprotected key with passphrase
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/unprotected'
|
path: '{{ remote_tmp_dir }}/unprotected'
|
||||||
size: 1280
|
size: 1280
|
||||||
passphrase: "{{ passphrase }}"
|
passphrase: "{{ passphrase }}"
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
register: unprotected_modification_output
|
register: unprotected_modification_output
|
||||||
|
|
||||||
- name: Modify unprotected key with passphrase (force)
|
- name: Modify unprotected key with passphrase (force)
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/unprotected'
|
path: '{{ remote_tmp_dir }}/unprotected'
|
||||||
size: 1280
|
size: 1280
|
||||||
passphrase: "{{ passphrase }}"
|
passphrase: "{{ passphrase }}"
|
||||||
@@ -63,22 +63,22 @@
|
|||||||
register: force_unprotected_modification_output
|
register: force_unprotected_modification_output
|
||||||
|
|
||||||
- name: Check that unprotected key was modified
|
- name: Check that unprotected key was modified
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- unprotected_modification_output is failed
|
- unprotected_modification_output is failed
|
||||||
- force_unprotected_modification_output is changed
|
- force_unprotected_modification_output is changed
|
||||||
|
|
||||||
- name: Remove unprotected key
|
- name: Remove unprotected key
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/unprotected'
|
path: '{{ remote_tmp_dir }}/unprotected'
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Generate PEM encoded key with passphrase
|
- name: Generate PEM encoded key with passphrase
|
||||||
command: 'ssh-keygen -t rsa -b 1280 -f {{ remote_tmp_dir }}/pem_encoded -N {{ passphrase }} -m PEM'
|
ansible.builtin.command: 'ssh-keygen -t rsa -b 1280 -f {{ remote_tmp_dir }}/pem_encoded -N {{ passphrase }} -m PEM'
|
||||||
|
|
||||||
- name: Try to verify a PEM encoded key
|
- name: Try to verify a PEM encoded key
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/pem_encoded'
|
path: '{{ remote_tmp_dir }}/pem_encoded'
|
||||||
passphrase: "{{ passphrase }}"
|
passphrase: "{{ passphrase }}"
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
@@ -86,84 +86,84 @@
|
|||||||
register: pem_encoded_output
|
register: pem_encoded_output
|
||||||
|
|
||||||
- name: Check that PEM encoded file is read without errors
|
- name: Check that PEM encoded file is read without errors
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- pem_encoded_output is not changed
|
- pem_encoded_output is not changed
|
||||||
|
|
||||||
- name: Remove PEM encoded key
|
- name: Remove PEM encoded key
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/pem_encoded'
|
path: '{{ remote_tmp_dir }}/pem_encoded'
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Generate a private key with specified format
|
- name: Generate a private key with specified format
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/private_key_format'
|
path: '{{ remote_tmp_dir }}/private_key_format'
|
||||||
private_key_format: pkcs1
|
private_key_format: pkcs1
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
|
|
||||||
- name: Generate a private key with specified format (Idempotent)
|
- name: Generate a private key with specified format (Idempotent)
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/private_key_format'
|
path: '{{ remote_tmp_dir }}/private_key_format'
|
||||||
private_key_format: pkcs1
|
private_key_format: pkcs1
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
register: private_key_format_idempotent
|
register: private_key_format_idempotent
|
||||||
|
|
||||||
- name: Check that private key with specified format is idempotent
|
- name: Check that private key with specified format is idempotent
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- private_key_format_idempotent is not changed
|
- private_key_format_idempotent is not changed
|
||||||
|
|
||||||
- name: Change to PKCS8 format
|
- name: Change to PKCS8 format
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/private_key_format'
|
path: '{{ remote_tmp_dir }}/private_key_format'
|
||||||
private_key_format: pkcs8
|
private_key_format: pkcs8
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
register: private_key_format_pkcs8
|
register: private_key_format_pkcs8
|
||||||
|
|
||||||
- name: Check that format change causes regeneration
|
- name: Check that format change causes regeneration
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- private_key_format_pkcs8 is changed
|
- private_key_format_pkcs8 is changed
|
||||||
|
|
||||||
- name: Change to PKCS8 format (Idempotent)
|
- name: Change to PKCS8 format (Idempotent)
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/private_key_format'
|
path: '{{ remote_tmp_dir }}/private_key_format'
|
||||||
private_key_format: pkcs8
|
private_key_format: pkcs8
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
register: private_key_format_pkcs8_idempotent
|
register: private_key_format_pkcs8_idempotent
|
||||||
|
|
||||||
- name: Check that private key with PKCS8 format is idempotent
|
- name: Check that private key with PKCS8 format is idempotent
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- private_key_format_pkcs8_idempotent is not changed
|
- private_key_format_pkcs8_idempotent is not changed
|
||||||
|
|
||||||
- name: Change to SSH format
|
- name: Change to SSH format
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/private_key_format'
|
path: '{{ remote_tmp_dir }}/private_key_format'
|
||||||
private_key_format: ssh
|
private_key_format: ssh
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
register: private_key_format_ssh
|
register: private_key_format_ssh
|
||||||
|
|
||||||
- name: Check that format change causes regeneration
|
- name: Check that format change causes regeneration
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- private_key_format_ssh is changed
|
- private_key_format_ssh is changed
|
||||||
|
|
||||||
- name: Change to SSH format (Idempotent)
|
- name: Change to SSH format (Idempotent)
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/private_key_format'
|
path: '{{ remote_tmp_dir }}/private_key_format'
|
||||||
private_key_format: ssh
|
private_key_format: ssh
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
register: private_key_format_ssh_idempotent
|
register: private_key_format_ssh_idempotent
|
||||||
|
|
||||||
- name: Check that private key with SSH format is idempotent
|
- name: Check that private key with SSH format is idempotent
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- private_key_format_ssh_idempotent is not changed
|
- private_key_format_ssh_idempotent is not changed
|
||||||
|
|
||||||
- name: Remove private key with specified format
|
- name: Remove private key with specified format
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/private_key_format'
|
path: '{{ remote_tmp_dir }}/private_key_format'
|
||||||
backend: cryptography
|
backend: cryptography
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key - broken"
|
- name: "({{ backend }}) Generate key - broken"
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
dest: '{{ item }}'
|
dest: '{{ item }}'
|
||||||
content: ''
|
content: ''
|
||||||
mode: '0700'
|
mode: '0700'
|
||||||
@@ -18,91 +18,91 @@
|
|||||||
- "{{ remote_tmp_dir }}/broken.pub"
|
- "{{ remote_tmp_dir }}/broken.pub"
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate key - broken"
|
- name: "({{ backend }}) Regenerate key - broken"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/broken"
|
path: "{{ remote_tmp_dir }}/broken"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
register: broken_output
|
register: broken_output
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert broken key causes failure - broken"
|
- name: "({{ backend }}) Assert broken key causes failure - broken"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- broken_output is failed
|
- broken_output is failed
|
||||||
- "'Unable to read the key. The key is protected with a passphrase or broken.' in broken_output.msg"
|
- "'Unable to read the key. The key is protected with a passphrase or broken.' in broken_output.msg"
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate key with force - broken"
|
- name: "({{ backend }}) Regenerate key with force - broken"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/broken"
|
path: "{{ remote_tmp_dir }}/broken"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
force: true
|
force: true
|
||||||
register: force_broken_output
|
register: force_broken_output
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert broken key regenerated when 'force=true' - broken"
|
- name: "({{ backend }}) Assert broken key regenerated when 'force=true' - broken"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- force_broken_output is changed
|
- force_broken_output is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove key - broken"
|
- name: "({{ backend }}) Remove key - broken"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/broken"
|
path: "{{ remote_tmp_dir }}/broken"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key - write-only"
|
- name: "({{ backend }}) Generate key - write-only"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/write-only"
|
path: "{{ remote_tmp_dir }}/write-only"
|
||||||
mode: "0200"
|
mode: "0200"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Check private key status - write-only"
|
- name: "({{ backend }}) Check private key status - write-only"
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: '{{ remote_tmp_dir }}/write-only'
|
path: '{{ remote_tmp_dir }}/write-only'
|
||||||
register: write_only_private_key
|
register: write_only_private_key
|
||||||
|
|
||||||
- name: "({{ backend }}) Check public key status - write-only"
|
- name: "({{ backend }}) Check public key status - write-only"
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: '{{ remote_tmp_dir }}/write-only.pub'
|
path: '{{ remote_tmp_dir }}/write-only.pub'
|
||||||
register: write_only_public_key
|
register: write_only_public_key
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert that private and public keys match permissions - write-only"
|
- name: "({{ backend }}) Assert that private and public keys match permissions - write-only"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- write_only_private_key.stat.mode == '0200'
|
- write_only_private_key.stat.mode == '0200'
|
||||||
- write_only_public_key.stat.mode == '0200'
|
- write_only_public_key.stat.mode == '0200'
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate key with force - write-only"
|
- name: "({{ backend }}) Regenerate key with force - write-only"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/write-only"
|
path: "{{ remote_tmp_dir }}/write-only"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
force: true
|
force: true
|
||||||
register: write_only_output
|
register: write_only_output
|
||||||
|
|
||||||
- name: "({{ backend }}) Check private key status after regeneration - write-only"
|
- name: "({{ backend }}) Check private key status after regeneration - write-only"
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: '{{ remote_tmp_dir }}/write-only'
|
path: '{{ remote_tmp_dir }}/write-only'
|
||||||
register: write_only_private_key_after
|
register: write_only_private_key_after
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key is regenerated - write-only"
|
- name: "({{ backend }}) Assert key is regenerated - write-only"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- write_only_output is changed
|
- write_only_output is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key permissions are preserved with 'opensshbin'"
|
- name: "({{ backend }}) Assert key permissions are preserved with 'opensshbin'"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- write_only_private_key_after.stat.mode == '0200'
|
- write_only_private_key_after.stat.mode == '0200'
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove key - write-only"
|
- name: "({{ backend }}) Remove key - write-only"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/write-only"
|
path: "{{ remote_tmp_dir }}/write-only"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key with ssh-keygen - password_protected"
|
- name: "({{ backend }}) Generate key with ssh-keygen - password_protected"
|
||||||
command: "ssh-keygen -f {{ remote_tmp_dir }}/password_protected -N {{ passphrase }}"
|
ansible.builtin.command: "ssh-keygen -f {{ remote_tmp_dir }}/password_protected -N {{ passphrase }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Modify key - password_protected"
|
- name: "({{ backend }}) Modify key - password_protected"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/password_protected"
|
path: "{{ remote_tmp_dir }}/password_protected"
|
||||||
size: 1280
|
size: 1280
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
@@ -110,13 +110,13 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key cannot be read - password_protected"
|
- name: "({{ backend }}) Assert key cannot be read - password_protected"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- password_protected_output is failed
|
- password_protected_output is failed
|
||||||
- "'Unable to read the key. The key is protected with a passphrase or broken.' in password_protected_output.msg"
|
- "'Unable to read the key. The key is protected with a passphrase or broken.' in password_protected_output.msg"
|
||||||
|
|
||||||
- name: "({{ backend }}) Modify key with 'force=true' - password_protected"
|
- name: "({{ backend }}) Modify key with 'force=true' - password_protected"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/password_protected"
|
path: "{{ remote_tmp_dir }}/password_protected"
|
||||||
size: 1280
|
size: 1280
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
@@ -124,12 +124,12 @@
|
|||||||
register: force_password_protected_output
|
register: force_password_protected_output
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key regenerated with 'force=true' - password_protected"
|
- name: "({{ backend }}) Assert key regenerated with 'force=true' - password_protected"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- force_password_protected_output is changed
|
- force_password_protected_output is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove key - password_protected"
|
- name: "({{ backend }}) Remove key - password_protected"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/password_protected"
|
path: "{{ remote_tmp_dir }}/password_protected"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
# and should not be used as examples of how to write Ansible roles #
|
# and should not be used as examples of how to write Ansible roles #
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- set_fact:
|
- ansible.builtin.set_fact:
|
||||||
key_types: "{{ key_types_src | reject('equalto', '') | list }}"
|
key_types: "{{ key_types_src | reject('equalto', '') | list }}"
|
||||||
vars:
|
vars:
|
||||||
key_types_src:
|
key_types_src:
|
||||||
@@ -17,61 +17,61 @@
|
|||||||
- ecdsa
|
- ecdsa
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate keys with default size - size"
|
- name: "({{ backend }}) Generate keys with default size - size"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/default_size_{{ item }}"
|
path: "{{ remote_tmp_dir }}/default_size_{{ item }}"
|
||||||
type: "{{ item }}"
|
type: "{{ item }}"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
loop: "{{ key_types }}"
|
loop: "{{ key_types }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Retrieve key size from 'ssh-keygen' - size"
|
- name: "({{ backend }}) Retrieve key size from 'ssh-keygen' - size"
|
||||||
shell: "ssh-keygen -lf {{ remote_tmp_dir }}/default_size_{{ item }} | grep -o -E '^[0-9]+'"
|
ansible.builtin.shell: "ssh-keygen -lf {{ remote_tmp_dir }}/default_size_{{ item }} | grep -o -E '^[0-9]+'"
|
||||||
loop: "{{ key_types }}"
|
loop: "{{ key_types }}"
|
||||||
register: key_size_output
|
register: key_size_output
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key sizes match default size - size"
|
- name: "({{ backend }}) Assert key sizes match default size - size"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- (key_size_output.results | selectattr('item', 'equalto', 'rsa') | first).stdout == '4096'
|
- (key_size_output.results | selectattr('item', 'equalto', 'rsa') | first).stdout == '4096'
|
||||||
- not openssh_supports_dsa or (key_size_output.results | selectattr('item', 'equalto', 'dsa') | first).stdout == '1024'
|
- not openssh_supports_dsa or (key_size_output.results | selectattr('item', 'equalto', 'dsa') | first).stdout == '1024'
|
||||||
- (key_size_output.results | selectattr('item', 'equalto', 'ecdsa') | first).stdout == '256'
|
- (key_size_output.results | selectattr('item', 'equalto', 'ecdsa') | first).stdout == '256'
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove keys - size"
|
- name: "({{ backend }}) Remove keys - size"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/default_size_{{ item }}"
|
path: "{{ remote_tmp_dir }}/default_size_{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ key_types }}"
|
loop: "{{ key_types }}"
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: "({{ backend }}) Generate ed25519 key with default size - size"
|
- name: "({{ backend }}) Generate ed25519 key with default size - size"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/default_size_ed25519"
|
path: "{{ remote_tmp_dir }}/default_size_ed25519"
|
||||||
type: ed25519
|
type: ed25519
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Retrieve ed25519 key size from 'ssh-keygen' - size"
|
- name: "({{ backend }}) Retrieve ed25519 key size from 'ssh-keygen' - size"
|
||||||
shell: "ssh-keygen -lf {{ remote_tmp_dir }}/default_size_ed25519 | grep -o -E '^[0-9]+'"
|
ansible.builtin.shell: "ssh-keygen -lf {{ remote_tmp_dir }}/default_size_ed25519 | grep -o -E '^[0-9]+'"
|
||||||
register: ed25519_key_size_output
|
register: ed25519_key_size_output
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert ed25519 key size matches default size - size"
|
- name: "({{ backend }}) Assert ed25519 key size matches default size - size"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- ed25519_key_size_output.stdout == '256'
|
- ed25519_key_size_output.stdout == '256'
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove ed25519 key - size"
|
- name: "({{ backend }}) Remove ed25519 key - size"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/default_size_ed25519"
|
path: "{{ remote_tmp_dir }}/default_size_ed25519"
|
||||||
state: absent
|
state: absent
|
||||||
# Support for ed25519 keys was added in OpenSSH 6.5
|
# Support for ed25519 keys was added in OpenSSH 6.5
|
||||||
when: not (backend == 'opensshbin' and openssh_version is version('6.5', '<'))
|
when: not (backend == 'opensshbin' and openssh_version is version('6.5', '<'))
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key - force"
|
- name: "({{ backend }}) Generate key - force"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/force"
|
path: "{{ remote_tmp_dir }}/force"
|
||||||
type: rsa
|
type: rsa
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate key - force"
|
- name: "({{ backend }}) Regenerate key - force"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/force"
|
path: "{{ remote_tmp_dir }}/force"
|
||||||
type: rsa
|
type: rsa
|
||||||
force: true
|
force: true
|
||||||
@@ -79,25 +79,25 @@
|
|||||||
register: force_output
|
register: force_output
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key regenerated - force"
|
- name: "({{ backend }}) Assert key regenerated - force"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- force_output is changed
|
- force_output is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove key - force"
|
- name: "({{ backend }}) Remove key - force"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/force"
|
path: "{{ remote_tmp_dir }}/force"
|
||||||
state: absent
|
state: absent
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key - comment"
|
- name: "({{ backend }}) Generate key - comment"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/comment"
|
path: "{{ remote_tmp_dir }}/comment"
|
||||||
comment: "test@comment"
|
comment: "test@comment"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
register: comment_output
|
register: comment_output
|
||||||
|
|
||||||
- name: "({{ backend }}) Modify comment - comment"
|
- name: "({{ backend }}) Modify comment - comment"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/comment"
|
path: "{{ remote_tmp_dir }}/comment"
|
||||||
comment: "test_modified@comment"
|
comment: "test_modified@comment"
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
@@ -106,13 +106,13 @@
|
|||||||
|
|
||||||
- name: "({{ backend }}) Assert comment preserved public key - comment"
|
- name: "({{ backend }}) Assert comment preserved public key - comment"
|
||||||
when: modified_comment_output is succeeded
|
when: modified_comment_output is succeeded
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- comment_output.public_key == modified_comment_output.public_key
|
- comment_output.public_key == modified_comment_output.public_key
|
||||||
- comment_output.comment == 'test@comment'
|
- comment_output.comment == 'test@comment'
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert comment changed - comment"
|
- name: "({{ backend }}) Assert comment changed - comment"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- modified_comment_output.comment == 'test_modified@comment'
|
- modified_comment_output.comment == 'test_modified@comment'
|
||||||
- modified_comment_output is succeeded
|
- modified_comment_output is succeeded
|
||||||
@@ -120,14 +120,14 @@
|
|||||||
when: not (backend == 'opensshbin' and openssh_version is version('7.2', '<'))
|
when: not (backend == 'opensshbin' and openssh_version is version('7.2', '<'))
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert comment not changed - comment"
|
- name: "({{ backend }}) Assert comment not changed - comment"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- modified_comment_output is failed
|
- modified_comment_output is failed
|
||||||
# Support for updating comments for key types other than rsa1 was added in OpenSSH 7.2
|
# Support for updating comments for key types other than rsa1 was added in OpenSSH 7.2
|
||||||
when: backend == 'opensshbin' and openssh_version is version('7.2', '<')
|
when: backend == 'opensshbin' and openssh_version is version('7.2', '<')
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove key - comment"
|
- name: "({{ backend }}) Remove key - comment"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ remote_tmp_dir }}/comment"
|
path: "{{ remote_tmp_dir }}/comment"
|
||||||
state: absent
|
state: absent
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
loop: "{{ old_test_artifacts.files }}"
|
loop: "{{ old_test_artifacts.files }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - setup simple keys"
|
- name: "({{ backend }}) Regenerate - setup simple keys"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
regenerate: "{{ item }}"
|
regenerate: "{{ item }}"
|
||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
- name: "({{ backend }}) Regenerate - setup password protected keys"
|
- name: "({{ backend }}) Regenerate - setup password protected keys"
|
||||||
command: 'ssh-keygen -f {{ remote_tmp_dir }}/regenerate-b-{{ item }} -N {{ passphrase }}'
|
ansible.builtin.command: 'ssh-keygen -f {{ remote_tmp_dir }}/regenerate-b-{{ item }} -N {{ passphrase }}'
|
||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - setup broken keys"
|
- name: "({{ backend }}) Regenerate - setup broken keys"
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
dest: '{{ remote_tmp_dir }}/regenerate-c-{{ item.0 }}{{ item.1 }}'
|
dest: '{{ remote_tmp_dir }}/regenerate-c-{{ item.0 }}{{ item.1 }}'
|
||||||
content: 'broken key'
|
content: 'broken key'
|
||||||
mode: '0700'
|
mode: '0700'
|
||||||
@@ -44,11 +44,11 @@
|
|||||||
- ['', '.pub']
|
- ['', '.pub']
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - setup password protected keys for passphrse test"
|
- name: "({{ backend }}) Regenerate - setup password protected keys for passphrse test"
|
||||||
command: 'ssh-keygen -f {{ remote_tmp_dir }}/regenerate-d-{{ item }} -N {{ passphrase }}'
|
ansible.builtin.command: 'ssh-keygen -f {{ remote_tmp_dir }}/regenerate-d-{{ item }} -N {{ passphrase }}'
|
||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - modify broken keys (check mode)"
|
- name: "({{ backend }}) Regenerate - modify broken keys (check mode)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-c-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-c-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is failed
|
- result.results[0] is failed
|
||||||
- "'Unable to read the key. The key is protected with a passphrase or broken. Will not proceed.' in result.results[0].msg"
|
- "'Unable to read the key. The key is protected with a passphrase or broken. Will not proceed.' in result.results[0].msg"
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - modify broken keys"
|
- name: "({{ backend }}) Regenerate - modify broken keys"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-c-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-c-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is failed
|
- result.results[0] is failed
|
||||||
- "'Unable to read the key. The key is protected with a passphrase or broken. Will not proceed.' in result.results[0].msg"
|
- "'Unable to read the key. The key is protected with a passphrase or broken. Will not proceed.' in result.results[0].msg"
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - modify password protected keys (check mode)"
|
- name: "({{ backend }}) Regenerate - modify password protected keys (check mode)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-b-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-b-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is failed
|
- result.results[0] is failed
|
||||||
- "'Unable to read the key. The key is protected with a passphrase or broken. Will not proceed.' in result.results[0].msg"
|
- "'Unable to read the key. The key is protected with a passphrase or broken. Will not proceed.' in result.results[0].msg"
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - modify password protected keys with passphrase (check mode)"
|
- name: "({{ backend }}) Regenerate - modify password protected keys with passphrase (check mode)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-b-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-b-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
register: result
|
register: result
|
||||||
when: backend == 'cryptography'
|
when: backend == 'cryptography'
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is success
|
- result.results[0] is success
|
||||||
- result.results[1] is failed
|
- result.results[1] is failed
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
when: backend == 'cryptography'
|
when: backend == 'cryptography'
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - modify password protected keys"
|
- name: "({{ backend }}) Regenerate - modify password protected keys"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-b-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-b-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is failed
|
- result.results[0] is failed
|
||||||
- "'Unable to read the key. The key is protected with a passphrase or broken. Will not proceed.' in result.results[0].msg"
|
- "'Unable to read the key. The key is protected with a passphrase or broken. Will not proceed.' in result.results[0].msg"
|
||||||
@@ -158,7 +158,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - modify password protected keys with passphrase"
|
- name: "({{ backend }}) Regenerate - modify password protected keys with passphrase"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-d-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-d-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
register: result
|
register: result
|
||||||
when: backend == 'cryptography'
|
when: backend == 'cryptography'
|
||||||
|
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is success
|
- result.results[0] is success
|
||||||
- result.results[1] is failed
|
- result.results[1] is failed
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
when: backend == 'cryptography'
|
when: backend == 'cryptography'
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - not modify regular keys (check mode)"
|
- name: "({{ backend }}) Regenerate - not modify regular keys (check mode)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
check_mode: true
|
check_mode: true
|
||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is not changed
|
- result.results[0] is not changed
|
||||||
- result.results[1] is not changed
|
- result.results[1] is not changed
|
||||||
@@ -199,7 +199,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - not modify regular keys"
|
- name: "({{ backend }}) Regenerate - not modify regular keys"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1024
|
size: 1024
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is not changed
|
- result.results[0] is not changed
|
||||||
- result.results[1] is not changed
|
- result.results[1] is not changed
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - adjust key size (check mode)"
|
- name: "({{ backend }}) Regenerate - adjust key size (check mode)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1048
|
size: 1048
|
||||||
@@ -226,7 +226,7 @@
|
|||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is success and result.results[0] is not changed
|
- result.results[0] is success and result.results[0] is not changed
|
||||||
- result.results[1] is failed
|
- result.results[1] is failed
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - adjust key size"
|
- name: "({{ backend }}) Regenerate - adjust key size"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
||||||
type: rsa
|
type: rsa
|
||||||
size: 1048
|
size: 1048
|
||||||
@@ -245,7 +245,7 @@
|
|||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is success and result.results[0] is not changed
|
- result.results[0] is success and result.results[0] is not changed
|
||||||
- result.results[1] is failed
|
- result.results[1] is failed
|
||||||
@@ -255,7 +255,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - redistribute keys"
|
- name: "({{ backend }}) Regenerate - redistribute keys"
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: '{{ remote_tmp_dir }}/regenerate-a-always{{ item.1 }}'
|
src: '{{ remote_tmp_dir }}/regenerate-a-always{{ item.1 }}'
|
||||||
dest: '{{ remote_tmp_dir }}/regenerate-a-{{ item.0 }}{{ item.1 }}'
|
dest: '{{ remote_tmp_dir }}/regenerate-a-{{ item.0 }}{{ item.1 }}'
|
||||||
remote_src: true
|
remote_src: true
|
||||||
@@ -270,7 +270,7 @@
|
|||||||
|
|
||||||
block:
|
block:
|
||||||
- name: "({{ backend }}) Regenerate - adjust key type (check mode)"
|
- name: "({{ backend }}) Regenerate - adjust key type (check mode)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
||||||
type: '{{ ssh_type }}'
|
type: '{{ ssh_type }}'
|
||||||
size: '{{ ssh_size }}'
|
size: '{{ ssh_size }}'
|
||||||
@@ -280,7 +280,7 @@
|
|||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is success and result.results[0] is not changed
|
- result.results[0] is success and result.results[0] is not changed
|
||||||
- result.results[1] is failed
|
- result.results[1] is failed
|
||||||
@@ -290,7 +290,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - adjust key type"
|
- name: "({{ backend }}) Regenerate - adjust key type"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
||||||
type: '{{ ssh_type }}'
|
type: '{{ ssh_type }}'
|
||||||
size: '{{ ssh_size }}'
|
size: '{{ ssh_size }}'
|
||||||
@@ -299,7 +299,7 @@
|
|||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.results[0] is success and result.results[0] is not changed
|
- result.results[0] is success and result.results[0] is not changed
|
||||||
- result.results[1] is failed
|
- result.results[1] is failed
|
||||||
@@ -309,7 +309,7 @@
|
|||||||
- result.results[4] is changed
|
- result.results[4] is changed
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - redistribute keys"
|
- name: "({{ backend }}) Regenerate - redistribute keys"
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: '{{ remote_tmp_dir }}/regenerate-a-always{{ item.1 }}'
|
src: '{{ remote_tmp_dir }}/regenerate-a-always{{ item.1 }}'
|
||||||
dest: '{{ remote_tmp_dir }}/regenerate-a-{{ item.0 }}{{ item.1 }}'
|
dest: '{{ remote_tmp_dir }}/regenerate-a-{{ item.0 }}{{ item.1 }}'
|
||||||
remote_src: true
|
remote_src: true
|
||||||
@@ -319,7 +319,7 @@
|
|||||||
when: "item.0 != 'always'"
|
when: "item.0 != 'always'"
|
||||||
|
|
||||||
- name: "({{ backend }}) Regenerate - adjust comment (check mode)"
|
- name: "({{ backend }}) Regenerate - adjust comment (check mode)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
||||||
type: '{{ ssh_type }}'
|
type: '{{ ssh_type }}'
|
||||||
size: '{{ ssh_size }}'
|
size: '{{ ssh_size }}'
|
||||||
@@ -330,7 +330,7 @@
|
|||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@
|
|||||||
- when: not (backend == 'opensshbin' and openssh_version is version('7.2', '<'))
|
- when: not (backend == 'opensshbin' and openssh_version is version('7.2', '<'))
|
||||||
block:
|
block:
|
||||||
- name: "({{ backend }}) Regenerate - adjust comment"
|
- name: "({{ backend }}) Regenerate - adjust comment"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
path: '{{ remote_tmp_dir }}/regenerate-a-{{ item }}'
|
||||||
type: '{{ ssh_type }}'
|
type: '{{ ssh_type }}'
|
||||||
size: '{{ ssh_size }}'
|
size: '{{ ssh_size }}'
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
loop: "{{ regenerate_values }}"
|
loop: "{{ regenerate_values }}"
|
||||||
register: result
|
register: result
|
||||||
- assert:
|
- ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- result is changed
|
||||||
# for all values but 'always', the key should not be regenerated.
|
# for all values but 'always', the key should not be regenerated.
|
||||||
|
|||||||
@@ -9,41 +9,41 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key"
|
- name: "({{ backend }}) Generate key"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/removed'
|
path: '{{ remote_tmp_dir }}/removed'
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "({{ backend }}) Generate key (idempotency)"
|
- name: "({{ backend }}) Generate key (idempotency)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: '{{ remote_tmp_dir }}/removed'
|
path: '{{ remote_tmp_dir }}/removed'
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove key"
|
- name: "({{ backend }}) Remove key"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
state: absent
|
state: absent
|
||||||
path: '{{ remote_tmp_dir }}/removed'
|
path: '{{ remote_tmp_dir }}/removed'
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Remove key (idempotency)"
|
- name: "({{ backend }}) Remove key (idempotency)"
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
state: absent
|
state: absent
|
||||||
path: '{{ remote_tmp_dir }}/removed'
|
path: '{{ remote_tmp_dir }}/removed'
|
||||||
backend: "{{ backend }}"
|
backend: "{{ backend }}"
|
||||||
|
|
||||||
- name: "({{ backend }}) Check private key status"
|
- name: "({{ backend }}) Check private key status"
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: '{{ remote_tmp_dir }}/removed'
|
path: '{{ remote_tmp_dir }}/removed'
|
||||||
register: removed_private_key
|
register: removed_private_key
|
||||||
|
|
||||||
- name: "({{ backend }}) Check public key status"
|
- name: "({{ backend }}) Check public key status"
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: '{{ remote_tmp_dir }}/removed.pub'
|
path: '{{ remote_tmp_dir }}/removed.pub'
|
||||||
register: removed_public_key
|
register: removed_public_key
|
||||||
|
|
||||||
- name: "({{ backend }}) Assert key pair files are removed"
|
- name: "({{ backend }}) Assert key pair files are removed"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- not removed_private_key.stat.exists
|
- not removed_private_key.stat.exists
|
||||||
- not removed_public_key.stat.exists
|
- not removed_public_key.stat.exists
|
||||||
|
|||||||
@@ -4,17 +4,17 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate privatekey"
|
- name: "({{ select_crypto_backend }}) Generate privatekey"
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Read privatekey"
|
- name: "({{ select_crypto_backend }}) Read privatekey"
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/privatekey.pem'
|
src: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
register: privatekey
|
register: privatekey
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (check mode)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (check mode)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr.csr'
|
path: '{{ remote_tmp_dir }}/csr.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
register: generate_csr_check
|
register: generate_csr_check
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR"
|
- name: "({{ select_crypto_backend }}) Generate CSR"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr.csr'
|
path: '{{ remote_tmp_dir }}/csr.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
register: generate_csr
|
register: generate_csr
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr.csr'
|
path: '{{ remote_tmp_dir }}/csr.csr'
|
||||||
privatekey_content: '{{ privatekey.content | b64decode }}'
|
privatekey_content: '{{ privatekey.content | b64decode }}'
|
||||||
subject_ordered:
|
subject_ordered:
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
register: generate_csr_idempotent
|
register: generate_csr_idempotent
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent, check mode)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent, check mode)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr.csr'
|
path: '{{ remote_tmp_dir }}/csr.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
register: generate_csr_idempotent_check
|
register: generate_csr_idempotent_check
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR without SAN (check mode)"
|
- name: "({{ select_crypto_backend }}) Generate CSR without SAN (check mode)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr-nosan.csr'
|
path: '{{ remote_tmp_dir }}/csr-nosan.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
register: generate_csr_nosan_check
|
register: generate_csr_nosan_check
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR without SAN"
|
- name: "({{ select_crypto_backend }}) Generate CSR without SAN"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr-nosan.csr'
|
path: '{{ remote_tmp_dir }}/csr-nosan.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
register: generate_csr_nosan
|
register: generate_csr_nosan
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR without SAN (idempotent)"
|
- name: "({{ select_crypto_backend }}) Generate CSR without SAN (idempotent)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr-nosan.csr'
|
path: '{{ remote_tmp_dir }}/csr-nosan.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
register: generate_csr_nosan_check_idempotent
|
register: generate_csr_nosan_check_idempotent
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR without SAN (idempotent, check mode)"
|
- name: "({{ select_crypto_backend }}) Generate CSR without SAN (idempotent, check mode)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr-nosan.csr'
|
path: '{{ remote_tmp_dir }}/csr-nosan.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
# but the short name is used to test idempotency for ipsecuser
|
# but the short name is used to test idempotency for ipsecuser
|
||||||
# and vice-versa for biometricInfo
|
# and vice-versa for biometricInfo
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with KU and XKU"
|
- name: "({{ select_crypto_backend }}) Generate CSR with KU and XKU"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ku_xku.csr'
|
path: '{{ remote_tmp_dir }}/csr_ku_xku.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with KU and XKU (test idempotency)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with KU and XKU (test idempotency)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ku_xku.csr'
|
path: '{{ remote_tmp_dir }}/csr_ku_xku.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
register: csr_ku_xku
|
register: csr_ku_xku
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with KU and XKU (test XKU change)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with KU and XKU (test XKU change)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ku_xku.csr'
|
path: '{{ remote_tmp_dir }}/csr_ku_xku.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
register: csr_ku_xku_change
|
register: csr_ku_xku_change
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with KU and XKU (test KU change)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with KU and XKU (test KU change)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ku_xku.csr'
|
path: '{{ remote_tmp_dir }}/csr_ku_xku.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -166,14 +166,14 @@
|
|||||||
register: csr_ku_xku_change_2
|
register: csr_ku_xku_change_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with old API"
|
- name: "({{ select_crypto_backend }}) Generate CSR with old API"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_oldapi.csr'
|
path: '{{ remote_tmp_dir }}/csr_oldapi.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
commonName: www.ansible.com
|
commonName: www.ansible.com
|
||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with invalid SAN (1/2)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with invalid SAN (1/2)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csrinvsan.csr'
|
path: '{{ remote_tmp_dir }}/csrinvsan.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject_alt_name: invalid-san.example.com
|
subject_alt_name: invalid-san.example.com
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with invalid SAN (2/2)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with invalid SAN (2/2)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csrinvsan2.csr'
|
path: '{{ remote_tmp_dir }}/csrinvsan2.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject_alt_name: "DNS:system:kube-controller-manager"
|
subject_alt_name: "DNS:system:kube-controller-manager"
|
||||||
@@ -191,7 +191,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with OCSP Must Staple"
|
- name: "({{ select_crypto_backend }}) Generate CSR with OCSP Must Staple"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ocsp.csr'
|
path: '{{ remote_tmp_dir }}/csr_ocsp.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject_alt_name: "DNS:www.ansible.com"
|
subject_alt_name: "DNS:www.ansible.com"
|
||||||
@@ -199,7 +199,7 @@
|
|||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with OCSP Must Staple (test idempotency)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with OCSP Must Staple (test idempotency)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ocsp.csr'
|
path: '{{ remote_tmp_dir }}/csr_ocsp.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject_alt_name: "DNS:www.ansible.com"
|
subject_alt_name: "DNS:www.ansible.com"
|
||||||
@@ -208,13 +208,13 @@
|
|||||||
register: csr_ocsp_idempotency
|
register: csr_ocsp_idempotency
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate ECC privatekey"
|
- name: "({{ select_crypto_backend }}) Generate ECC privatekey"
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
||||||
type: ECC
|
type: ECC
|
||||||
curve: secp384r1
|
curve: secp384r1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with ECC privatekey"
|
- name: "({{ select_crypto_backend }}) Generate CSR with ECC privatekey"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr2.csr'
|
path: '{{ remote_tmp_dir }}/csr2.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with text common name"
|
- name: "({{ select_crypto_backend }}) Generate CSR with text common name"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr3.csr'
|
path: '{{ remote_tmp_dir }}/csr3.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with country name"
|
- name: "({{ select_crypto_backend }}) Generate CSR with country name"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr4.csr'
|
path: '{{ remote_tmp_dir }}/csr4.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
||||||
country_name: de
|
country_name: de
|
||||||
@@ -239,7 +239,7 @@
|
|||||||
register: country_idempotent_1
|
register: country_idempotent_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with country name (idempotent)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with country name (idempotent)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr4.csr'
|
path: '{{ remote_tmp_dir }}/csr4.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
||||||
country_name: de
|
country_name: de
|
||||||
@@ -247,7 +247,7 @@
|
|||||||
register: country_idempotent_2
|
register: country_idempotent_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with country name (idempotent 2)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with country name (idempotent 2)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr4.csr'
|
path: '{{ remote_tmp_dir }}/csr4.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -256,7 +256,7 @@
|
|||||||
register: country_idempotent_3
|
register: country_idempotent_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with country name (bad country name)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with country name (bad country name)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr4.csr'
|
path: '{{ remote_tmp_dir }}/csr4.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -266,19 +266,19 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate privatekey with password"
|
- name: "({{ select_crypto_backend }}) Generate privatekey with password"
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
passphrase: hunter2
|
passphrase: hunter2
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Read privatekey"
|
- name: "({{ select_crypto_backend }}) Read privatekey"
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
src: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
register: privatekeypw
|
register: privatekeypw
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with privatekey passphrase"
|
- name: "({{ select_crypto_backend }}) Generate CSR with privatekey passphrase"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_pw.csr'
|
path: '{{ remote_tmp_dir }}/csr_pw.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
privatekey_passphrase: hunter2
|
privatekey_passphrase: hunter2
|
||||||
@@ -286,7 +286,7 @@
|
|||||||
register: passphrase_1
|
register: passphrase_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with privatekey passphrase and private key content"
|
- name: "({{ select_crypto_backend }}) Generate CSR with privatekey passphrase and private key content"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_pw.csr'
|
path: '{{ remote_tmp_dir }}/csr_pw.csr'
|
||||||
privatekey_content: '{{ privatekeypw.content | b64decode }}'
|
privatekey_content: '{{ privatekeypw.content | b64decode }}'
|
||||||
privatekey_passphrase: hunter2
|
privatekey_passphrase: hunter2
|
||||||
@@ -294,7 +294,7 @@
|
|||||||
register: passphrase_1_content
|
register: passphrase_1_content
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (failed passphrase 1)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (failed passphrase 1)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_pw1.csr'
|
path: '{{ remote_tmp_dir }}/csr_pw1.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
privatekey_passphrase: hunter2
|
privatekey_passphrase: hunter2
|
||||||
@@ -303,7 +303,7 @@
|
|||||||
register: passphrase_error_1
|
register: passphrase_error_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (failed passphrase 2)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (failed passphrase 2)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_pw2.csr'
|
path: '{{ remote_tmp_dir }}/csr_pw2.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
privatekey_passphrase: wrong_password
|
privatekey_passphrase: wrong_password
|
||||||
@@ -312,7 +312,7 @@
|
|||||||
register: passphrase_error_2
|
register: passphrase_error_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (failed passphrase 3)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (failed passphrase 3)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_pw3.csr'
|
path: '{{ remote_tmp_dir }}/csr_pw3.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
@@ -320,11 +320,11 @@
|
|||||||
register: passphrase_error_3
|
register: passphrase_error_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create broken CSR"
|
- name: "({{ select_crypto_backend }}) Create broken CSR"
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
dest: "{{ remote_tmp_dir }}/csrbroken.csr"
|
dest: "{{ remote_tmp_dir }}/csrbroken.csr"
|
||||||
content: "broken"
|
content: "broken"
|
||||||
- name: "({{ select_crypto_backend }}) Regenerate broken CSR"
|
- name: "({{ select_crypto_backend }}) Regenerate broken CSR"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csrbroken.csr'
|
path: '{{ remote_tmp_dir }}/csrbroken.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey2.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -334,7 +334,7 @@
|
|||||||
register: output_broken
|
register: output_broken
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR"
|
- name: "({{ select_crypto_backend }}) Generate CSR"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -343,7 +343,7 @@
|
|||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: csr_backup_1
|
register: csr_backup_1
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -352,7 +352,7 @@
|
|||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: csr_backup_2
|
register: csr_backup_2
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (change)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (change)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -361,7 +361,7 @@
|
|||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: csr_backup_3
|
register: csr_backup_3
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (remove)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (remove)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
||||||
state: absent
|
state: absent
|
||||||
backup: true
|
backup: true
|
||||||
@@ -369,7 +369,7 @@
|
|||||||
return_content: true
|
return_content: true
|
||||||
register: csr_backup_4
|
register: csr_backup_4
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (remove, idempotent)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (remove, idempotent)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
path: '{{ remote_tmp_dir }}/csr_backup.csr'
|
||||||
state: absent
|
state: absent
|
||||||
backup: true
|
backup: true
|
||||||
@@ -377,7 +377,7 @@
|
|||||||
register: csr_backup_5
|
register: csr_backup_5
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier"
|
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -387,7 +387,7 @@
|
|||||||
register: subject_key_identifier_1
|
register: subject_key_identifier_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (idempotency)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (idempotency)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -397,7 +397,7 @@
|
|||||||
register: subject_key_identifier_2
|
register: subject_key_identifier_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (change)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (change)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -407,7 +407,7 @@
|
|||||||
register: subject_key_identifier_3
|
register: subject_key_identifier_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (auto-create)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (auto-create)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -417,7 +417,7 @@
|
|||||||
register: subject_key_identifier_4
|
register: subject_key_identifier_4
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (auto-create idempotency)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (auto-create idempotency)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -427,7 +427,7 @@
|
|||||||
register: subject_key_identifier_5
|
register: subject_key_identifier_5
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (remove)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with subject key identifier (remove)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
path: '{{ remote_tmp_dir }}/csr_ski.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -436,7 +436,7 @@
|
|||||||
register: subject_key_identifier_6
|
register: subject_key_identifier_6
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with authority key identifier"
|
- name: "({{ select_crypto_backend }}) Generate CSR with authority key identifier"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_aki.csr'
|
path: '{{ remote_tmp_dir }}/csr_aki.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -446,7 +446,7 @@
|
|||||||
register: authority_key_identifier_1
|
register: authority_key_identifier_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with authority key identifier (idempotency)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with authority key identifier (idempotency)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_aki.csr'
|
path: '{{ remote_tmp_dir }}/csr_aki.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -456,7 +456,7 @@
|
|||||||
register: authority_key_identifier_2
|
register: authority_key_identifier_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with authority key identifier (change)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with authority key identifier (change)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_aki.csr'
|
path: '{{ remote_tmp_dir }}/csr_aki.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -466,7 +466,7 @@
|
|||||||
register: authority_key_identifier_3
|
register: authority_key_identifier_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with authority key identifier (remove)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with authority key identifier (remove)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_aki.csr'
|
path: '{{ remote_tmp_dir }}/csr_aki.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -475,7 +475,7 @@
|
|||||||
register: authority_key_identifier_4
|
register: authority_key_identifier_4
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number"
|
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -488,7 +488,7 @@
|
|||||||
register: authority_cert_issuer_sn_1
|
register: authority_cert_issuer_sn_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number (idempotency)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number (idempotency)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -501,7 +501,7 @@
|
|||||||
register: authority_cert_issuer_sn_2
|
register: authority_cert_issuer_sn_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number (change issuer)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number (change issuer)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -514,7 +514,7 @@
|
|||||||
register: authority_cert_issuer_sn_3
|
register: authority_cert_issuer_sn_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number (change serial number)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number (change serial number)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -527,7 +527,7 @@
|
|||||||
register: authority_cert_issuer_sn_4
|
register: authority_cert_issuer_sn_4
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number (remove)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with authority cert issuer / serial number (remove)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
path: '{{ remote_tmp_dir }}/csr_acisn.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -535,7 +535,7 @@
|
|||||||
register: authority_cert_issuer_sn_5
|
register: authority_cert_issuer_sn_5
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with everything"
|
- name: "({{ select_crypto_backend }}) Generate CSR with everything"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_everything.csr'
|
path: '{{ remote_tmp_dir }}/csr_everything.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject_ordered:
|
subject_ordered:
|
||||||
@@ -620,7 +620,7 @@
|
|||||||
register: everything_1
|
register: everything_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with everything (idempotent, check mode)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with everything (idempotent, check mode)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_everything.csr'
|
path: '{{ remote_tmp_dir }}/csr_everything.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject_ordered:
|
subject_ordered:
|
||||||
@@ -706,7 +706,7 @@
|
|||||||
register: everything_2
|
register: everything_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with everything (idempotent)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with everything (idempotent)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_everything.csr'
|
path: '{{ remote_tmp_dir }}/csr_everything.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -792,7 +792,7 @@
|
|||||||
register: everything_3
|
register: everything_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR with everything (not idempotent, check mode)"
|
- name: "({{ select_crypto_backend }}) Generate CSR with everything (not idempotent, check mode)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_everything.csr'
|
path: '{{ remote_tmp_dir }}/csr_everything.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject_ordered:
|
subject_ordered:
|
||||||
@@ -887,7 +887,7 @@
|
|||||||
- name: "({{ select_crypto_backend }}) Ed25519 and Ed448 tests (for cryptography >= 2.6)"
|
- name: "({{ select_crypto_backend }}) Ed25519 and Ed448 tests (for cryptography >= 2.6)"
|
||||||
block:
|
block:
|
||||||
- name: "({{ select_crypto_backend }}) Generate privatekeys"
|
- name: "({{ select_crypto_backend }}) Generate privatekeys"
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_{{ item }}.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_{{ item }}.pem'
|
||||||
type: '{{ item }}'
|
type: '{{ item }}'
|
||||||
loop:
|
loop:
|
||||||
@@ -901,7 +901,7 @@
|
|||||||
block:
|
block:
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR"
|
- name: "({{ select_crypto_backend }}) Generate CSR"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_{{ item }}.csr'
|
path: '{{ remote_tmp_dir }}/csr_{{ item }}.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey_{{ item }}.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey_{{ item }}.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -914,7 +914,7 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_{{ item }}.csr'
|
path: '{{ remote_tmp_dir }}/csr_{{ item }}.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey_{{ item }}.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey_{{ item }}.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -931,7 +931,7 @@
|
|||||||
- name: "({{ select_crypto_backend }}) CRL distribution endpoints (for cryptography >= 1.6)"
|
- name: "({{ select_crypto_backend }}) CRL distribution endpoints (for cryptography >= 1.6)"
|
||||||
block:
|
block:
|
||||||
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints"
|
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -953,7 +953,7 @@
|
|||||||
register: crl_distribution_endpoints_1
|
register: crl_distribution_endpoints_1
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints (idempotence)"
|
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints (idempotence)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -975,7 +975,7 @@
|
|||||||
register: crl_distribution_endpoints_2
|
register: crl_distribution_endpoints_2
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints (change)"
|
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints (change)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -995,7 +995,7 @@
|
|||||||
register: crl_distribution_endpoints_3
|
register: crl_distribution_endpoints_3
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints (no endpoints)"
|
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints (no endpoints)"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -1004,7 +1004,7 @@
|
|||||||
register: crl_distribution_endpoints_4
|
register: crl_distribution_endpoints_4
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints"
|
- name: "({{ select_crypto_backend }}) Create CSR with CRL distribution endpoints"
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
path: '{{ remote_tmp_dir }}/csr_crl_d_e.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
|
|||||||
@@ -10,22 +10,22 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Prepare private key for backend autodetection test
|
- name: Prepare private key for backend autodetection test
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_backend_selection.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_backend_selection.pem'
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
- name: Run module with backend autodetection
|
- name: Run module with backend autodetection
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_backend_selection.csr'
|
path: '{{ remote_tmp_dir }}/csr_backend_selection.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey_backend_selection.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey_backend_selection.pem'
|
||||||
subject:
|
subject:
|
||||||
commonName: www.ansible.com
|
commonName: www.ansible.com
|
||||||
|
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
- import_tasks: ../tests/validate.yml
|
- ansible.builtin.import_tasks: ../tests/validate.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
|
|||||||
@@ -4,25 +4,25 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (test - privatekey modulus)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (test - privatekey modulus)"
|
||||||
shell: '{{ openssl_binary }} rsa -noout -modulus -in {{ remote_tmp_dir }}/privatekey.pem'
|
ansible.builtin.shell: '{{ openssl_binary }} rsa -noout -modulus -in {{ remote_tmp_dir }}/privatekey.pem'
|
||||||
register: privatekey_modulus
|
register: privatekey_modulus
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (test - Common Name)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (test - Common Name)"
|
||||||
shell: "{{ openssl_binary }} req -noout -subject -in {{ remote_tmp_dir }}/csr.csr -nameopt oneline,-space_eq"
|
ansible.builtin.shell: "{{ openssl_binary }} req -noout -subject -in {{ remote_tmp_dir }}/csr.csr -nameopt oneline,-space_eq"
|
||||||
register: csr_cn
|
register: csr_cn
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (test - csr modulus)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (test - csr modulus)"
|
||||||
shell: '{{ openssl_binary }} req -noout -modulus -in {{ remote_tmp_dir }}/csr.csr'
|
ansible.builtin.shell: '{{ openssl_binary }} req -noout -modulus -in {{ remote_tmp_dir }}/csr.csr'
|
||||||
register: csr_modulus
|
register: csr_modulus
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (assert)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (assert)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- csr_cn.stdout.split('=')[-1] == 'www.ansible.com'
|
- csr_cn.stdout.split('=')[-1] == 'www.ansible.com'
|
||||||
- csr_modulus.stdout == privatekey_modulus.stdout
|
- csr_modulus.stdout == privatekey_modulus.stdout
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (check mode, idempotency)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (check mode, idempotency)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- generate_csr_check is changed
|
- generate_csr_check is changed
|
||||||
- generate_csr is changed
|
- generate_csr is changed
|
||||||
@@ -30,12 +30,12 @@
|
|||||||
- generate_csr_idempotent_check is not changed
|
- generate_csr_idempotent_check is not changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Read CSR"
|
- name: "({{ select_crypto_backend }}) Read CSR"
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/csr.csr'
|
src: '{{ remote_tmp_dir }}/csr.csr'
|
||||||
register: slurp
|
register: slurp
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (data retrieval)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (data retrieval)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- generate_csr_check.csr is none
|
- generate_csr_check.csr is none
|
||||||
- generate_csr.csr == (slurp.content | b64decode)
|
- generate_csr.csr == (slurp.content | b64decode)
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
- generate_csr.csr == generate_csr_idempotent_check.csr
|
- generate_csr.csr == generate_csr_idempotent_check.csr
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR without SAN (check mode, idempotency)"
|
- name: "({{ select_crypto_backend }}) Validate CSR without SAN (check mode, idempotency)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- generate_csr_nosan_check is changed
|
- generate_csr_nosan_check is changed
|
||||||
- generate_csr_nosan is changed
|
- generate_csr_nosan is changed
|
||||||
@@ -51,28 +51,28 @@
|
|||||||
- generate_csr_nosan_check_idempotent_check is not changed
|
- generate_csr_nosan_check_idempotent_check is not changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR_KU_XKU (assert idempotency, change)"
|
- name: "({{ select_crypto_backend }}) Validate CSR_KU_XKU (assert idempotency, change)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- csr_ku_xku is not changed
|
- csr_ku_xku is not changed
|
||||||
- csr_ku_xku_change is changed
|
- csr_ku_xku_change is changed
|
||||||
- csr_ku_xku_change_2 is changed
|
- csr_ku_xku_change_2 is changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate old_API CSR (test - Common Name)"
|
- name: "({{ select_crypto_backend }}) Validate old_API CSR (test - Common Name)"
|
||||||
shell: "{{ openssl_binary }} req -noout -subject -in {{ remote_tmp_dir }}/csr_oldapi.csr -nameopt oneline,-space_eq"
|
ansible.builtin.shell: "{{ openssl_binary }} req -noout -subject -in {{ remote_tmp_dir }}/csr_oldapi.csr -nameopt oneline,-space_eq"
|
||||||
register: csr_oldapi_cn
|
register: csr_oldapi_cn
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate old_API CSR (test - csr modulus)"
|
- name: "({{ select_crypto_backend }}) Validate old_API CSR (test - csr modulus)"
|
||||||
shell: '{{ openssl_binary }} req -noout -modulus -in {{ remote_tmp_dir }}/csr_oldapi.csr'
|
ansible.builtin.shell: '{{ openssl_binary }} req -noout -modulus -in {{ remote_tmp_dir }}/csr_oldapi.csr'
|
||||||
register: csr_oldapi_modulus
|
register: csr_oldapi_modulus
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate old_API CSR (assert)"
|
- name: "({{ select_crypto_backend }}) Validate old_API CSR (assert)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- csr_oldapi_cn.stdout.split('=')[-1] == 'www.ansible.com'
|
- csr_oldapi_cn.stdout.split('=')[-1] == 'www.ansible.com'
|
||||||
- csr_oldapi_modulus.stdout == privatekey_modulus.stdout
|
- csr_oldapi_modulus.stdout == privatekey_modulus.stdout
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate invalid SAN (1/2)"
|
- name: "({{ select_crypto_backend }}) Validate invalid SAN (1/2)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- generate_csr_invalid_san is failed
|
- generate_csr_invalid_san is failed
|
||||||
- "'Subject Alternative Name' in generate_csr_invalid_san.msg"
|
- "'Subject Alternative Name' in generate_csr_invalid_san.msg"
|
||||||
@@ -87,49 +87,49 @@
|
|||||||
when: cryptography_version.stdout is version('2.0', '<')
|
when: cryptography_version.stdout is version('2.0', '<')
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate OCSP Must Staple CSR (test - everything)"
|
- name: "({{ select_crypto_backend }}) Validate OCSP Must Staple CSR (test - everything)"
|
||||||
shell: "{{ openssl_binary }} req -noout -in {{ remote_tmp_dir }}/csr_ocsp.csr -text"
|
ansible.builtin.shell: "{{ openssl_binary }} req -noout -in {{ remote_tmp_dir }}/csr_ocsp.csr -text"
|
||||||
register: csr_ocsp
|
register: csr_ocsp
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate OCSP Must Staple CSR (assert)"
|
- name: "({{ select_crypto_backend }}) Validate OCSP Must Staple CSR (assert)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "(csr_ocsp.stdout is search('\\s+TLS Feature:\\s*\\n\\s+status_request\\s+')) or
|
- "(csr_ocsp.stdout is search('\\s+TLS Feature:\\s*\\n\\s+status_request\\s+')) or
|
||||||
(csr_ocsp.stdout is search('\\s+1.3.6.1.5.5.7.1.24:\\s*\\n\\s+0\\.\\.\\.\\.\\s+'))"
|
(csr_ocsp.stdout is search('\\s+1.3.6.1.5.5.7.1.24:\\s*\\n\\s+0\\.\\.\\.\\.\\s+'))"
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate OCSP Must Staple CSR (assert idempotency)"
|
- name: "({{ select_crypto_backend }}) Validate OCSP Must Staple CSR (assert idempotency)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- csr_ocsp_idempotency is not changed
|
- csr_ocsp_idempotency is not changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate ECC CSR (test - privatekey's public key)"
|
- name: "({{ select_crypto_backend }}) Validate ECC CSR (test - privatekey's public key)"
|
||||||
shell: '{{ openssl_binary }} ec -pubout -in {{ remote_tmp_dir }}/privatekey2.pem'
|
ansible.builtin.shell: '{{ openssl_binary }} ec -pubout -in {{ remote_tmp_dir }}/privatekey2.pem'
|
||||||
register: privatekey_ecc_key
|
register: privatekey_ecc_key
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate ECC CSR (test - Common Name)"
|
- name: "({{ select_crypto_backend }}) Validate ECC CSR (test - Common Name)"
|
||||||
shell: "{{ openssl_binary }} req -noout -subject -in {{ remote_tmp_dir }}/csr2.csr -nameopt oneline,-space_eq"
|
ansible.builtin.shell: "{{ openssl_binary }} req -noout -subject -in {{ remote_tmp_dir }}/csr2.csr -nameopt oneline,-space_eq"
|
||||||
register: csr_ecc_cn
|
register: csr_ecc_cn
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate ECC CSR (test - CSR pubkey)"
|
- name: "({{ select_crypto_backend }}) Validate ECC CSR (test - CSR pubkey)"
|
||||||
shell: '{{ openssl_binary }} req -noout -pubkey -in {{ remote_tmp_dir }}/csr2.csr'
|
ansible.builtin.shell: '{{ openssl_binary }} req -noout -pubkey -in {{ remote_tmp_dir }}/csr2.csr'
|
||||||
register: csr_ecc_pubkey
|
register: csr_ecc_pubkey
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate ECC CSR (assert)"
|
- name: "({{ select_crypto_backend }}) Validate ECC CSR (assert)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- csr_ecc_cn.stdout.split('=')[-1] == 'www.ansible.com'
|
- csr_ecc_cn.stdout.split('=')[-1] == 'www.ansible.com'
|
||||||
- csr_ecc_pubkey.stdout == privatekey_ecc_key.stdout
|
- csr_ecc_pubkey.stdout == privatekey_ecc_key.stdout
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (text common name - Common Name)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (text common name - Common Name)"
|
||||||
shell: "{{ openssl_binary }} req -noout -subject -in {{ remote_tmp_dir }}/csr3.csr -nameopt oneline,-space_eq"
|
ansible.builtin.shell: "{{ openssl_binary }} req -noout -subject -in {{ remote_tmp_dir }}/csr3.csr -nameopt oneline,-space_eq"
|
||||||
register: csr3_cn
|
register: csr3_cn
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (assert)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (assert)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- csr3_cn.stdout.split('=')[-1] == 'This is for Ansible'
|
- csr3_cn.stdout.split('=')[-1] == 'This is for Ansible'
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate country name idempotency and validation"
|
- name: "({{ select_crypto_backend }}) Validate country name idempotency and validation"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- country_idempotent_1 is changed
|
- country_idempotent_1 is changed
|
||||||
- country_idempotent_2 is not changed
|
- country_idempotent_2 is not changed
|
||||||
@@ -137,13 +137,13 @@
|
|||||||
- country_fail_4 is failed
|
- country_fail_4 is failed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate idempotency of privatekey_passphrase"
|
- name: "({{ select_crypto_backend }}) Validate idempotency of privatekey_passphrase"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- passphrase_1 is changed
|
- passphrase_1 is changed
|
||||||
- passphrase_1_content is not changed
|
- passphrase_1_content is not changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate private key passphrase errors"
|
- name: "({{ select_crypto_backend }}) Validate private key passphrase errors"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- passphrase_error_1 is failed
|
- passphrase_error_1 is failed
|
||||||
- "'assphrase' in passphrase_error_1.msg or 'assword' in passphrase_error_1.msg"
|
- "'assphrase' in passphrase_error_1.msg or 'assword' in passphrase_error_1.msg"
|
||||||
@@ -153,12 +153,12 @@
|
|||||||
- "'assphrase' in passphrase_error_3.msg or 'assword' in passphrase_error_3.msg or 'serializ' in passphrase_error_3.msg"
|
- "'assphrase' in passphrase_error_3.msg or 'assword' in passphrase_error_3.msg or 'serializ' in passphrase_error_3.msg"
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Verify that broken CSR will be regenerated"
|
- name: "({{ select_crypto_backend }}) Verify that broken CSR will be regenerated"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- output_broken is changed
|
- output_broken is changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Verify that subject key identifier handling works"
|
- name: "({{ select_crypto_backend }}) Verify that subject key identifier handling works"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- subject_key_identifier_1 is changed
|
- subject_key_identifier_1 is changed
|
||||||
- subject_key_identifier_2 is not changed
|
- subject_key_identifier_2 is not changed
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
- subject_key_identifier_6 is changed
|
- subject_key_identifier_6 is changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Verify that authority key identifier handling works"
|
- name: "({{ select_crypto_backend }}) Verify that authority key identifier handling works"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- authority_key_identifier_1 is changed
|
- authority_key_identifier_1 is changed
|
||||||
- authority_key_identifier_2 is not changed
|
- authority_key_identifier_2 is not changed
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
- authority_key_identifier_4 is changed
|
- authority_key_identifier_4 is changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Verify that authority cert issuer / serial number handling works"
|
- name: "({{ select_crypto_backend }}) Verify that authority cert issuer / serial number handling works"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- authority_cert_issuer_sn_1 is changed
|
- authority_cert_issuer_sn_1 is changed
|
||||||
- authority_cert_issuer_sn_2 is not changed
|
- authority_cert_issuer_sn_2 is not changed
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
- authority_cert_issuer_sn_5 is changed
|
- authority_cert_issuer_sn_5 is changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check backup"
|
- name: "({{ select_crypto_backend }}) Check backup"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- csr_backup_1 is changed
|
- csr_backup_1 is changed
|
||||||
- csr_backup_1.backup_file is undefined
|
- csr_backup_1.backup_file is undefined
|
||||||
@@ -200,7 +200,7 @@
|
|||||||
- csr_backup_4.csr is none
|
- csr_backup_4.csr is none
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check CSR with everything"
|
- name: "({{ select_crypto_backend }}) Check CSR with everything"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- everything_1 is changed
|
- everything_1 is changed
|
||||||
- everything_2 is not changed
|
- everything_2 is not changed
|
||||||
@@ -271,7 +271,7 @@
|
|||||||
- everything_info.name_constraints_critical == true
|
- everything_info.name_constraints_critical == true
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check CSR with everything"
|
- name: "({{ select_crypto_backend }}) Check CSR with everything"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- everything_info.authority_cert_issuer == [
|
- everything_info.authority_cert_issuer == [
|
||||||
"DNS:ca.example.org",
|
"DNS:ca.example.org",
|
||||||
@@ -314,7 +314,7 @@
|
|||||||
]
|
]
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Verify Ed25519 and Ed448 tests (for cryptography >= 2.6, < 2.8)"
|
- name: "({{ select_crypto_backend }}) Verify Ed25519 and Ed448 tests (for cryptography >= 2.6, < 2.8)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- generate_csr_ed25519_ed448.results[0] is failed
|
- generate_csr_ed25519_ed448.results[0] is failed
|
||||||
- generate_csr_ed25519_ed448.results[1] is failed
|
- generate_csr_ed25519_ed448.results[1] is failed
|
||||||
@@ -325,7 +325,7 @@
|
|||||||
when: select_crypto_backend == 'cryptography' and cryptography_version.stdout is version('2.6', '>=') and cryptography_version.stdout is version('2.8', '<') and generate_csr_ed25519_ed448_privatekey is not failed
|
when: select_crypto_backend == 'cryptography' and cryptography_version.stdout is version('2.6', '>=') and cryptography_version.stdout is version('2.8', '<') and generate_csr_ed25519_ed448_privatekey is not failed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Verify Ed25519 and Ed448 tests (for cryptography >= 2.8)"
|
- name: "({{ select_crypto_backend }}) Verify Ed25519 and Ed448 tests (for cryptography >= 2.8)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- generate_csr_ed25519_ed448 is succeeded
|
- generate_csr_ed25519_ed448 is succeeded
|
||||||
- generate_csr_ed25519_ed448.results[0] is changed
|
- generate_csr_ed25519_ed448.results[0] is changed
|
||||||
@@ -336,7 +336,7 @@
|
|||||||
when: select_crypto_backend == 'cryptography' and cryptography_version.stdout is version('2.8', '>=') and generate_csr_ed25519_ed448_privatekey is not failed
|
when: select_crypto_backend == 'cryptography' and cryptography_version.stdout is version('2.8', '>=') and generate_csr_ed25519_ed448_privatekey is not failed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Verify CRL distribution endpoints (for cryptography >= 1.6)"
|
- name: "({{ select_crypto_backend }}) Verify CRL distribution endpoints (for cryptography >= 1.6)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- crl_distribution_endpoints_1 is changed
|
- crl_distribution_endpoints_1 is changed
|
||||||
- crl_distribution_endpoints_2 is not changed
|
- crl_distribution_endpoints_2 is not changed
|
||||||
|
|||||||
@@ -3,31 +3,31 @@
|
|||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- debug:
|
- ansible.builtin.debug:
|
||||||
msg: "Executing tests with backend {{ select_crypto_backend }}"
|
msg: "Executing tests with backend {{ select_crypto_backend }}"
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get CSR info"
|
- name: "({{ select_crypto_backend }}) Get CSR info"
|
||||||
openssl_csr_info:
|
community.crypto.openssl_csr_info:
|
||||||
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get CSR info (IDNA encoding)"
|
- name: "({{ select_crypto_backend }}) Get CSR info (IDNA encoding)"
|
||||||
openssl_csr_info:
|
community.crypto.openssl_csr_info:
|
||||||
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
||||||
name_encoding: idna
|
name_encoding: idna
|
||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: result_idna
|
register: result_idna
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get CSR info (Unicode encoding)"
|
- name: "({{ select_crypto_backend }}) Get CSR info (Unicode encoding)"
|
||||||
openssl_csr_info:
|
community.crypto.openssl_csr_info:
|
||||||
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
||||||
name_encoding: unicode
|
name_encoding: unicode
|
||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: result_unicode
|
register: result_unicode
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check whether subject and extensions behaves as expected"
|
- name: "({{ select_crypto_backend }}) Check whether subject and extensions behaves as expected"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.subject.organizationalUnitName == 'ACME Department'
|
- result.subject.organizationalUnitName == 'ACME Department'
|
||||||
- "['organizationalUnitName', 'Crypto Department'] in result.subject_ordered"
|
- "['organizationalUnitName', 'Crypto Department'] in result.subject_ordered"
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
- result.extensions_by_oid['2.5.29.37'].value == 'MHQGCCsGAQUFBwMBBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEFBQcDBAYIKwYBBQUHAwgGCCsGAQUFBwMJBgRVHSUABggrBgEFBQcBAwYIKwYBBQUHAwoGCCsGAQUFBwMHBggrBgEFBQcBAg=='
|
- result.extensions_by_oid['2.5.29.37'].value == 'MHQGCCsGAQUFBwMBBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEFBQcDBAYIKwYBBQUHAwgGCCsGAQUFBwMJBgRVHSUABggrBgEFBQcBAwYIKwYBBQUHAwoGCCsGAQUFBwMHBggrBgEFBQcBAg=='
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check SubjectKeyIdentifier and AuthorityKeyIdentifier"
|
- name: "({{ select_crypto_backend }}) Check SubjectKeyIdentifier and AuthorityKeyIdentifier"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.subject_key_identifier == "00:11:22:33"
|
- result.subject_key_identifier == "00:11:22:33"
|
||||||
- result.authority_key_identifier == "44:55:66:77"
|
- result.authority_key_identifier == "44:55:66:77"
|
||||||
@@ -71,18 +71,18 @@
|
|||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Read CSR"
|
- name: "({{ select_crypto_backend }}) Read CSR"
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: '{{ remote_tmp_dir }}/csr_1.csr'
|
src: '{{ remote_tmp_dir }}/csr_1.csr'
|
||||||
register: slurp
|
register: slurp
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get CSR info directly"
|
- name: "({{ select_crypto_backend }}) Get CSR info directly"
|
||||||
openssl_csr_info:
|
community.crypto.openssl_csr_info:
|
||||||
content: '{{ slurp.content | b64decode }}'
|
content: '{{ slurp.content | b64decode }}'
|
||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: result_direct
|
register: result_direct
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Compare output of direct and loaded info"
|
- name: "({{ select_crypto_backend }}) Compare output of direct and loaded info"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- >-
|
- >-
|
||||||
(result | dict2items | rejectattr("key", "equalto", "warnings") | list | items2dict)
|
(result | dict2items | rejectattr("key", "equalto", "warnings") | list | items2dict)
|
||||||
@@ -90,19 +90,19 @@
|
|||||||
(result_direct | dict2items | rejectattr("key", "equalto", "warnings") | list | items2dict)
|
(result_direct | dict2items | rejectattr("key", "equalto", "warnings") | list | items2dict)
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get CSR info"
|
- name: "({{ select_crypto_backend }}) Get CSR info"
|
||||||
openssl_csr_info:
|
community.crypto.openssl_csr_info:
|
||||||
path: '{{ remote_tmp_dir }}/csr_2.csr'
|
path: '{{ remote_tmp_dir }}/csr_2.csr'
|
||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get CSR info"
|
- name: "({{ select_crypto_backend }}) Get CSR info"
|
||||||
openssl_csr_info:
|
community.crypto.openssl_csr_info:
|
||||||
path: '{{ remote_tmp_dir }}/csr_3.csr'
|
path: '{{ remote_tmp_dir }}/csr_3.csr'
|
||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check AuthorityKeyIdentifier"
|
- name: "({{ select_crypto_backend }}) Check AuthorityKeyIdentifier"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.authority_key_identifier is none
|
- result.authority_key_identifier is none
|
||||||
- result.authority_cert_issuer == expected_authority_cert_issuer
|
- result.authority_cert_issuer == expected_authority_cert_issuer
|
||||||
@@ -114,13 +114,13 @@
|
|||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Get CSR info"
|
- name: "({{ select_crypto_backend }}) Get CSR info"
|
||||||
openssl_csr_info:
|
community.crypto.openssl_csr_info:
|
||||||
path: '{{ remote_tmp_dir }}/csr_4.csr'
|
path: '{{ remote_tmp_dir }}/csr_4.csr'
|
||||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Check AuthorityKeyIdentifier"
|
- name: "({{ select_crypto_backend }}) Check AuthorityKeyIdentifier"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- result.authority_key_identifier == "44:55:66:77"
|
- result.authority_key_identifier == "44:55:66:77"
|
||||||
- result.authority_cert_issuer is none
|
- result.authority_cert_issuer is none
|
||||||
|
|||||||
@@ -9,24 +9,24 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Make sure the Python idna library is installed
|
- name: Make sure the Python idna library is installed
|
||||||
pip:
|
ansible.builtin.pip:
|
||||||
name: idna
|
name: idna
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Generate privatekey
|
- name: Generate privatekey
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: Generate privatekey with password
|
- name: Generate privatekey with password
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
passphrase: hunter2
|
passphrase: hunter2
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: Generate CSR 1
|
- name: Generate CSR 1
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
path: '{{ remote_tmp_dir }}/csr_1.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
- "IP:1.2.3.4"
|
- "IP:1.2.3.4"
|
||||||
|
|
||||||
- name: Generate CSR 2
|
- name: Generate CSR 2
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_2.csr'
|
path: '{{ remote_tmp_dir }}/csr_2.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||||
privatekey_passphrase: hunter2
|
privatekey_passphrase: hunter2
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
- "CA:TRUE"
|
- "CA:TRUE"
|
||||||
|
|
||||||
- name: Generate CSR 3
|
- name: Generate CSR 3
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_3.csr'
|
path: '{{ remote_tmp_dir }}/csr_3.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
useCommonNameForSAN: false
|
useCommonNameForSAN: false
|
||||||
@@ -122,14 +122,14 @@
|
|||||||
- "IP:1.2.3.4"
|
- "IP:1.2.3.4"
|
||||||
|
|
||||||
- name: Generate CSR 4
|
- name: Generate CSR 4
|
||||||
openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ remote_tmp_dir }}/csr_4.csr'
|
path: '{{ remote_tmp_dir }}/csr_4.csr'
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
useCommonNameForSAN: false
|
useCommonNameForSAN: false
|
||||||
authority_key_identifier: '{{ "44:55:66:77" if cryptography_version.stdout is version("1.3", ">=") else omit }}'
|
authority_key_identifier: '{{ "44:55:66:77" if cryptography_version.stdout is version("1.3", ">=") else omit }}'
|
||||||
|
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
when: cryptography_version.stdout is version('1.3', '>=')
|
when: cryptography_version.stdout is version('1.3', '>=')
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate privatekey"
|
- name: "({{ select_crypto_backend }}) Generate privatekey"
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (check mode)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (check mode)"
|
||||||
openssl_csr_pipe:
|
community.crypto.openssl_csr_pipe:
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
commonName: www.ansible.com
|
commonName: www.ansible.com
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
register: generate_csr_check
|
register: generate_csr_check
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR"
|
- name: "({{ select_crypto_backend }}) Generate CSR"
|
||||||
openssl_csr_pipe:
|
community.crypto.openssl_csr_pipe:
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
commonName: www.ansible.com
|
commonName: www.ansible.com
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
register: generate_csr
|
register: generate_csr
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent)"
|
||||||
openssl_csr_pipe:
|
community.crypto.openssl_csr_pipe:
|
||||||
content: "{{ generate_csr.csr }}"
|
content: "{{ generate_csr.csr }}"
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
register: generate_csr_idempotent
|
register: generate_csr_idempotent
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent, check mode)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent, check mode)"
|
||||||
openssl_csr_pipe:
|
community.crypto.openssl_csr_pipe:
|
||||||
content: "{{ generate_csr.csr }}"
|
content: "{{ generate_csr.csr }}"
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
register: generate_csr_idempotent_check
|
register: generate_csr_idempotent_check
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (changed)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (changed)"
|
||||||
openssl_csr_pipe:
|
community.crypto.openssl_csr_pipe:
|
||||||
content: "{{ generate_csr.csr }}"
|
content: "{{ generate_csr.csr }}"
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
register: generate_csr_changed
|
register: generate_csr_changed
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Generate CSR (changed, check mode)"
|
- name: "({{ select_crypto_backend }}) Generate CSR (changed, check mode)"
|
||||||
openssl_csr_pipe:
|
community.crypto.openssl_csr_pipe:
|
||||||
content: "{{ generate_csr.csr }}"
|
content: "{{ generate_csr.csr }}"
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
@@ -64,29 +64,29 @@
|
|||||||
register: generate_csr_changed_check
|
register: generate_csr_changed_check
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (test - privatekey modulus)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (test - privatekey modulus)"
|
||||||
shell: '{{ openssl_binary }} rsa -noout -modulus -in {{ remote_tmp_dir }}/privatekey.pem'
|
ansible.builtin.shell: '{{ openssl_binary }} rsa -noout -modulus -in {{ remote_tmp_dir }}/privatekey.pem'
|
||||||
register: privatekey_modulus
|
register: privatekey_modulus
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (test - Common Name)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (test - Common Name)"
|
||||||
shell: "{{ openssl_binary }} req -noout -subject -in /dev/stdin -nameopt oneline,-space_eq"
|
ansible.builtin.shell: "{{ openssl_binary }} req -noout -subject -in /dev/stdin -nameopt oneline,-space_eq"
|
||||||
args:
|
args:
|
||||||
stdin: "{{ generate_csr.csr }}"
|
stdin: "{{ generate_csr.csr }}"
|
||||||
register: csr_cn
|
register: csr_cn
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (test - csr modulus)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (test - csr modulus)"
|
||||||
shell: '{{ openssl_binary }} req -noout -modulus -in /dev/stdin'
|
ansible.builtin.shell: '{{ openssl_binary }} req -noout -modulus -in /dev/stdin'
|
||||||
args:
|
args:
|
||||||
stdin: "{{ generate_csr.csr }}"
|
stdin: "{{ generate_csr.csr }}"
|
||||||
register: csr_modulus
|
register: csr_modulus
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (assert)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (assert)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- csr_cn.stdout.split('=')[-1] == 'www.ansible.com'
|
- csr_cn.stdout.split('=')[-1] == 'www.ansible.com'
|
||||||
- csr_modulus.stdout == privatekey_modulus.stdout
|
- csr_modulus.stdout == privatekey_modulus.stdout
|
||||||
|
|
||||||
- name: "({{ select_crypto_backend }}) Validate CSR (check mode, idempotency)"
|
- name: "({{ select_crypto_backend }}) Validate CSR (check mode, idempotency)"
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- generate_csr_check is changed
|
- generate_csr_check is changed
|
||||||
- generate_csr is changed
|
- generate_csr is changed
|
||||||
|
|||||||
@@ -9,18 +9,18 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: Prepare private key for backend autodetection test
|
- name: Prepare private key for backend autodetection test
|
||||||
openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ remote_tmp_dir }}/privatekey_backend_selection.pem'
|
path: '{{ remote_tmp_dir }}/privatekey_backend_selection.pem'
|
||||||
size: '{{ default_rsa_key_size }}'
|
size: '{{ default_rsa_key_size }}'
|
||||||
- name: Run module with backend autodetection
|
- name: Run module with backend autodetection
|
||||||
openssl_csr_pipe:
|
community.crypto.openssl_csr_pipe:
|
||||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey_backend_selection.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey_backend_selection.pem'
|
||||||
subject:
|
subject:
|
||||||
commonName: www.ansible.com
|
commonName: www.ansible.com
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
# The tests for this module generate unsafe parameters for testing purposes;
|
# The tests for this module generate unsafe parameters for testing purposes;
|
||||||
# otherwise tests would be too slow. Use sizes of at least 2048 in production!
|
# otherwise tests would be too slow. Use sizes of at least 2048 in production!
|
||||||
- name: "[{{ select_crypto_backend }}] Generate parameter (check mode)"
|
- name: "[{{ select_crypto_backend }}] Generate parameter (check mode)"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
size: 768
|
size: 768
|
||||||
path: '{{ remote_tmp_dir }}/dh768.pem'
|
path: '{{ remote_tmp_dir }}/dh768.pem'
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
register: dhparam_check
|
register: dhparam_check
|
||||||
|
|
||||||
- name: "[{{ select_crypto_backend }}] Generate parameter"
|
- name: "[{{ select_crypto_backend }}] Generate parameter"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
size: 768
|
size: 768
|
||||||
path: '{{ remote_tmp_dir }}/dh768.pem'
|
path: '{{ remote_tmp_dir }}/dh768.pem'
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
register: dhparam
|
register: dhparam
|
||||||
|
|
||||||
- name: "[{{ select_crypto_backend }}] Don't regenerate parameters with no change (check mode)"
|
- name: "[{{ select_crypto_backend }}] Don't regenerate parameters with no change (check mode)"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
size: 768
|
size: 768
|
||||||
path: '{{ remote_tmp_dir }}/dh768.pem'
|
path: '{{ remote_tmp_dir }}/dh768.pem'
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
register: dhparam_changed_check
|
register: dhparam_changed_check
|
||||||
|
|
||||||
- name: "[{{ select_crypto_backend }}] Don't regenerate parameters with no change"
|
- name: "[{{ select_crypto_backend }}] Don't regenerate parameters with no change"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
size: 768
|
size: 768
|
||||||
path: '{{ remote_tmp_dir }}/dh768.pem'
|
path: '{{ remote_tmp_dir }}/dh768.pem'
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
@@ -40,32 +40,32 @@
|
|||||||
register: dhparam_changed
|
register: dhparam_changed
|
||||||
|
|
||||||
- name: "[{{ select_crypto_backend }}] Generate parameters with size option"
|
- name: "[{{ select_crypto_backend }}] Generate parameters with size option"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh512.pem'
|
path: '{{ remote_tmp_dir }}/dh512.pem'
|
||||||
size: 512
|
size: 512
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
|
|
||||||
- name: "[{{ select_crypto_backend }}] Don't regenerate parameters with size option and no change"
|
- name: "[{{ select_crypto_backend }}] Don't regenerate parameters with size option and no change"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh512.pem'
|
path: '{{ remote_tmp_dir }}/dh512.pem'
|
||||||
size: 512
|
size: 512
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: dhparam_changed_512
|
register: dhparam_changed_512
|
||||||
|
|
||||||
- copy:
|
- ansible.builtin.copy:
|
||||||
src: '{{ remote_tmp_dir }}/dh768.pem'
|
src: '{{ remote_tmp_dir }}/dh768.pem'
|
||||||
remote_src: true
|
remote_src: true
|
||||||
dest: '{{ remote_tmp_dir }}/dh512.pem'
|
dest: '{{ remote_tmp_dir }}/dh512.pem'
|
||||||
|
|
||||||
- name: "[{{ select_crypto_backend }}] Re-generate if size is different"
|
- name: "[{{ select_crypto_backend }}] Re-generate if size is different"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh512.pem'
|
path: '{{ remote_tmp_dir }}/dh512.pem'
|
||||||
size: 512
|
size: 512
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: dhparam_changed_to_512
|
register: dhparam_changed_to_512
|
||||||
|
|
||||||
- name: "[{{ select_crypto_backend }}] Force re-generate parameters with size option"
|
- name: "[{{ select_crypto_backend }}] Force re-generate parameters with size option"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh512.pem'
|
path: '{{ remote_tmp_dir }}/dh512.pem'
|
||||||
size: 512
|
size: 512
|
||||||
force: true
|
force: true
|
||||||
@@ -73,11 +73,11 @@
|
|||||||
register: dhparam_changed_force
|
register: dhparam_changed_force
|
||||||
|
|
||||||
- name: "[{{ select_crypto_backend }}] Create broken params"
|
- name: "[{{ select_crypto_backend }}] Create broken params"
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
dest: "{{ remote_tmp_dir }}/dhbroken.pem"
|
dest: "{{ remote_tmp_dir }}/dhbroken.pem"
|
||||||
content: "broken"
|
content: "broken"
|
||||||
- name: "[{{ select_crypto_backend }}] Regenerate broken params"
|
- name: "[{{ select_crypto_backend }}] Regenerate broken params"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dhbroken.pem'
|
path: '{{ remote_tmp_dir }}/dhbroken.pem'
|
||||||
size: 512
|
size: 512
|
||||||
force: true
|
force: true
|
||||||
@@ -85,21 +85,21 @@
|
|||||||
register: output_broken
|
register: output_broken
|
||||||
|
|
||||||
- name: "[{{ select_crypto_backend }}] Generate params"
|
- name: "[{{ select_crypto_backend }}] Generate params"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
||||||
size: 512
|
size: 512
|
||||||
backup: true
|
backup: true
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: dhparam_backup_1
|
register: dhparam_backup_1
|
||||||
- name: "[{{ select_crypto_backend }}] Generate params (idempotent)"
|
- name: "[{{ select_crypto_backend }}] Generate params (idempotent)"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
||||||
size: 512
|
size: 512
|
||||||
backup: true
|
backup: true
|
||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: dhparam_backup_2
|
register: dhparam_backup_2
|
||||||
- name: "[{{ select_crypto_backend }}] Generate params (change)"
|
- name: "[{{ select_crypto_backend }}] Generate params (change)"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
||||||
size: 512
|
size: 512
|
||||||
force: true
|
force: true
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
select_crypto_backend: "{{ select_crypto_backend }}"
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
||||||
register: dhparam_backup_3
|
register: dhparam_backup_3
|
||||||
- name: "[{{ select_crypto_backend }}] Generate params (remove)"
|
- name: "[{{ select_crypto_backend }}] Generate params (remove)"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
||||||
state: absent
|
state: absent
|
||||||
backup: true
|
backup: true
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
return_content: true
|
return_content: true
|
||||||
register: dhparam_backup_4
|
register: dhparam_backup_4
|
||||||
- name: "[{{ select_crypto_backend }}] Generate params (remove, idempotent)"
|
- name: "[{{ select_crypto_backend }}] Generate params (remove, idempotent)"
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
path: '{{ remote_tmp_dir }}/dh_backup.pem'
|
||||||
state: absent
|
state: absent
|
||||||
backup: true
|
backup: true
|
||||||
|
|||||||
@@ -12,35 +12,35 @@
|
|||||||
# otherwise tests would be too slow. Use sizes of at least 2048 in production!
|
# otherwise tests would be too slow. Use sizes of at least 2048 in production!
|
||||||
|
|
||||||
- name: Run module with backend autodetection
|
- name: Run module with backend autodetection
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: '{{ remote_tmp_dir }}/dh_backend_selection.pem'
|
path: '{{ remote_tmp_dir }}/dh_backend_selection.pem'
|
||||||
size: 512
|
size: 512
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with OpenSSL backend
|
- name: Running tests with OpenSSL backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
|
|
||||||
- include_tasks: ../tests/validate.yml
|
- ansible.builtin.include_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: openssl
|
select_crypto_backend: openssl
|
||||||
# when: openssl_version.stdout is version('1.0.0', '>=')
|
# when: openssl_version.stdout is version('1.0.0', '>=')
|
||||||
|
|
||||||
- name: Remove output directory
|
- name: Remove output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Re-create output directory
|
- name: Re-create output directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ remote_tmp_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Running tests with cryptography backend
|
- name: Running tests with cryptography backend
|
||||||
include_tasks: impl.yml
|
ansible.builtin.include_tasks: impl.yml
|
||||||
|
|
||||||
- include_tasks: ../tests/validate.yml
|
- ansible.builtin.include_tasks: ../tests/validate.yml
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
select_crypto_backend: cryptography
|
select_crypto_backend: cryptography
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user