mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
9ea1b18ff7
* allow multiple values per key in name fields in openssl_certificate * check correct side of comparison * trigger only on lists * add subject parameter to openssl_csr * fix key: value mapping not skipping None elements * temporary fix for undefined "subject" field * fix iteration over subject entries * fix docs * quote sample string * allow csr with only subject defined * fix integration test * look up NIDs before comparing, add hidden _strict params * deal with empty issuer/subject fields * adapt integration tests * also normalize output from pyopenssl * fix issue with _sanitize_inputs * don't convert empty lists * workaround for pyopenssl limitations * properly encode the input to the txt2nid function * another to_bytes fix * make subject, commonname and subjecAltName completely optional * don't compare hashes of keys in openssl_csr integration tests * add integration test for old API in openssl_csr * compare keys directly in certificate and publickey integration tests * fix typo
83 lines
2.9 KiB
YAML
83 lines
2.9 KiB
YAML
- name: Validate public key (test - privatekey modulus)
|
|
shell: 'openssl rsa -noout -modulus -in {{ output_dir }}/privatekey.pem'
|
|
register: privatekey_modulus
|
|
|
|
- name: Validate public key (test - publickey modulus)
|
|
shell: 'openssl rsa -pubin -noout -modulus < {{ output_dir }}/publickey.pub'
|
|
register: publickey_modulus
|
|
|
|
- name: Validate public key (assert)
|
|
assert:
|
|
that:
|
|
- publickey_modulus.stdout == privatekey_modulus.stdout
|
|
|
|
- name: Validate public key - OpenSSH format (test - privatekey's publickey)
|
|
shell: 'ssh-keygen -y -f {{ output_dir }}/privatekey.pem'
|
|
register: privatekey_publickey
|
|
when: cryptography_version.stdout is version('1.4.0', '>=')
|
|
|
|
- name: Validate public key - OpenSSH format (test - publickey)
|
|
slurp:
|
|
src: '{{ output_dir }}/publickey-ssh.pub'
|
|
register: publickey
|
|
when: cryptography_version.stdout is version('1.4.0', '>=')
|
|
|
|
- name: Validate public key - OpenSSH format (assert)
|
|
assert:
|
|
that:
|
|
- privatekey_publickey.stdout == '{{ publickey.content|b64decode }}'
|
|
when: cryptography_version.stdout is version('1.4.0', '>=')
|
|
|
|
- name: Validate public key - OpenSSH format - test idempotence (issue 33256)
|
|
assert:
|
|
that:
|
|
- publickey_ssh_idempotence is not changed
|
|
when: cryptography_version.stdout is version('1.4.0', '>=')
|
|
|
|
- name: Validate publickey2 (test - Ensure key has been removed)
|
|
stat:
|
|
path: '{{ output_dir }}/publickey2.pub'
|
|
register: publickey2
|
|
|
|
- name: Validate publickey2 (assert - Ensure key has been removed)
|
|
assert:
|
|
that:
|
|
- publickey2.stat.exists == False
|
|
|
|
|
|
- name: Validate publickey3 (test - privatekey modulus)
|
|
shell: 'openssl rsa -noout -modulus -in {{ output_dir }}/privatekey3.pem -passin pass:ansible'
|
|
register: privatekey3_modulus
|
|
when: openssl_version.stdout is version('0.9.8zh', '>=')
|
|
|
|
- name: Validate publickey3 (test - publickey modulus)
|
|
shell: 'openssl rsa -pubin -noout -modulus < {{ output_dir }}/publickey3.pub'
|
|
register: publickey3_modulus
|
|
when: openssl_version.stdout is version('0.9.8zh', '>=')
|
|
|
|
- name: Validate publickey3 (assert)
|
|
assert:
|
|
that:
|
|
- publickey3_modulus.stdout == privatekey3_modulus.stdout
|
|
when: openssl_version.stdout is version('0.9.8zh', '>=')
|
|
|
|
- name: Validate publickey3 idempotence (assert)
|
|
assert:
|
|
that:
|
|
- publickey3_idempotence is not changed
|
|
|
|
- name: Validate publickey4 (test - privatekey modulus)
|
|
shell: 'openssl rsa -noout -modulus -in {{ output_dir }}/privatekey.pem'
|
|
register: privatekey4_modulus
|
|
when: openssl_version.stdout is version('0.9.8zh', '>=')
|
|
|
|
- name: Validate publickey4 (test - publickey modulus)
|
|
shell: 'openssl rsa -pubin -noout -modulus < {{ output_dir }}/publickey4.pub'
|
|
register: publickey4_modulus
|
|
when: openssl_version.stdout is version('0.9.8zh', '>=')
|
|
|
|
- name: Validate publickey4 (assert)
|
|
assert:
|
|
that:
|
|
- publickey4_modulus.stdout == privatekey4_modulus.stdout
|
|
when: openssl_version.stdout is version('0.9.8zh', '>=')
|