forked from ngine-io/ansible-role-blocky-dns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced blocky__cert_file, blocky__key_file, blocky__min_tls_version, blocky__ports_https and blocky__ports_tls Changed logLevel to log.level to disable deprecation warning Added certificate testing to molecule
- Loading branch information
Showing
8 changed files
with
112 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
- name: "Prepare" | ||
hosts: instance | ||
tasks: | ||
- name: Create certificate directory | ||
ansible.builtin.file: | ||
path: "/etc/cert" | ||
state: directory | ||
# This is for the test only, open permissions are not a problem | ||
group: root | ||
owner: root | ||
mode: "0755" | ||
|
||
- name: Create private key (RSA, 4096 bits) | ||
community.crypto.openssl_privatekey: | ||
path: "/etc/cert/blocky_key.key" | ||
mode: "0755" | ||
|
||
- name: Create certificate signing request (CSR) for self-signed certificate | ||
community.crypto.openssl_csr_pipe: | ||
privatekey_path: "/etc/cert/blocky_key.key" | ||
common_name: "blocky.example.com" | ||
register: csr | ||
|
||
- name: Create self-signed certificate from CSR | ||
community.crypto.x509_certificate: | ||
path: "/etc/cert/blocky_cert.pem" | ||
csr_content: "{{ csr.csr }}" | ||
privatekey_path: "/etc/cert/blocky_key.key" | ||
provider: selfsigned | ||
mode: "0755" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
- name: "Verify" | ||
hosts: instance | ||
tasks: | ||
- name: Get cert from https port | ||
community.crypto.get_certificate: | ||
host: localhost | ||
port: 443 | ||
asn1_base64: true | ||
register: cert | ||
|
||
- name: Assert the correct certificate is served | ||
ansible.builtin.assert: | ||
that: | ||
- cert.subject.CN is defined | ||
- cert.subject.CN == 'blocky.example.com' | ||
|
||
- name: Get cert from tls port | ||
community.crypto.get_certificate: | ||
host: localhost | ||
port: 853 | ||
asn1_base64: true | ||
register: cert | ||
|
||
- name: Assert the correct certificate is served | ||
ansible.builtin.assert: | ||
that: | ||
- cert.subject.CN is defined | ||
- cert.subject.CN == 'blocky.example.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
collections: | ||
- name: community.crypto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters