mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 13:22:58 +00:00
openssl_csr: extend tests to check for privatekey_content together with privatekey_passphrase (#490)
* Extend tests to check for privatekey_content together with privatekey_passphrase. * Also test privatekey_content for private keys without passphrases.
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||
size: '{{ default_rsa_key_size }}'
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Read privatekey"
|
||||
slurp:
|
||||
src: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||
register: privatekey
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Generate CSR (check mode)"
|
||||
openssl_csr:
|
||||
path: '{{ remote_tmp_dir }}/csr.csr'
|
||||
@@ -28,7 +33,7 @@
|
||||
- name: "({{ select_crypto_backend }}) Generate CSR (idempotent)"
|
||||
openssl_csr:
|
||||
path: '{{ remote_tmp_dir }}/csr.csr'
|
||||
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||
privatekey_content: '{{ privatekey.content | b64decode }}'
|
||||
subject_ordered:
|
||||
- commonName: www.ansible.com
|
||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||
@@ -264,6 +269,11 @@
|
||||
select_crypto_backend: cryptography
|
||||
size: '{{ default_rsa_key_size }}'
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Read privatekey"
|
||||
slurp:
|
||||
src: '{{ remote_tmp_dir }}/privatekeypw.pem'
|
||||
register: privatekeypw
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Generate CSR with privatekey passphrase"
|
||||
openssl_csr:
|
||||
path: '{{ remote_tmp_dir }}/csr_pw.csr'
|
||||
@@ -272,6 +282,14 @@
|
||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||
register: passphrase_1
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Generate CSR with privatekey passphrase and private key content"
|
||||
openssl_csr:
|
||||
path: '{{ remote_tmp_dir }}/csr_pw.csr'
|
||||
privatekey_content: '{{ privatekeypw.content | b64decode }}'
|
||||
privatekey_passphrase: hunter2
|
||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||
register: passphrase_1_content
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Generate CSR (failed passphrase 1)"
|
||||
openssl_csr:
|
||||
path: '{{ remote_tmp_dir }}/csr_pw1.csr'
|
||||
|
||||
@@ -132,7 +132,13 @@
|
||||
- country_idempotent_3 is not changed
|
||||
- country_fail_4 is failed
|
||||
|
||||
- name:
|
||||
- name: "({{ select_crypto_backend }}) Validate idempotency of privatekey_passphrase"
|
||||
assert:
|
||||
that:
|
||||
- passphrase_1 is changed
|
||||
- passphrase_1_content is not changed
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Validate private key passphrase errors"
|
||||
assert:
|
||||
that:
|
||||
- passphrase_error_1 is failed
|
||||
|
||||
Reference in New Issue
Block a user