OpenVPN Ansible / Ansible Syntax Check (push) Successful in 43s
OpenVPN Ansible / Ansible Lint (push) Successful in 1m8s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 3m32s
OpenVPN Ansible / Generate SBOM (push) Successful in 55s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 18s
- Add a dedicated role and workflow to generate VPN JWT identities and export public keys - Run identity preparation automatically for VPN nodes awaiting OpenBao registration - Gate OpenVPN and PKI setup until each node is registered - Split PKI setup into runtime, configuration, service, and initial certificate tasks - Restore TAP and bridge attachment after OpenVPN restarts - Remove bundled server certificate and private key
30 lines
485 B
Django/Jinja
30 lines
485 B
Django/Jinja
#!/usr/bin/env python3
|
|
|
|
import time
|
|
import uuid
|
|
import jwt
|
|
|
|
PRIVATE_KEY = "{{ openvpn_jwt_private_key_path }}"
|
|
|
|
now = int(time.time())
|
|
|
|
payload = {
|
|
"iss": "helmholz-server-identity",
|
|
"sub": "{{ inventory_hostname }}",
|
|
"aud": "vault-pki",
|
|
"iat": now,
|
|
"nbf": now,
|
|
"exp": now + 600,
|
|
"jti": str(uuid.uuid4())
|
|
}
|
|
|
|
with open(PRIVATE_KEY, "r") as f:
|
|
private_key = f.read()
|
|
|
|
token = jwt.encode(
|
|
payload,
|
|
private_key,
|
|
algorithm="RS256"
|
|
)
|
|
|
|
print(token) |