2018-12-23 10:23:31 +01:00
|
|
|
---
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate (test - verify CA)
|
2018-06-21 09:11:00 +02:00
|
|
|
shell: 'openssl verify -CAfile {{ output_dir }}/ca_cert.pem {{ output_dir }}/ownca_cert.pem | sed "s/.*: \(.*\)/\1/g"'
|
|
|
|
register: ownca_verify_ca
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate (test - ownca certificate modulus)
|
2018-06-21 09:11:00 +02:00
|
|
|
shell: 'openssl x509 -noout -modulus -in {{ output_dir }}/ownca_cert.pem'
|
|
|
|
register: ownca_cert_modulus
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate (test - ownca issuer value)
|
2018-06-21 09:11:00 +02:00
|
|
|
shell: 'openssl x509 -noout -in {{ output_dir}}/ownca_cert.pem -text | grep "Issuer" | sed "s/.*: \(.*\)/\1/g"'
|
|
|
|
register: ownca_cert_issuer
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate (test - ownca certficate version == default == 3)
|
2018-06-21 09:11:00 +02:00
|
|
|
shell: 'openssl x509 -noout -in {{ output_dir}}/ownca_cert.pem -text | grep "Version" | sed "s/.*: \(.*\) .*/\1/g"'
|
|
|
|
register: ownca_cert_version
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate (assert)
|
2018-06-21 09:11:00 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- ownca_verify_ca.stdout == 'OK'
|
|
|
|
- ownca_cert_modulus.stdout == privatekey_modulus.stdout
|
|
|
|
- ownca_cert_version.stdout == '3'
|
2018-10-16 21:38:52 +02:00
|
|
|
# openssl 1.1.x adds a space between the output
|
|
|
|
- ownca_cert_issuer.stdout in ['CN=Example CA', 'CN = Example CA']
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate idempotence
|
2018-06-21 09:11:00 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- ownca_certificate.serial_number == ownca_certificate_idempotence.serial_number
|
|
|
|
- ownca_certificate.notBefore == ownca_certificate_idempotence.notBefore
|
|
|
|
- ownca_certificate.notAfter == ownca_certificate_idempotence.notAfter
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- block:
|
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate v2 (test - ownca certificate version == 2)
|
|
|
|
shell: 'openssl x509 -noout -in {{ output_dir}}/ownca_cert_v2.pem -text | grep "Version" | sed "s/.*: \(.*\) .*/\1/g"'
|
|
|
|
register: ownca_cert_v2_version
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate version 2 (assert)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- ownca_cert_v2_version.stdout == '2'
|
|
|
|
when: "select_crypto_backend != 'cryptography'"
|
|
|
|
|
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate v2 (test - ownca certificate version == 2)
|
2018-06-21 09:11:00 +02:00
|
|
|
assert:
|
|
|
|
that:
|
2019-03-22 14:21:23 +01:00
|
|
|
- ownca_v2_certificate is failed
|
|
|
|
- "'The cryptography backend does not support v2 certificates' in ownca_v2_certificate.msg"
|
|
|
|
when: "select_crypto_backend == 'cryptography'"
|
|
|
|
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate2 (test - ownca certificate modulus)
|
2018-06-21 09:11:00 +02:00
|
|
|
shell: 'openssl x509 -noout -modulus -in {{ output_dir }}/ownca_cert2.pem'
|
|
|
|
register: ownca_cert2_modulus
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate2 (assert)
|
2018-06-21 09:11:00 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- ownca_cert2_modulus.stdout == privatekey2_modulus.stdout
|
2018-10-26 05:41:00 +02:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate owncal certificate3 (test - notBefore)
|
2018-10-26 05:41:00 +02:00
|
|
|
shell: 'openssl x509 -noout -in {{ output_dir }}/ownca_cert3.pem -text | grep "Not Before" | sed "s/.*: \(.*\) .*/\1/g"'
|
|
|
|
register: ownca_cert3_notBefore
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate3 (test - notAfter)
|
2018-10-26 05:41:00 +02:00
|
|
|
shell: 'openssl x509 -noout -in {{ output_dir }}/ownca_cert3.pem -text | grep "Not After" | sed "s/.*: \(.*\) .*/\1/g"'
|
|
|
|
register: ownca_cert3_notAfter
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate3 (assert - notBefore)
|
2018-10-26 05:41:00 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- ownca_cert3_notBefore.stdout == 'Oct 23 13:37:42 2018'
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca certificate3 (assert - notAfter)
|
2018-10-26 05:41:00 +02:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- ownca_cert3_notAfter.stdout == 'Oct 23 13:37:42 2019'
|
2018-12-23 10:23:31 +01:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca ECC certificate (test - ownca certificate pubkey)
|
2018-12-23 10:23:31 +01:00
|
|
|
shell: 'openssl x509 -noout -pubkey -in {{ output_dir }}/ownca_cert_ecc.pem'
|
|
|
|
register: ownca_cert_ecc_pubkey
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca ECC certificate (test - ownca issuer value)
|
2018-12-23 10:23:31 +01:00
|
|
|
shell: 'openssl x509 -noout -in {{ output_dir}}/ownca_cert_ecc.pem -text | grep "Issuer" | sed "s/.*: \(.*\)/\1/g"'
|
|
|
|
register: ownca_cert_ecc_issuer
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}}) Validate ownca ECC certificate (assert)
|
2018-12-23 10:23:31 +01:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- ownca_cert_ecc_pubkey.stdout == privatekey_ecc_pubkey.stdout
|
|
|
|
# openssl 1.1.x adds a space between the output
|
|
|
|
- ownca_cert_ecc_issuer.stdout in ['CN=Example CA', 'CN = Example CA']
|
2019-03-08 17:21:18 +01:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA validation, {{select_crypto_backend}})
|
2019-03-08 17:21:18 +01:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- passphrase_error_1 is failed
|
|
|
|
- "'assphrase' in passphrase_error_1.msg or 'assword' in passphrase_error_1.msg"
|
|
|
|
- passphrase_error_2 is failed
|
|
|
|
- "'assphrase' in passphrase_error_1.msg or 'assword' in passphrase_error_2.msg"
|
|
|
|
- passphrase_error_3 is failed
|
|
|
|
- "'assphrase' in passphrase_error_1.msg or 'assword' in passphrase_error_3.msg"
|