2018-12-23 10:23:31 +01:00
|
|
|
---
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate CA privatekey
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_privatekey:
|
|
|
|
path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
|
2019-05-08 05:58:15 +02:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate CA privatekey with passphrase
|
|
|
|
openssl_privatekey:
|
|
|
|
path: '{{ output_dir }}/ca_privatekey_pw.pem'
|
|
|
|
passphrase: hunter2
|
|
|
|
cipher: auto
|
|
|
|
select_crypto_backend: cryptography
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate CA CSR
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_csr:
|
|
|
|
path: '{{ output_dir }}/ca_csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
subject:
|
|
|
|
commonName: Example CA
|
2019-01-21 18:19:05 +01:00
|
|
|
useCommonNameForSAN: no
|
2018-10-16 21:38:52 +02:00
|
|
|
basic_constraints:
|
|
|
|
- 'CA:TRUE'
|
|
|
|
basic_constraints_critical: yes
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-05-08 05:58:15 +02:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate CA CSR (privatekey passphrase)
|
|
|
|
openssl_csr:
|
|
|
|
path: '{{ output_dir }}/ca_csr_pw.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/ca_privatekey_pw.pem'
|
|
|
|
privatekey_passphrase: hunter2
|
|
|
|
subject:
|
|
|
|
commonName: Example CA
|
|
|
|
useCommonNameForSAN: no
|
|
|
|
basic_constraints:
|
|
|
|
- 'CA:TRUE'
|
|
|
|
basic_constraints_critical: yes
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate selfsigned CA certificate
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
csr_path: '{{ output_dir }}/ca_csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_digest: sha256
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-05-08 05:58:15 +02:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate selfsigned CA certificate (privatekey passphrase)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ca_cert_pw.pem'
|
|
|
|
csr_path: '{{ output_dir }}/ca_csr_pw.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/ca_privatekey_pw.pem'
|
|
|
|
privatekey_passphrase: hunter2
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_digest: sha256
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate ownca certificate
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2018-06-21 09:11:00 +02:00
|
|
|
register: ownca_certificate
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate ownca certificate
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2018-06-21 09:11:00 +02:00
|
|
|
register: ownca_certificate_idempotence
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate ownca certificate (check mode)
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2018-06-21 09:11:00 +02:00
|
|
|
check_mode: yes
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Check ownca certificate
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert.pem'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
provider: assertonly
|
|
|
|
has_expired: False
|
|
|
|
version: 3
|
|
|
|
signature_algorithms:
|
|
|
|
- sha256WithRSAEncryption
|
|
|
|
- sha256WithECDSAEncryption
|
|
|
|
subject:
|
|
|
|
commonName: www.example.com
|
|
|
|
issuer:
|
|
|
|
commonName: Example CA
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate ownca v2 certificate
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_v2.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
|
|
|
ownca_version: 2
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: ownca_v2_certificate
|
|
|
|
ignore_errors: true
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate ownca certificate2
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert2.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr2.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey2.pem'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Check ownca certificate2
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert2.pem'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey2.pem'
|
|
|
|
provider: assertonly
|
|
|
|
has_expired: False
|
|
|
|
version: 3
|
|
|
|
signature_algorithms:
|
|
|
|
- sha256WithRSAEncryption
|
|
|
|
- sha256WithECDSAEncryption
|
|
|
|
subject:
|
|
|
|
commonName: www.example.com
|
|
|
|
C: US
|
|
|
|
ST: California
|
|
|
|
L: Los Angeles
|
|
|
|
O: ACME Inc.
|
|
|
|
OU:
|
|
|
|
- Roadrunner pest control
|
|
|
|
- Pyrotechnics
|
|
|
|
keyUsage:
|
|
|
|
- digitalSignature
|
|
|
|
extendedKeyUsage:
|
|
|
|
- ipsecUser
|
|
|
|
- biometricInfo
|
|
|
|
issuer:
|
|
|
|
commonName: Example CA
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Create ownca certificate with notBefore and notAfter
|
2018-10-26 05:41:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
provider: ownca
|
|
|
|
ownca_not_before: 20181023133742Z
|
|
|
|
ownca_not_after: 20191023133742Z
|
|
|
|
path: "{{ output_dir }}/ownca_cert3.pem"
|
|
|
|
csr_path: "{{ output_dir }}/csr.csr"
|
|
|
|
privatekey_path: "{{ output_dir }}/privatekey3.pem"
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2018-12-23 10:23:31 +01:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Create ownca certificate with relative notBefore and notAfter
|
2019-01-22 21:41:02 +01:00
|
|
|
openssl_certificate:
|
|
|
|
provider: ownca
|
|
|
|
ownca_not_before: +1s
|
|
|
|
ownca_not_after: +52w
|
|
|
|
path: "{{ output_dir }}/ownca_cert4.pem"
|
|
|
|
csr_path: "{{ output_dir }}/csr.csr"
|
|
|
|
privatekey_path: "{{ output_dir }}/privatekey3.pem"
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2019-01-22 21:41:02 +01:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate ownca ECC certificate
|
2018-12-23 10:23:31 +01:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_ecc.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey_ecc.pem'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2018-12-23 10:23:31 +01:00
|
|
|
register: ownca_certificate_ecc
|
|
|
|
|
2019-05-08 05:58:15 +02:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate selfsigned certificate (privatekey passphrase)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_ecc_2.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert_pw.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey_pw.pem'
|
|
|
|
ownca_privatekey_passphrase: hunter2
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: selfsigned_certificate_passphrase
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate ownca certificate (failed passphrase 1)
|
2019-03-08 17:21:18 +01:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_pw1.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
ownca_privatekey_passphrase: hunter2
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2019-03-08 17:21:18 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
register: passphrase_error_1
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate ownca certificate (failed passphrase 2)
|
2019-03-08 17:21:18 +01:00
|
|
|
openssl_certificate:
|
2019-05-08 05:58:15 +02:00
|
|
|
path: '{{ output_dir }}/ownca_cert_pw2.pem'
|
2019-03-08 17:21:18 +01:00
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/privatekeypw.pem'
|
|
|
|
ownca_privatekey_passphrase: wrong_password
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2019-03-08 17:21:18 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
register: passphrase_error_2
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Generate ownca certificate (failed passphrase 3)
|
2019-03-08 17:21:18 +01:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_pw3.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/privatekeypw.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
2019-03-08 17:21:18 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
register: passphrase_error_3
|
|
|
|
|
2019-03-30 14:28:10 +01:00
|
|
|
- name: Create broken certificate
|
|
|
|
copy:
|
|
|
|
dest: "{{ output_dir }}/ownca_broken.pem"
|
|
|
|
content: "broken"
|
|
|
|
- name: Regenerate broken cert
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_broken.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey_ecc.pem'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/ca_privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
|
|
|
register: ownca_broken
|
|
|
|
|
2019-03-30 15:38:43 +01:00
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Backup test
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_backup.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: ownca_backup_1
|
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Backup test (idempotent)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_backup.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: ownca_backup_2
|
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Backup test (change)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_backup.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
ownca_path: '{{ output_dir }}/ca_cert.pem'
|
|
|
|
ownca_privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
provider: ownca
|
|
|
|
ownca_digest: sha256
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: ownca_backup_3
|
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Backup test (remove)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_backup.pem'
|
|
|
|
state: absent
|
|
|
|
provider: ownca
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: ownca_backup_4
|
|
|
|
- name: (OwnCA, {{select_crypto_backend}}) Backup test (remove, idempotent)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/ownca_cert_backup.pem'
|
|
|
|
state: absent
|
|
|
|
provider: ownca
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: ownca_backup_5
|
|
|
|
|
2018-06-21 09:11:00 +02:00
|
|
|
- import_tasks: ../tests/validate_ownca.yml
|