Commit Graph

271 Commits (main)

Author SHA1 Message Date
Felix Fontein 4f7ab6733d
Add Ubuntu 20.04 to CI (#176)
* Add Ubuntu 20.04 to CI.

* Also use longer keys for Ubuntu 20.04.

* Fix condition.
2021-01-22 21:39:53 +01:00
Felix Fontein 7714893294
Bump CI to FreeBSD 11.4, 12.2, add FreeBSD 12.1 to remote 2.10 tests (#174)
* Bump CI to FreeBSD 11.4, 12.2, add FreeBSD 12.1 to remote 2.10 tests.

* Use correct package prefix.

* Make more future-proof.
2021-01-22 15:52:43 +01:00
Felix Fontein d921ff1f68
Allow to configure PBKDF (#163)
* Allow to configure PBKDF.

* Also add PBKDF options to key add operation.

* Simplify code.

* Update plugins/modules/luks_device.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Fix indent.

* Use more of the options.

* Bump iteration count.

* Increase memory limit.

* Fall back to default PBKDF.

* Apply suggestions from code review

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2021-01-22 12:21:03 +00:00
NorthFuture 2031787506
Added sever name option to use for SNI (#172)
* Added sever name option to use for SNI

* cleanup code

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

* added module version for new parameter

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

* added SNI explanation

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

* added SNI link to module description

* linting

* cleanup code

* Update plugins/modules/get_certificate.py

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

* integration test for SNI server_name option

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-17 12:21:12 +01:00
Felix Fontein ccb25eab36
luks_device - make add/removal of keyfile/passphrase idempotent (#168)
* Update documentation, adjust tests, add changelog fragment.

* Move module unit test to correct place.

* Implement keyfile / passphrase test.
2021-01-03 11:22:41 +01:00
John R Barker 42e8279c75
Remove PATH hack (#158) 2020-12-11 13:43:34 +00:00
John R Barker 3fa229b7b3
Fix Azure Pipelines (#155)
* Fix Azure Pipelines

* Simplify AZP stages
* Remove hacks, use azure-pipelines-test-container:1.7.0
* Expand test matrix

* chown
2020-12-10 15:40:28 +00:00
John R Barker 52f7f0212b
Basic AZP configuration (#154) 2020-12-08 20:15:34 +00:00
Felix Fontein 4d8dcad190
Speed up tests (#153)
* Improve openssh_* tests.

* Use 2048 instead of 4096 bit keys in many places.

ci_complete

* Parameterize default RSA key length for tests.

* Reduce default RSA key size to 1024.

ci_complete

* Fix error.

ci_complete

* Use variable more often.

* Use 2048 bits for RSA keys for certificates on RHEL8 and CentOS8.

ci_complete

* Fix missing constant.

ci_complete

* Print default key sizes.
2020-12-04 13:08:14 +00:00
Felix Fontein 69335a8bac
Refactor x509_certificate module, add x509_certificate_pipe module (#135)
* Move documentation to doc fragment.

* Prepare module backends.

* Linting.

* Fix comments.

* First shot at actually moving code.

* Forgot SKI check.

* Remove unused imports.

* Improve check mode.

* Fix 'returned'.

* Move csr_* checks.

* Explicitly specify parameter.

* Add x509_certificate_pipe module.

* Update other seealsos.

* Forgot to remove doc fragment.

* Adjust to work with macOS 10.15.

* Update plugins/module_utils/crypto/module_backends/certificate_entrust.py

Co-authored-by: Chris Trufan <31186388+ctrufan@users.noreply.github.com>

* Add changelog fragments for entrust bugfix and module refactorings.

* Restore old behavior of Entrust backend when existing certificate cannot be parsed.

* Update plugins/modules/x509_certificate_pipe.py

Co-authored-by: Chris Trufan <31186388+ctrufan@users.noreply.github.com>

* Remove Entrust provider from x509_certificate_pipe for now.

* Add own CA tests.

* One more fix for Entrust provider, when csr_content is used.

* Update plugins/modules/x509_certificate_pipe.py

Co-authored-by: Chris Trufan <31186388+ctrufan@users.noreply.github.com>

* Fix another broken example.

* Revert "Remove Entrust provider from x509_certificate_pipe for now."

This reverts commit 6ee5d7d4f99f0fe2218276a2d3f1f38b676c29b9.

* ci_complete

* Apply suggestions from code review

Co-authored-by: MarkusTeufelberger <mteufelberger@mgit.at>

* Improve example.

* Improve readability of example, add another one.

* Extend descriptions of csr_* for selfsigned.

* Improve documentation.

* Move deprecation message up.

* Explain empty choices.

Co-authored-by: Chris Trufan <31186388+ctrufan@users.noreply.github.com>
Co-authored-by: MarkusTeufelberger <mteufelberger@mgit.at>
2020-11-24 17:21:52 +01:00
Norman Ziegner 86b39733e1
openssl_pkcs12: Add a check for parsed pkcs12 files (#145)
* openssl_pkcs12: Add a check for parsed pkcs12 files

Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>

* Add changelog fragment

Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>

* openssl_pkcs12: Report changed state when a pkcs12 file is dumped

Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>

* Add a basic test for dumping a pkcs12 file

Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>

* Update changelog fragment

Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>

* Add test for dumped pkcs12 file in check mode

Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
2020-11-23 09:14:45 +01:00
Felix Fontein 942255923b
Add x509_certificate tests for ACME provider (#142)
* Add x509_certificate tests for ACME provider.

* Make it work with Python 2.x.

* Cleanup.

* Add more tests.
2020-11-13 08:22:32 +01:00
Felix Fontein 5ffe97f874
Work around problem with cryptography being upgraded while installing pyOpenSSL (#137)
* Work around problem with cryptography being upgraded while installing pyOpenSSL.

* Avoid another instability.
2020-11-03 12:39:58 +01:00
Felix Fontein ec7e4916e5
Move action_module from module_utils to plugin_utils (#134)
* Move action_module from module_utils to plugin_utils.

* ci_complete
2020-11-03 09:21:35 +01:00
Felix Fontein ec55161cb1
Run tests with macOS 10.15. (#112)
* Run tests with macOS 10.15.

* Update prepare_http_tests as in https://github.com/ansible/ansible/pull/71841/files.

* Also skip luks_device tests on macOS.

* Temporarily restrict to macOS/OSX nodes.

* Show full OpenSSL version.

* Show pyOpenSSL debug details.

* Make location of openssl binary configurable.

* Try to upgrade openssl on macOS when LibreSSL is found.

* Use other variable.

* Use found binary instead of default.

* Revert "Temporarily restrict to macOS/OSX nodes."

This reverts commit ea379382e5.

ci_complete

* Avoid crashing when OpenSSL.debug does not exist.

* Combine setup_openssl_cli with setup_openssl

* Split up setup_openssl in setup_openssl (openssl + cryptography) and setup_pyopenssl.

* Fix package name.

* Don't install cryptography on CentOS 6, print environment.

* Work around ansible-test limitation.
2020-11-03 08:45:32 +01:00
Felix Fontein 7559e912f1
Run unit tests for all Python versions in one CI node (#133)
* Run unit tests for all Python versions in one CI node.

* Linting.
2020-10-29 15:03:35 +01:00
Felix Fontein 3c21079afa
Refactor openssl_privatekey module, move add openssl_privatekey_pipe module (#119)
* Move disk-independent parts of openssl_privatekey to module_utils and doc_fragments.

* Improve documentation.

* Add openssl_privatekey_pipe module.

* Fallback in case no fingerprints are returned.

* Prevent no_log=True for content to stop module from working correctly.

* Forgot version_added.

* Update copyright. All the interesting code is no longer in this file anyway.

* Remove file arguments.

* Add framework for action modules.

* Convert openssl_privatekey_pipe to action plugin.

* Linting.

* Bump version.

* Add return_current_key option.

* Add no_log to examples.

* Remove preparation for potential later extensibility (easy to re-add when needed).

* Fix deprecation version in docs.

* Use new ArgumentSpec object for AnsibleActionModule as well.
2020-10-28 21:52:54 +01:00
Felix Fontein 9792188b0e
Refactor openssl_csr module, add openssl_csr_pipe module (#123)
* Extract doc fragment from openssl_csr.

* Refactor openssl_csr module into backend + module.

* Add openssl_csr_pipe module.

* Add seealso references.

* ...

* Use /dev/stdin instead of -, which seems to be only supported by newer openssl versions.

* Bump version.

* DRY: use select_message_digest.

* Fix deprecation version in docs.

* Docs improvements.

* Improve argument spec handling for module backends.

* Linting.

* Fix linting problems by using kwargs.
2020-10-27 12:37:40 +01:00
Felix Fontein fd7871ae7d
Allow to run x509_certificate selfsigned provider without providing a CSR (#129)
* Allow to run x509_certificate selfsigned provider without providing a CSR.

* Add missing prefixes (unrelated).
2020-10-19 18:09:40 +02:00
Doug Stanley b32adcce78
Implement use_agent option to get signing key from ssh-agent. (#117) 2020-10-19 18:07:36 +02:00
Felix Fontein 7d0e5e814e
Return certificate fingerprints from x509_certificate_info (#121)
* Return certificate fingerprints from x509_certificate_info.

* Update plugins/modules/x509_certificate_info.py

Co-authored-by: MarkusTeufelberger <mteufelberger@mgit.at>

Co-authored-by: MarkusTeufelberger <mteufelberger@mgit.at>
2020-10-13 10:41:09 +02:00
Felix Fontein 42dd19c387
Allow to pass CSR to acme_certificate as csr_content (#115)
* Allow to pass CSR to acme_certificate as csr_content.

* Make sure contents are bytes.

* No need to write CSR to disk.

* Forgot version_added.

* Fix documentation.
2020-10-09 14:01:34 +02:00
Felix Fontein 8e10e1e590
Always show current backend during tests in `name:`. (#118)
* Always show current backend during tests.

* Remove double prefix.
2020-10-09 11:10:53 +02:00
Andrew Klychkov 010b54f0af
CI tests: add a note not to use tests as an example of writing roles (#111) 2020-09-25 09:25:48 +03:00
Felix Fontein 7cdfdc1bfb
openssl_pkcs12: do not crash when there's no certificate and/or private key in existing PKCS#12 file (#109)
* Do not crash when PKCS#12 file contains no private key and/or main certificate.

* Add changelog fragment.

* Call getters only once each, check explicitly for None.

* Add test.

* Also 'parse' correctly PKCS#12 file with no private key.
2020-09-16 09:25:24 +00:00
Felix Fontein 1b3ff44bc2
Avoid cffi 1.14.3 to be installed in CI by old pip versions (#110)
* Avoid cffi 1.14.3 to be installed in CI by old pip versions.

* Avoid too old version being installed.

* Add missing target.
2020-09-16 10:48:43 +02:00
Felix Fontein a2f36f426a
openssl_csr: catch errors on bad SANs (#106)
* Catch errors on bad SANs.

* Add changelog fragment.

* Adjust cryptography version and error message.
2020-09-08 04:24:30 +00:00
Markus Teufelberger 346c2f55ff Update openssl_signature module (#63)
* Use module_utils from collection, clean up code a bit

 * add DSA keys, because why not...

 * sign/verify was added in pyOpenSSL 0.11 apparently

 * Add signing capability detection to module_utils.crypto.basic

 * Rework feature detection of signature types.

 * Rename parameters to match other modules

 * Add initial version of integration tests

 * fix whitespace in tests

 * More whitespace fixes

 * small fixes for issues in testing

 * Organize integration tests as test matrix

 * another indentation fix to make pep8 happy

 * use openssl pkeyutl when possible, otherwise fall back to openssl dgst

 * More linter fixes

 * openssl pkeyutl -help can apparently return 1

 * ignore errors on openssl call and another try at formatting

 * Remove the OpenSSL calls in tests

 * Add collection name to deprecation notice and deprecate at version 2.0.0

 * Exclude Ed448/25519 tests on pyopenssl

 * revert the collection name in the deprecation notice (breaks 2.9)

 * limit test platforms even more

 * disable FreeBSD DSA and ECC tests

 * Add module name to README

 * rewrite and split into 2 modules instead

 * add module to README and fix whitespace issue

 * remove duplicated tests

 * address review remarks

 * resolve another comment
2020-08-18 15:18:59 +02:00
Felix Fontein 84342fce4e
openssl_csr: add support for name constraints extension (#92)
* Add support for name constraints extension to openssl_csr.

* Linting.

* Add tests.

* Fix IP address general name handling.
2020-08-18 12:23:37 +02:00
Felix Fontein d03e723fe0
acme_account: add support for External Account Binding (#100)
* acme_account: add support for External Account Binding.

* Add changelog fragment.

* Error if externalAccountRequired is set in ACME directory meta, but external account data is not provided.

* Validate that EAB key is Base64URL encoded.

* Improve documentation.

* Add padding to Base64 encoded key if necessary.

* Make account creation idempotent with ZeroSSL.
2020-08-16 18:00:26 +02:00
Felix Fontein 2f59d44f9e
acme_certificate - allow to select first certificate in chain. (#102) 2020-08-15 21:50:09 +02:00
Arnoways e4c12fa4e5
Add cipher and hash options to luks_create (#97) 2020-08-13 22:17:36 +02:00
Felix Fontein 7f6db5c4d9
Run ACME tests with the latest ACME test container (https://github.com/ansible/acme-test-container/releases/tag/2.0.0). (#98)
ci_complete
2020-08-05 08:24:00 +02:00
Felix Fontein 1847b3ead7
Tests (#94)
* Fix CI test groups.

* Make files more similar.

* Run most tests in both cloud and OS-specific environments.

* Run ACME tests in both cloud and OS-specific environments.

* Use different Python version for 2.9 cloud test.

* Revert "Run ACME tests in both cloud and OS-specific environments."

This reverts commit 967bda9438.

* Revert "Run most tests in both cloud and OS-specific environments."

This reverts commit 6e9f090afd.
2020-07-27 16:43:43 +02:00
Felix Fontein 05b0bdbe0d
Support arbitrary dotted notation for OIDs in cryptography backend (#91)
* Support arbitrary dotted notation for OIDs in cryptography backend.

* Add test.

* Fix typos.

* Fix order.
2020-07-21 15:33:05 +02:00
Felix Fontein 79f4d869ad
Fix sanity test errors. (#79) 2020-07-01 14:16:52 +02:00
Felix Fontein 390cb1ccc1
Prepare release (#75)
* Improve changelog generator config.

* We don't have docs at that URL.

* Require Ansible(-base) 2.9.10 or newer.

Needed for deprecation syntax.

* Update all deprecations from Ansible 2.1x to community.crypto 2.0.0.

* Forgot to check in fixes.

* Shorten lines.

* Fix unit test requirements.

* Fix YAML strings which only had a closing quote.

* Galaxy neither likes uppercase nor spaces in tags.

* General README improvements.

* Add roadmap section to README.

* Next release will be 1.0.0.

* Extend using instructions.

* Tags with dashes are also not allowed.

* Fix changelog link.
2020-07-01 13:49:25 +02:00
Jordan Borean 70683e540d
Support otherName in subAltName in CSR for UTF8 strings (#53)
* Support otherName in subAltName in CSR for UTF8 strings

* Remove uneeded docs and added changelog fragment

* Missed a merge conflict

* Fix up sanity issues and added test expectation

* Rename function
2020-06-23 22:38:42 +02:00
Felix Fontein ca58a1d2ee Remove no longer necessary hack for stable-2.9. 2020-06-23 13:38:14 +02:00
Felix Fontein cb384443e4
cryptography backend: parse dirName, RID and otherName names (#9) 2020-06-21 22:47:48 +02:00
Felix Fontein 8651a6af6c
Prepare for stable-2.10 branching of ansible-base (#71)
* Prepare for 2.11.

* Fix script.

* Add some Ansible 2.10 runs.
2020-06-17 23:00:30 +02:00
Felix Fontein ff17a341af
Prepare for devel version bump. (#70) 2020-06-16 21:16:30 +02:00
Felix Fontein 15288753cb
Disable extra changelog fragment lint sanity test. (#68) 2020-06-14 17:43:49 +02:00
Felix Fontein ddcbb04432
Adjust tests/sanity/ignore-2.10.txt to deprecation changes. (#65)
ci_complete
2020-06-10 06:33:40 +00:00
Felix Fontein 79fd1397a9
antsibull-changelog moved to its own repo. (#62) 2020-05-30 01:26:56 +02:00
Felix Fontein 1e1c101910
Adjust to stricter ansible-test sanity tests. (#61) 2020-05-29 07:57:12 +02:00
Felix Fontein 68d56c7709
Adjust hack to only consider OSX with Anible 2.9. (#59) 2020-05-27 01:28:13 +02:00
Felix Fontein 06891337d1
Use pypi antsibull package. (#58) 2020-05-27 01:10:49 +02:00
Felix Fontein 3fae4be64d
ansibulled -> antsibull. (#57) 2020-05-26 22:58:36 +02:00
Felix Fontein f77a03f70e
Smoketests are not needed in collections, and none exist in this collection anyway. (#52) 2020-05-19 09:02:53 +02:00
Felix Fontein a8fb38f74a
Add extra sanity tests (#43)
* Prepare extra sanity tests.

* Run some extra sanity tests.

* Linting.

* Experimenting

* Linting.

* Run tests in docker container.

* Improve run code.

* Use requests instead of Ansible code (which needs to be installed first).

* Refactor and add more debugging.

* More ls.

* More ls.

* More ls in container.

* Copy cwd into container.

* Improve container handling.

* Make tests configurable.

* Using proper argument parser.

* Add colors.

* Allow to disable test.

* Always run all tests for now. (Change detection needs to know about git I think).

* Use argument parser for main executable. Force colors for CI.

* Allow to specify targets.

* Linting.

* Switch to ansibulled-changelog.

* Use runner from community.internal_test_tools (current dev branch for runner).

* Clone official repository instead of my fork/branch.
2020-05-16 12:05:03 +00:00
Felix Fontein de3c99eeac
Add support for CRLs in DER format. (#29) 2020-05-15 09:57:07 +02:00
Felix Fontein f2aa6f3ae8
Ignore invalid deprecation version numbers. (#48) 2020-05-13 23:45:21 +02:00
Felix Fontein 9a096dd146
Refactor module_utils/crypto.py (#27)
* Refactor module_utils/crypto.py: split up into multiple smaller modules

* Remove superfluous files.

* Fix sanity errors.

* Move CRL entry dumping code to module_utils.

* Move obj2txt usage from CRL modules to module_utils/crpyto/cryptography_crl.

* Move generic I/O functions to plugins/module_utils/io.py.

* Add helper method for retrieving serial number of certificate.

* Add compatibility code into __init__.py.

* Fix syntax error, and add ignore.txt entries for non-empty __init__.
2020-05-12 11:19:42 +02:00
Felix Fontein 43b6765c00
[TEMP] Switch to Ansible 2.9 from ansible/ansible#69377 which should fix change detection for 2.9. (#45) 2020-05-08 08:27:08 +02:00
Felix Fontein 970d44a25c
Avoid sanity excludes so that users can run ansible-test sanity --docker and it usually passes. (#41) 2020-05-01 12:21:15 +02:00
Felix Fontein cb61069ce3 Fix repo name. 2020-04-25 11:31:36 +02:00
Felix Fontein 9cf994f2eb Adjust coverage part in CI for Ansible 2.9. 2020-04-24 14:19:33 +02:00
Felix Fontein 5686c74e76
Hack, v2. (#36)
ci_complete
2020-04-23 22:48:52 +02:00
Felix Fontein 1289e56ab1
Hack: install latest cryptography + pyOpenSSL versions on macOS until https://github.com/ansible/ansible/issues/68701 has been fixed (#35) 2020-04-23 22:02:56 +02:00
John R Barker d88c90b148
Correct codecov token 2020-04-23 20:02:14 +01:00
Felix Fontein 41562a0c22
Update testing (#26)
* Remove superfluous requirements file.

* Update RHEL 7.6 to RHEL 7.8 in CI.

* Use stable-2.9 branch instead of latest released 2.9 version.

* Remove ignore.txt entries.

ci_complete
2020-04-10 15:44:42 +02:00
Felix Fontein 4597f77448
Stop using custom branch to avoid full CI run on changelog fragments. (#25) 2020-04-09 12:21:29 +02:00
Felix Fontein f7dbd61fa7
Rename openssl_certificate* to x509_certificate* (#7)
* Rename openssl_certificate* to x509_certificate*.

* Update README.

* Add redirects.

* Also print warnings when using Ansible 2.9.

* Adjust ignore-2.9.txt.

* Update documentation.
2020-04-06 14:34:24 +02:00
Felix Fontein 6b3ca2ca07
Ansible 2.9 tests (#14)
* Add CI group 2 for Ansible 2.9 tests.

* Temporarily disable some nodes.

* Fix ignore.txt.

* Use version prefix instead of groups.

* Ansible 2.9 doesn't support Python 3.9

ci_complete

* Make Ansible 2.9 compatible.

* Replace archive/unarchive with copy.

* Remove dependency on community.general in integration tests for Ansible 2.9.

* Let's see.

* Ansible 2.9's copy doesn't create directories.

* Re-enable no dependency.

ci_complete

* path should be bytes.

* Reenable nodes, add two more.

* Force complete CI run for Ansible 2.9.

* Used wrong variable.

* Fix Ansible 2.9 compatibility...
2020-04-01 11:35:43 +02:00
Felix Fontein 88ee99423c
Remove stray copies. (#6) 2020-03-31 16:12:49 +02:00
Felix Fontein a046fa1ddc
Move modules and module_utils unit tests to correct place (#13)
* Move modules and module_utils unit tests to correct place.

* Update ignore.txt
2020-03-31 10:05:49 +02:00
Felix Fontein de5b514629 Work around not yet complete package manager detection for ACD. (#5) 2020-03-29 20:02:02 +02:00
Felix Fontein e91849d1d8 Add shippable tests. (#4) 2020-03-29 20:01:53 +02:00
Felix Fontein 70615300fb Remove dependency on ansible.netcommon collection (#2)
* Get rid of ansible.netcommon requirement by integrating module_utils/compat/ipaddress.py.

* Reorder imports.

* Update ignore.txt for plugins/module_utils/compat/ipaddress.py.

* Linting (flake8 / pep8).

* Remove accidentally commited test for ansible/ansible#66920.
2020-03-29 18:44:40 +02:00
Ansible Core Team a9f45b4d5b Initial commit 2020-03-09 13:11:34 +00:00