Commit Graph

229 Commits (27a9ff14fbfdeebda98c76f576d780cd0c588ade)

Author SHA1 Message Date
Felix Fontein 27a9ff14fb
Add x509_certificate_convert module. (#728) 2024-04-18 05:50:36 +00:00
Felix Fontein 50c2c4db29
CI: Add stable-2.17; copy ignore.txt files from 2.17 to 2.18; move stable-2.14 from AZP to GHA (#721)
* Add stable-2.17 to CI; copy ignore files from 2.17 to 2.18.

* Move stable-2.14 from AZP to GHA.
2024-04-03 08:32:16 +02:00
Felix Fontein 1736602ce7
Allow to configure how serial numbers are provided to x509_crl. (#715) 2024-02-19 21:05:13 +01:00
Felix Fontein 6b1a3d6e68
Add conversion filters for serial numbers (#713)
* Refactoring.

* Add parse_filter and to_filter plugins.

* Mention filters when serial numbers are accepted or returned.
2024-02-18 21:27:48 +01:00
Steffen Gufler 51591891d3
luks_device: fix remove_keyslot not working when set to 0 and duplicate keys (#710)
* luks_device: fix remove_keyslot not working when set to 0

* luks_device: fix module outputting 'ok' when trying to add a key that is already present in another keyslot

* luks_device: fix breaking unit tests

* luks_device: Duplicate key test case code cleanup

* luks_device: Fix testing of LUKS passphrases when only testing one key slot

* luks_device: Fix testing of LUKS passphrases when only testing one key slot

* luks_device: Add changelog fragment for PR #710

* luks_device: Update changlog fragment
2024-02-11 12:23:21 +01:00
0x00ace a4edf22a9c
add allow discard option for luks devices (#693)
* add allow discard option for luks devices

* Add allow_discards to perfomance tests

* Fix version for luks devices doc

* Update plugins/modules/luks_device.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* add changelog fragment

* Update changelogs/fragments/693-allow-discards.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

* added allow_discards to the persistently stored option list

* allow_discards works with not only luks2 containers

* Update plugins/modules/luks_device.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2024-01-13 09:34:07 +01:00
Felix Fontein 97e44c4ba5
Remove some Shippable specific code that trips latest shellcheck. (#692) 2024-01-04 22:46:46 +01:00
Felix Fontein 033b456b7a
Add new error message. (#688) 2023-12-20 13:37:19 +01:00
Felix Fontein 29cd0b3bde
Fix bad expressions in tests. (#677)
ci_complete
2023-11-28 22:57:45 +01:00
Steffen Gufler 6504e67139
luks_device: add support for keyslots (#664)
* luks_device: add support for keyslots

* luks_device: replace python3 format strings with python2 format strings, remove print statements

* luks_device: add missing copyright information in keyslot integration test files

* luks_device: updated failing unit tests for keyslot support

* luks_device: improve detection of luks version

* luks_device: Update documentation on keyslot parameters, minor code improvements

* luks_device: improve validation of keyslot parameters, fix tests for systems that do not support luks2

* luks_device: correct spelling and errors in documentation and output, check all possible locations for LUKS2 header
2023-10-29 10:53:00 +01:00
Felix Fontein 428550165a
Fix typos and FQCN (#669)
* Fix typos.

* Use FQCNs in examples.
2023-10-28 22:54:56 +02:00
Felix Fontein d1299c11d6
Handle pyOpenSSL 23.3.0, which removed PKCS#12 support (at least partially). (#666) 2023-10-28 13:38:07 +00:00
Felix Fontein e7515584b1
Latest OpenSSH's ssh-keygen defaults to ed25519 keys, no longer RSA. (#662) 2023-10-07 15:15:33 +02:00
Felix Fontein b2a92ef0bf
Add ansible-core 2.16 to the matrix. (#656) 2023-09-19 17:51:29 +02:00
Felix Fontein addbd067c8
openssh_* modules: check return code on ssh(-keygen) invocations; fail if comment cannot be updated (#646)
* Check return code on ssh(-keygen) invocations.

* openssh_cert: only check for errors if certificate should be present and module is not in check mode.

* Handle rc check for _get_private_key().

* Add changelog fragment.

* Only pass -o for comment updating when necessary.

* Now fails if comment cannot be updated.

This was silently ignored in the past.

* Avoid failing operation.
2023-08-12 17:14:00 +02:00
Felix Fontein ba456c5eaf
Add gpg_fingerprint lookup and filter (#639)
* Add gpg_fingerprint lookup.

* Work around problems on some CI targets.

* Use get_bin_path to find the gpg executable. Document that we need it.

* Improve and test error handling.

* Refactor (potentially) common code to module_utils and plugin_utils.

This will be useful to create a filter version of this, and further lookups, filters, and modules.

* Do not create a keyring when there isn't one.

* Fixups.

* Fix description.

* More fixes for lookup.

* Also add a gpg_fingerprint filter.

* Improve formulation.

Co-authored-by: Sandra McCann <samccann@redhat.com>

---------

Co-authored-by: Sandra McCann <samccann@redhat.com>
2023-08-02 11:16:34 +02:00
Felix Fontein 5e630ffe78
CI: ansible-core devel only supports Alpine 3.18 VMs, no longer Alpine 3.17 VMs (#642)
* ansible-core devel only supports Alpine 3.18 VMs, no longer Alpine 3.17 VMs.

* lsblk was moved to a separate package in Alpine 3.18.
2023-08-02 11:15:54 +02:00
Felix Fontein 9ae75d4840
Fix license disclaimer for some vendored Jinja2 code in tests. (#640) 2023-07-26 17:45:24 +02:00
Felix Fontein 54b2163c56
Remove no longer needed ignore. (#638) 2023-07-15 12:40:58 +02:00
Felix Fontein 83af72a3bc
Improve PEM identification. (#628) 2023-06-27 17:35:55 +02:00
Felix Fontein 57a8c7e652
Add Debian Bookworm to CI. (#631) 2023-06-24 16:29:21 +02:00
Felix Fontein 99d1521266
Use semantic markup (#626)
* Enable semantic markup.

* Use semantic markup.

* Break long lines.

* Add ignores.

* Use real option, not alias.
2023-06-24 10:00:56 +02:00
Felix Fontein e3bc22f7d5
Switch to Ansible Galaxy compatible requirements files for tests. (#607) 2023-05-21 13:33:19 +02:00
Felix Fontein c703dd6056
Rewrite EE test workflows to use ansible-builder 3.0.0; fix EE dependencies (#606)
* Adjust EE tests to ansible-builder 3.0.0.

* Remove other CI workflows.

* Use docker instead of podman...

* Support Rocky Linux 9+.

* Add CentOS Stream 9 to EE tests.

* Fix installation of PyOpenSSL on CentOS/RHEL/Rocky.

* ansible-builder only attempts to install EPEL deps on CentOS.

* Make EPEL also available on Rocky Linux 9, even though ansible-builder will ignore it.

* Make sure cryptography is already installed.

* Try ansible-runner < 2.0.0 for CentOS Stream 8 / RHEL 8.

* Show more info.

* Start restricting transitive dependencies...

* Looks like PyOpenSSL is **broken** on CentOS Stream 9 + EPEL.

* ansible-builder will NOT work with Python 3.6.

use Python 3.9 on RHEL8 / CentOS Stream 8. Manually install cryptography and PyOpenSSL for Python 3.9 as well.

* PyOpenSSL isn't available for Python 3.8 or 3.9.

* Revert "Remove other CI workflows."

This reverts commit 3a9d125f45.

* Use podman instead of docker.

* Re-order bindep entries.

* python3-pyOpenSSL does not exist on RHEL/CentOS 6 and 7.
2023-05-21 12:43:14 +02:00
David Zaslavsky ce3299f106
Always generate a new key pair if the private key doesn't exist (#598)
* Always generate a new key pair if the private key doesn't exist (#597)

This commit updates `KeypairBackend._should_generate()` to first check
if the original private key named by the `path` argument exists, and
return True if it does not. This brings the code in line with
the documentation, which says that a new key will always be generated if
the key file doesn't already exist.

As an alternative to the approach implemented here, I also considered
only modifying the condition in the `fail` branch of the if statement,
but I thought that would not map as cleanly to the behavior specified in
the documentation, so doing it the way I did should make it easier to
check that the code is doing the right thing just by looking at it.
I also considered doing something to make the logic more similar to
`PrivateKeyBackend.needs_regeneration()` (the openssl version of this
functionality), because the two are supposed to be acting the same way,
but I thought that'd be going beyond the scope of just fixing this bug.
If it'd be useful to make both methods work the same way, someone can
refactor the code in a future commit.

* Test different regenerate values with nonexistent keys

This commit changes the test task that generates new keys to use each of
the different values for the `regenerate` argument, which will ensure
that the module is capable of generating a key when no previous key
exists regardless of the value of `regenerate`. Previously, the task
would always run with the `partial_idempotence` value, and that obscured
a bug (#597) that would occur when it was set to `fail`. The bug was
fixed in the previous commit.
2023-05-01 21:16:42 +02:00
Felix Fontein c568923478
x509_crl: prepare releasing the mode option for AnsibleModule's use (#596)
* Prepare releasing the mode option for AnsibleModule's use.

* Update docs.
2023-04-29 20:54:24 +02:00
Felix Fontein ceabef7e58
Do extra docs validation; explicitly disallow semantic markup in docs (#593)
* Do extra docs validation. Explicitly disallow semantic markup in docs.

* Forgot to add new requirement.

* Improve test.

* TEMP - make CI fail.

* Revert "TEMP - make CI fail."

This reverts commit a71b8901c1.

* Remove unnecessary import.

* Make sure ANSIBLE_COLLECTIONS_PATH is set.

* Make sure sanity tests from older Ansible versions don't complain.
2023-04-16 18:18:09 +02:00
Felix Fontein 30756b12ea
Add asn1_base64 option. (#592) 2023-04-16 13:34:45 +02:00
Felix Fontein ec354a8a91
Update CI matrix: add stable-2.15 (#589)
* Add ignore files for bumped devel version.

* Update CI matrix.
2023-04-04 08:42:53 +02:00
Felix Fontein 0829bc641e
Use curl instead of get_url on Python 2.6. (#585) 2023-03-22 21:11:26 +01:00
Felix Fontein 9044f25f33
CI: add extra VM group (#545)
* Add extra VM group.

* Use available VM names.
2023-03-09 07:58:14 +01:00
Felix Fontein f8bd224c99
Add macOS 13.2 to CI (#581)
* Add macOS 13.2 to CI.

* Run brew --prefix with same user used for installing with brew.
2023-03-09 06:42:33 +01:00
Felix Fontein 4d21f1c19c
More bools. (#580) 2023-03-06 23:04:27 +01:00
Felix Fontein 2fb543b144
Normalize bools in tests. (#577) 2023-02-15 22:23:36 +01:00
Felix Fontein b08f6eefe8
Remove unnecessary test imports. (#576) 2023-02-12 20:59:55 +01:00
Felix Fontein c6429eae4f
Fix acme_inspect tests. (#565) 2023-01-22 22:41:12 +01:00
Felix Fontein ddfb18b609
openssl_csr: fix bad tests, avoid accepting invalid crl_distribution_points records (#560)
* Improve error handling.

* Remove invalid tests.

* Add changelog fragment.

* Fix tests.

* Improve exception catching.

Co-authored-by: Kristian Heljas <11139388+kristianheljas@users.noreply.github.com>

* Prevent empty full_name.

* Fix condition. Make sure errors are caught.

* Add more checks.

Co-authored-by: Kristian Heljas <11139388+kristianheljas@users.noreply.github.com>
2023-01-02 14:52:59 +00:00
Felix Fontein 8a80ced4b8
Add openssl_privatekey_info filter (#555)
* Add openssl_privatekey_info filter.

* Update description.
2022-12-31 17:45:45 +01:00
Felix Fontein ef2bb6d510
Add openssl_csr_info ilter. (#554) 2022-12-31 07:58:37 +01:00
Felix Fontein 889cfdf47e
Add openssl_publickey_info filter. (#556) 2022-12-31 07:56:54 +01:00
Felix Fontein c173449c46
Add x509_crl_info filter (#558)
* Add x509_crl_info filter.

* Work around bugs in Ansible 2.9 and ansible-base 2.10.
2022-12-31 07:56:34 +01:00
Felix Fontein c08bae8308
Add x509_certificate_info filter. (#557) 2022-12-31 07:56:11 +01:00
Felix Fontein 80f7b084c0
Add filter module base, prepare adding filters (#553)
* Improve string handling.

* Cleanup tests.

* Add filter module mock.
2022-12-30 20:44:13 +01:00
Felix Fontein 7cc9a70e43
Add split_pem filter (#549)
* Add split_pem filter.

* Fix documentation.

* Python 2.7.

* Improve error message matching.

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
2022-12-27 21:57:20 +01:00
Felix Fontein 5ddfb2c2ca
CI: balance groups (#548)
* Show timings with devel, and skip everything else.

* Move to other group.

* Try smaller SSH key size (i.e. make tests run faster).

* Add implicit size that now must be explicit.

* Change group of luks_device.

* Revert "Show timings with devel, and skip everything else."

This reverts commit 7b73f7e4d7.
2022-12-21 08:12:53 +01:00
Felix Fontein 242c15bf4c
Make sure that iteration_count=1000 is not used with algorithm=argon* (which is SLOW and takes around 10 minutes). (#546) 2022-12-20 20:01:26 +01:00
Felix Fontein 867f407401
CI: improve CI matrix, split into two groups (#544)
* Prepare having more than one group.

* Remove duplicates; add CentOS Stream 8 with Python 3.6.

* Split up tests into two groups.
2022-12-20 12:57:53 +01:00
Felix Fontein ca23b2ed9a
Improve CI (#539)
* Update CI scripts to be more close to the ones in ansible-core.

* Extend CI matrix.

* Mark more VMs.

* Revert "Mark more VMs."

This reverts commit 8bc79af636.

* Disable alpine VMs for get_certificate due to httptester problems.

* Improve retrieval of cryptsetup version.

* ACME 'emulator' won't work on Alpine either.

* Improve luks test setup.

* Make sure wipefs is installed on Alpine.

* dmsetup (from device-mapper) is used by the tests.

* Fix bcrypt install failure handling.

* String, not float.

* openssl_privatekey_convert is not an action module.

* Update Python info.

* Try out which VMs can be used by now.

* Enable ACME tests on all VMs but Alpine; update comment.

* Adjust acme-tiny shebang.

* Remove new entries from CI matrix.
2022-12-11 19:55:47 +01:00
Felix Fontein 664f34f2ac Mark x509_certificate-acme test as target test. 2022-12-09 23:10:26 +01:00
Felix Fontein 045ff10826 Allow changelog fragments with .yaml ending. 2022-11-17 12:41:33 +01:00