2018-12-23 10:23:31 +01:00
|
|
|
---
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate privatekey
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_privatekey:
|
|
|
|
path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate privatekey with password
|
2019-03-08 17:21:18 +01:00
|
|
|
openssl_privatekey:
|
|
|
|
path: '{{ output_dir }}/privatekeypw.pem'
|
|
|
|
passphrase: hunter2
|
|
|
|
cipher: auto
|
|
|
|
select_crypto_backend: cryptography
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate CSR
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_csr:
|
|
|
|
path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
subject:
|
|
|
|
commonName: www.example.com
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned certificate
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/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
|
|
|
register: selfsigned_certificate
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned certificate - idempotency
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/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
|
|
|
register: selfsigned_certificate_idempotence
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned certificate (check mode)
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/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
|
|
|
check_mode: yes
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Check selfsigned certificate
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert.pem'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
provider: assertonly
|
|
|
|
has_expired: False
|
|
|
|
version: 3
|
|
|
|
signature_algorithms:
|
|
|
|
- sha256WithRSAEncryption
|
|
|
|
- sha256WithECDSAEncryption
|
|
|
|
subject:
|
|
|
|
commonName: www.example.com
|
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: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned v2 certificate
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert_v2.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_digest: sha256
|
|
|
|
selfsigned_version: 2
|
2019-03-22 14:21:23 +01:00
|
|
|
select_crypto_backend: "{{ select_crypto_backend }}"
|
|
|
|
register: selfsigned_v2_cert
|
|
|
|
ignore_errors: true
|
2018-06-21 09:11:00 +02:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate privatekey2
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_privatekey:
|
|
|
|
path: '{{ output_dir }}/privatekey2.pem'
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate CSR2
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_csr:
|
|
|
|
subject:
|
|
|
|
CN: www.example.com
|
|
|
|
C: US
|
|
|
|
ST: California
|
|
|
|
L: Los Angeles
|
|
|
|
O: ACME Inc.
|
|
|
|
OU:
|
|
|
|
- Roadrunner pest control
|
|
|
|
- Pyrotechnics
|
|
|
|
path: '{{ output_dir }}/csr2.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey2.pem'
|
|
|
|
keyUsage:
|
|
|
|
- digitalSignature
|
|
|
|
extendedKeyUsage:
|
|
|
|
- ipsecUser
|
|
|
|
- biometricInfo
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned certificate2
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert2.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr2.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey2.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-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Check selfsigned certificate2
|
2018-06-21 09:11:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/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
|
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: (Selfsigned, {{select_crypto_backend}}) Create private key 3
|
2018-10-26 05:41:00 +02:00
|
|
|
openssl_privatekey:
|
|
|
|
path: "{{ output_dir }}/privatekey3.pem"
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Create CSR 3
|
2018-10-26 05:41:00 +02:00
|
|
|
openssl_csr:
|
|
|
|
subject:
|
|
|
|
CN: www.example.com
|
|
|
|
privatekey_path: "{{ output_dir }}/privatekey3.pem"
|
|
|
|
path: "{{ output_dir }}/csr3.pem"
|
2019-03-22 14:21:23 +01:00
|
|
|
|
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Create certificate3 with notBefore and notAfter
|
2018-10-26 05:41:00 +02:00
|
|
|
openssl_certificate:
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_not_before: 20181023133742Z
|
|
|
|
selfsigned_not_after: 20191023133742Z
|
|
|
|
path: "{{ output_dir }}/cert3.pem"
|
|
|
|
csr_path: "{{ output_dir }}/csr3.pem"
|
|
|
|
privatekey_path: "{{ output_dir }}/privatekey3.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: (Selfsigned, {{select_crypto_backend}}) Generate privatekey
|
2018-12-23 10:23:31 +01:00
|
|
|
openssl_privatekey:
|
|
|
|
path: '{{ output_dir }}/privatekey_ecc.pem'
|
|
|
|
type: ECC
|
2019-03-22 14:21:23 +01:00
|
|
|
curve: "{{ (ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6') | ternary('secp521r1', 'secp256k1') }}"
|
|
|
|
# ^ cryptography on CentOS6 doesn't support secp256k1, so we use secp521r1 instead
|
2018-12-23 10:23:31 +01:00
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate CSR
|
2018-12-23 10:23:31 +01:00
|
|
|
openssl_csr:
|
|
|
|
path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey_ecc.pem'
|
|
|
|
subject:
|
|
|
|
commonName: www.example.com
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned certificate
|
2018-12-23 10:23:31 +01:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert_ecc.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey_ecc.pem'
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_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: selfsigned_certificate_ecc
|
|
|
|
|
2019-05-08 05:58:15 +02:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate CSR (privatekey passphrase)
|
|
|
|
openssl_csr:
|
|
|
|
path: '{{ output_dir }}/csr_pass.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekeypw.pem'
|
|
|
|
privatekey_passphrase: hunter2
|
|
|
|
subject:
|
|
|
|
commonName: www.example.com
|
|
|
|
|
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned certificate (privatekey passphrase)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert_pass.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_pass.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekeypw.pem'
|
|
|
|
privatekey_passphrase: hunter2
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_digest: sha256
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: selfsigned_certificate_passphrase
|
|
|
|
|
2019-03-22 14:21:23 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned certificate (failed passphrase 1)
|
2019-03-08 17:21:18 +01:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert_pw1.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
privatekey_passphrase: hunter2
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_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: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned certificate (failed passphrase 2)
|
2019-03-08 17:21:18 +01:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert_pw2.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekeypw.pem'
|
|
|
|
privatekey_passphrase: wrong_password
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_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: (Selfsigned, {{select_crypto_backend}}) Generate selfsigned certificate (failed passphrase 3)
|
2019-03-08 17:21:18 +01:00
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert_pw3.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekeypw.pem'
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_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 }}/cert_broken.pem"
|
|
|
|
content: "broken"
|
|
|
|
- name: Regenerate broken cert
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/cert_broken.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey_ecc.pem'
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_digest: sha256
|
|
|
|
register: selfsigned_broken
|
|
|
|
|
2019-03-30 15:38:43 +01:00
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Backup test
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/selfsigned_cert_backup.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey_ecc.pem'
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_digest: sha256
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: selfsigned_backup_1
|
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Backup test (idempotent)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/selfsigned_cert_backup.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr_ecc.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey_ecc.pem'
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_digest: sha256
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: selfsigned_backup_2
|
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Backup test (change)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/selfsigned_cert_backup.pem'
|
|
|
|
csr_path: '{{ output_dir }}/csr.csr'
|
|
|
|
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
|
|
|
provider: selfsigned
|
|
|
|
selfsigned_digest: sha256
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: selfsigned_backup_3
|
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Backup test (remove)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/selfsigned_cert_backup.pem'
|
|
|
|
state: absent
|
|
|
|
provider: selfsigned
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: selfsigned_backup_4
|
|
|
|
- name: (Selfsigned, {{select_crypto_backend}}) Backup test (remove, idempotent)
|
|
|
|
openssl_certificate:
|
|
|
|
path: '{{ output_dir }}/selfsigned_cert_backup.pem'
|
|
|
|
state: absent
|
|
|
|
provider: selfsigned
|
|
|
|
backup: yes
|
|
|
|
select_crypto_backend: '{{ select_crypto_backend }}'
|
|
|
|
register: selfsigned_backup_5
|
|
|
|
|
2018-06-21 09:11:00 +02:00
|
|
|
- import_tasks: ../tests/validate_selfsigned.yml
|