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
64 lines
2.6 KiB
Markdown
64 lines
2.6 KiB
Markdown
# OpenVPN PKI JWT identity preparation
|
|
|
|
This role prepares one local JWT RSA identity per VPN server so an administrator
|
|
can register each public key with the existing OpenBao JWT configuration. It
|
|
does not configure OpenBao or request certificates.
|
|
|
|
## Prepare an identity
|
|
|
|
Run the dedicated playbook, limiting it to the new VPN server when appropriate:
|
|
|
|
```bash
|
|
ansible-playbook \
|
|
-i inventories/prod/hosts.ini \
|
|
playbooks/openvpn-pki-identity.yml \
|
|
--limit vpn01-test
|
|
```
|
|
|
|
The playbook targets `vpn_nodes` and uses privilege escalation. It creates the
|
|
identity on the selected server; it does not deploy certificates or alter the
|
|
OpenVPN service.
|
|
|
|
## Key locations and retrieval
|
|
|
|
The server stores its root-owned identity in `/etc/vault-jwt/` by default:
|
|
|
|
- `private.pem`: RSA 3072-bit private key, mode `0600`.
|
|
- `public.pem`: corresponding PEM public key, mode `0644`.
|
|
|
|
Only `public.pem` is fetched to the controller, as
|
|
`artifacts/openvpn-pki-public-keys/<inventory_hostname>.pem`. The artifacts
|
|
directory is ignored by Git. The private key is generated on the VPN server
|
|
with `community.crypto.openssl_privatekey`; it is never fetched.
|
|
|
|
## Register the public key in OpenBao
|
|
|
|
Provide the fetched PEM public key to the OpenBao administrator using the
|
|
approved secure process. The administrator should combine the new PEM public
|
|
key with all currently registered PEM public keys into a bundle, then update
|
|
the existing JWT authentication configuration with that complete bundle. The
|
|
update must preserve every previously registered key; replacing the configured
|
|
key set with only the new key would invalidate identities already in use.
|
|
Public-key registration is a manual administrator operation and is not
|
|
performed by this role.
|
|
|
|
## Existing identity behavior
|
|
|
|
The role creates a missing identity only when both key files are absent. If
|
|
both already exist, it leaves them unchanged and fetches the existing public
|
|
key again. If exactly one key file exists, the role fails rather than
|
|
replacing or silently repairing the identity. Investigate and recover the
|
|
matching pair deliberately before rerunning. Do not delete or replace the
|
|
private key as a routine way to resolve errors: OpenBao registrations depend
|
|
on the corresponding public key.
|
|
|
|
The private key must remain on its VPN server because it is the credential
|
|
used to prove that server's identity. Copying it to the controller or
|
|
registering it with OpenBao would defeat the separation between private key
|
|
custody and public-key registration.
|
|
|
|
## Requirements
|
|
|
|
Install the `community.crypto` collection on the Ansible controller. It is not
|
|
currently listed in the repository's `requirements.yml`.
|