feat(openvpn-pki): add JWT identity preparation workflow
OpenVPN Ansible / Ansible Lint (push) Successful in 1m7s
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 48s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 1m50s
OpenVPN Ansible / Generate SBOM (push) Successful in 55s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 21s
OpenVPN Ansible / Ansible Lint (push) Successful in 1m7s
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 48s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 1m50s
OpenVPN Ansible / Generate SBOM (push) Successful in 55s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 21s
- Add dedicated Ansible playbook and role for VPN server JWT identities - Generate and securely store per-server RSA key pairs - Export public keys as workflow artifacts for manual OpenBao registration - Add community.crypto collection dependency
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
---
|
||||
- name: Create JWT identity directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ openvpn_pki_jwt_directory }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
|
||||
- name: Check for existing JWT private key
|
||||
ansible.builtin.stat:
|
||||
path: "{{ openvpn_pki_jwt_private_key_path }}"
|
||||
register: openvpn_pki_jwt_private_key_stat
|
||||
|
||||
- name: Check for existing JWT public key
|
||||
ansible.builtin.stat:
|
||||
path: "{{ openvpn_pki_jwt_public_key_path }}"
|
||||
register: openvpn_pki_jwt_public_key_stat
|
||||
|
||||
- name: Refuse incomplete JWT identity
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- openvpn_pki_jwt_private_key_stat.stat.exists == openvpn_pki_jwt_public_key_stat.stat.exists
|
||||
fail_msg: >-
|
||||
Only one JWT key file exists. Refusing to replace or repair an existing
|
||||
identity automatically. Inspect the files and recover the matching key
|
||||
pair deliberately before rerunning this playbook.
|
||||
|
||||
- name: Generate JWT RSA private key
|
||||
community.crypto.openssl_privatekey:
|
||||
path: "{{ openvpn_pki_jwt_private_key_path }}"
|
||||
type: RSA
|
||||
size: "{{ openvpn_pki_jwt_rsa_bits }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
when: not openvpn_pki_jwt_private_key_stat.stat.exists
|
||||
|
||||
- name: Generate JWT public key from existing private key
|
||||
community.crypto.openssl_publickey:
|
||||
path: "{{ openvpn_pki_jwt_public_key_path }}"
|
||||
privatekey_path: "{{ openvpn_pki_jwt_private_key_path }}"
|
||||
format: PEM
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
when: not openvpn_pki_jwt_public_key_stat.stat.exists
|
||||
|
||||
- name: Create public key artifact directory on controller
|
||||
ansible.builtin.file:
|
||||
path: "{{ openvpn_pki_public_key_artifact_directory }}"
|
||||
state: directory
|
||||
mode: "0700"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
|
||||
- name: Fetch JWT public key to controller
|
||||
ansible.builtin.fetch:
|
||||
src: "{{ openvpn_pki_jwt_public_key_path }}"
|
||||
dest: "{{ openvpn_pki_public_key_artifact_directory }}/{{ inventory_hostname }}.pem"
|
||||
flat: true
|
||||
validate_checksum: true
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: Import JWT identity preparation tasks
|
||||
ansible.builtin.import_tasks: identity.yml
|
||||
Reference in New Issue
Block a user