Compare commits

..
22 Commits
Author SHA1 Message Date
gitea_admin 36d2845a3a 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
- 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
2026-11-26 11:01:09 +01:00
gitea_admin 0edc2c531f Update OpenVPN cert tasks and server.conf template
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 58s
OpenVPN Ansible / Ansible Lint (push) Successful in 1m14s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 1m46s
OpenVPN Ansible / Generate SBOM (push) Successful in 52s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 20s
2026-11-16 12:23:42 +01:00
gitea_admin 99ada6fab7 fix(openvpn): renew server.crt and server.key
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 1m0s
OpenVPN Ansible / Ansible Lint (push) Successful in 1m23s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 1m52s
OpenVPN Ansible / Generate SBOM (push) Successful in 57s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 21s
2026-11-12 10:49:44 +01:00
gitea_admin 299397f4f9 fix(vpn-node-config): resolve ansible-lint violations
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 46s
OpenVPN Ansible / Ansible Lint (push) Successful in 1m5s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 1m55s
OpenVPN Ansible / Generate SBOM (push) Successful in 1m4s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 22s
2026-11-11 12:41:28 +01:00
gitea_admin acb5c4ba82 feat: add node_exporter role and integrate into site playbook
OpenVPN Ansible / Ansible Lint (push) Failing after 14s
OpenVPN Ansible / Ansible Syntax Check (push) Failing after 14s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Skipped
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-11-11 11:18:41 +01:00
gitea_admin 746e37f077 chore(ansible): add vpn01-test in production inventory
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 10s
OpenVPN Ansible / Ansible Lint (push) Successful in 17s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 2m53s
OpenVPN Ansible / Generate SBOM (push) Successful in 55s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 20s
2026-10-29 12:32:42 +01:00
gitea_admin 6c86e1bf08 fix(private_routing): add DNS nameservers to Netplan/networkd route config
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 9s
OpenVPN Ansible / Ansible Lint (push) Successful in 18s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 1m54s
OpenVPN Ansible / Generate SBOM (push) Successful in 54s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 18s
2026-10-29 11:50:33 +01:00
gitea_admin 86c47eec4f fix(ansible): apply private VPN routes before verification
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 11s
OpenVPN Ansible / Ansible Lint (push) Successful in 17s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Failing after 1m25s
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-29 10:05:38 +01:00
gitea_admin 853e852753 chore(ansible): add vpn02-test in production inventory
OpenVPN Ansible / Ansible Lint (push) Successful in 16s
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 10s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Failing after 18s
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-29 09:43:16 +01:00
gitea_admin 76c82f83c1 feat(ansible): automate NAT gateway and VPN routing
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 11s
OpenVPN Ansible / Ansible Lint (push) Successful in 18s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Failing after 1m25s
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
- Add NAT gateway inventory and routing playbooks.
- Update Gitea Actions and GitLab CI to validate all playbooks.
- Deploy gateway and routing configurations before OpenVPN.
- Document setup and verification steps.
2026-10-28 18:36:18 +01:00
gitea_admin c23ff11194 chore(ansible): disable vpn01-test in production inventory
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 5s
OpenVPN Ansible / Ansible Lint (push) Successful in 13s
OpenVPN Ansible / Deploy OpenVPN (push) Successful in 23s
OpenVPN Ansible / Generate SBOM (push) Successful in 25s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 17s
2026-10-27 21:41:02 +01:00
gitea_admin 82d44662b4 ci(ansible): install required collections before syntax check and deployment
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 5s
OpenVPN Ansible / Ansible Lint (push) Successful in 13s
OpenVPN Ansible / Deploy OpenVPN (push) Failing after 1m28s
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-27 21:30:18 +01:00
gitea_admin 22394db088 chore(ansible-lint): skip partial-become rule
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 42s
OpenVPN Ansible / Ansible Lint (push) Successful in 53s
OpenVPN Ansible / Deploy OpenVPN (push) Failing after 1m34s
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-27 21:20:48 +01:00
gitea_admin 3f4899c73a fix(ansible): prefix Syft check variable with sbom_ 2026-10-27 21:19:36 +01:00
gitea_admin 4403bc0f4e chore(ansible): add community.general collection to requirements.yml 2026-10-27 21:17:54 +01:00
gitea_admin cd65d6aea1 ci: integrate OpenBao secret retrieval
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 4s
OpenVPN Ansible / Ansible Lint (push) Successful in 15s
OpenVPN Ansible / Deploy OpenVPN (push) Failing after 1m26s
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-20 11:56:36 +02:00
gitea_admin 31f785b2b8 feat: add AMD64 and ARM64 compatibility to VPN node configuration
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 5s
OpenVPN Ansible / Ansible Lint (push) Successful in 15s
OpenVPN Ansible / Deploy OpenVPN (push) Failing after 1m27s
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-16 16:28:25 +02:00
gitea_admin d0b149fbe0 update runner to hetzner-ubuntu-latest and add vpn01-test host to configure
OpenVPN Ansible / Ansible Syntax Check (push) Failing after 49s
OpenVPN Ansible / Ansible Lint (push) Failing after 49s
OpenVPN Ansible / Deploy OpenVPN (push) Skipped
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-05 14:56:36 +02:00
gitea_admin ec57d3575b update ssh setup job
OpenVPN Ansible / Ansible Lint (push) Successful in 12s
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 5s
OpenVPN Ansible / Deploy OpenVPN (push) Successful in 32s
OpenVPN Ansible / Generate SBOM (push) Successful in 39s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 20s
2026-10-01 16:01:12 +02:00
gitea_admin b5d5a460b8 update secret name
OpenVPN Ansible / Ansible Lint (push) Successful in 11s
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 5s
OpenVPN Ansible / Deploy OpenVPN (push) Failing after 6s
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-01 15:30:21 +02:00
gitea_admin 132c29e3ef chore(lint): add ansible-lint exclusions
OpenVPN Ansible / Ansible Lint (push) Failing after 4s
OpenVPN Ansible / Ansible Syntax Check (push) Failing after 4s
OpenVPN Ansible / Deploy OpenVPN (push) Skipped
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-01 14:45:56 +02:00
gitea_admin 138acbe08e Temporarily disable GitLab CI and add Gitea Actions.
OpenVPN Ansible / Ansible Lint (push) Failing after 58s
OpenVPN Ansible / Ansible Syntax Check (push) Failing after 4s
OpenVPN Ansible / Deploy OpenVPN (push) Skipped
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
2026-10-01 13:39:09 +02:00
38 changed files with 1146 additions and 181 deletions
+4
View File
@@ -0,0 +1,4 @@
exclude_paths:
- .gitea/
skip_list:
- partial-become
+181
View File
@@ -0,0 +1,181 @@
name: OpenVPN Ansible
on:
push:
branches:
- main
workflow_dispatch:
jobs:
ansible-lint:
name: Ansible Lint
runs-on: hetzner-ubuntu-latest
container:
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run ansible-lint
env:
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible.cfg
run: |
ansible-galaxy collection install -r requirements.yml
ansible-lint
syntax-check:
name: Ansible Syntax Check
runs-on: hetzner-ubuntu-latest
container:
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Syntax check
env:
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible.cfg
run: |
ansible-galaxy collection install -r requirements.yml
ansible-inventory --list > /dev/null
for playbook in playbooks/*.yml; do
echo "Syntax checking ${playbook}"
ansible-playbook --syntax-check "$playbook"
done
deploy-prod:
name: Deploy VPN Networking and OpenVPN
runs-on: hetzner-ubuntu-latest
needs:
- ansible-lint
- syntax-check
container:
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup SSH
run: |
echo "Setting up SSH ..."
mkdir -p ~/.ssh
printf '%s\n' '${{ secrets.SSH_PRIVATE_KEY }}' > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keygen -y -f ~/.ssh/id_ed25519 > /dev/null
echo "SSH key configured successfully"
- name: Deploy
env:
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible.cfg
run: |
ansible-galaxy collection install -r requirements.yml
ansible-playbook playbooks/nat-gateway.yml --limit nat_gateways
ansible-playbook playbooks/private-vpn-routing.yml --limit vpn_nodes
ansible-playbook playbooks/openvpn.yml
ansible-playbook playbooks/monitoring-exporter.yml
sbom:
name: Generate SBOM
runs-on: hetzner-ubuntu-latest
needs:
- deploy-prod
container:
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup SSH
run: |
echo "Setting up SSH ..."
mkdir -p ~/.ssh
printf '%s\n' '${{ secrets.SSH_PRIVATE_KEY }}' > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keygen -y -f ~/.ssh/id_ed25519 > /dev/null
echo "SSH key configured successfully"
- name: Generate SBOM
env:
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible.cfg
run: |
ansible-playbook playbooks/sbom.yml
- name: Upload SBOM
uses: actions/upload-artifact@v4
with:
name: sbom
path: reports/sbom/
retention-days: 365
trivy-sbom:
name: Scan SBOM with Trivy
runs-on: hetzner-ubuntu-latest
needs:
- sbom
container:
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download SBOM
uses: actions/download-artifact@v4
with:
name: sbom
path: reports/sbom/
- name: Scan SBOMs
run: |
ls -R reports || true
mkdir -p reports/trivy
if compgen -G "reports/sbom/*.json" > /dev/null; then
for sbom in reports/sbom/*.json; do
filename=$(basename "$sbom" .json)
echo "Scanning $sbom"
trivy sbom \
--format json \
--output "reports/trivy/${filename}-trivy.json" \
--exit-code 0 \
"$sbom"
trivy sbom \
--format table \
--output "reports/trivy/${filename}-trivy.txt" \
--exit-code 0 \
"$sbom"
done
else
echo "No SBOM files found."
exit 1
fi
- name: Upload Trivy reports
uses: actions/upload-artifact@v4
with:
name: trivy-reports
path: reports/trivy/
retention-days: 365
+71
View File
@@ -0,0 +1,71 @@
name: OpenVPN JWT Identity Preparation
on:
workflow_dispatch:
inputs:
vpn_host:
description: Inventory hostname of the VPN server to prepare
required: true
type: string
jobs:
prepare-identity:
name: Prepare VPN JWT identity
runs-on: hetzner-ubuntu-latest
container:
image: gitea.infrastructure.helmholz.cloud/gitea_admin/ansible-utilities:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup SSH
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
set -eu
mkdir -p ~/.ssh
printf '%s\n' "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keygen -y -f ~/.ssh/id_ed25519 > /dev/null
- name: Install Ansible collections
run: ansible-galaxy collection install -r requirements.yml
- name: Validate selected VPN host
env:
VPN_HOST: ${{ github.event.inputs.vpn_host }}
run: |
set -eu
ansible-inventory -i inventories/prod/hosts.ini --list | python3 -c '
import json
import os
import sys
inventory = json.load(sys.stdin)
selected_host = os.environ["VPN_HOST"]
vpn_hosts = inventory.get("vpn_nodes", {}).get("hosts", [])
if selected_host not in vpn_hosts:
print("vpn_host must exactly match a host in the vpn_nodes inventory group", file=sys.stderr)
sys.exit(1)
'
- name: Prepare JWT identity
env:
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible.cfg
VPN_HOST: ${{ github.event.inputs.vpn_host }}
run: |
set -eu
ansible-playbook \
-i inventories/prod/hosts.ini \
playbooks/openvpn-pki-identity.yml \
--limit "$VPN_HOST"
- name: Upload public JWT key
uses: actions/upload-artifact@v4
with:
name: openvpn-pki-public-keys
path: artifacts/openvpn-pki-public-keys/*.pem
if-no-files-found: error
retention-days: 7
+1
View File
@@ -0,0 +1 @@
/artifacts/openvpn-pki-public-keys/
+104 -60
View File
@@ -7,74 +7,118 @@ stages:
- deploy
- security
before_script:
- echo "Setting up ssh ..."
- mkdir -p ~/.ssh
- cat "$SSH_PRIVATE_KEY_FILE" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- cat "$SSH_PUBLIC_KEY_FILE" > ~/.ssh/id_ed25519.pub
- chmod 600 ~/.ssh/id_ed25519.pub
- export ANSIBLE_CONFIG=$CI_PROJECT_DIR/ansible.cfg
include:
- project: 'next-gen-portal/ci-templates'
ref: 'main'
file: '/templates/openbao/with-secret.yml'
ansible-lint:
stage: validate
script:
- export ANSIBLE_CONFIG=$CI_PROJECT_DIR/ansible.cfg
- ansible-galaxy collection install -r requirements.yml
- ansible-lint
syntax-check:
stage: validate
script:
- ansible-playbook --syntax-check playbooks/openvpn.yml
deploy-prod:
stage: deploy
script:
- ansible-playbook playbooks/openvpn.yml
sbom:
stage: security
needs:
- deploy-prod
script:
- ansible-playbook playbooks/sbom.yml
artifacts:
when: always
paths:
- reports/sbom/
expire_in: 365 days
trivy:sbom:
stage: security
needs:
- job: sbom
artifacts: true
script:
- ls -R reports || true
- mkdir -p reports/trivy
- export ANSIBLE_CONFIG=$CI_PROJECT_DIR/ansible.cfg
- ansible-galaxy collection install -r requirements.yml
- ansible-inventory --list > /dev/null
- |
if compgen -G "reports/sbom/*.json" > /dev/null; then
for sbom in reports/sbom/*.json; do
filename=$(basename "$sbom" .json)
echo "Scanning $sbom"
trivy sbom \
--format json \
--output "reports/trivy/${filename}-trivy.json" \
--exit-code 0 \
"$sbom"
trivy sbom \
--format table \
--output "reports/trivy/${filename}-trivy.txt" \
--exit-code 0 \
"$sbom"
set -eu
for playbook in playbooks/*.yml; do
echo "Syntax checking ${playbook}"
ansible-playbook --syntax-check "$playbook"
done
else
echo "No SBOM files found."
exit 1
fi
artifacts:
when: always
expire_in: 365 days
paths:
- reports/trivy/
# deploy-prod:
# extends: .openbao-with-secrets
# stage: deploy
# id_tokens:
# OPENBAO_ID_TOKEN:
# aud: "https://openbao.helmholz.local:8200"
# variables:
# OPENBAO_SECRET_REQUESTS_FILE: "secrets.json"
# script:
# - |
# set -eu
# echo "Setting up SSH..."
# mkdir -p ~/.ssh
# printf '%s\n' "$VPN_ADMIN_PRIVATE_KEY" > ~/.ssh/id_ed25519
# chmod 600 ~/.ssh/id_ed25519
# export ANSIBLE_CONFIG="$CI_PROJECT_DIR/ansible.cfg"
# ansible-galaxy collection install -r requirements.yml
# ansible-playbook playbooks/nat-gateway.yml --limit nat_gateways
# ansible-playbook playbooks/private-vpn-routing.yml --limit vpn_nodes
# ansible-playbook playbooks/openvpn.yml
# when: manual
# sbom:
# extends: .openbao-with-secrets
# stage: security
# id_tokens:
# OPENBAO_ID_TOKEN:
# aud: "https://openbao.helmholz.local:8200"
# variables:
# OPENBAO_SECRET_REQUESTS_FILE: "secrets.json"
# needs:
# - deploy-prod
# script:
# - |
# set -eu
# echo "Setting up SSH..."
# mkdir -p ~/.ssh
# printf '%s\n' "$VPN_ADMIN_PRIVATE_KEY" > ~/.ssh/id_ed25519
# chmod 600 ~/.ssh/id_ed25519
# export ANSIBLE_CONFIG="$CI_PROJECT_DIR/ansible.cfg"
# ansible-playbook playbooks/sbom.yml
# artifacts:
# when: always
# paths:
# - reports/sbom/
# expire_in: 365 days
# trivy:sbom:
# stage: security
# needs:
# - job: sbom
# artifacts: true
# script:
# - ls -R reports || true
# - mkdir -p reports/trivy
# - |
# if compgen -G "reports/sbom/*.json" > /dev/null; then
# for sbom in reports/sbom/*.json; do
# filename=$(basename "$sbom" .json)
# echo "Scanning $sbom"
# trivy sbom \
# --format json \
# --output "reports/trivy/${filename}-trivy.json" \
# --exit-code 0 \
# "$sbom"
# trivy sbom \
# --format table \
# --output "reports/trivy/${filename}-trivy.txt" \
# --exit-code 0 \
# "$sbom"
# done
# else
# echo "No SBOM files found."
# exit 1
# fi
# artifacts:
# when: always
# expire_in: 365 days
# paths:
# - reports/trivy/
+86 -70
View File
@@ -1,93 +1,109 @@
# vpn-node-config
# VPN node configuration
Ansible configuration for Ubuntu 24.04 VPN nodes. Host packages are installed
through Ubuntu's package manager, so package architecture selection is
automatic.
## Supported platforms
## Getting started
- `linux/amd64` (`x86_64`)
- `linux/arm64` (`aarch64`)
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
The common role checks the Ubuntu release and architecture before
making changes. Networking sysctl configuration uses the interfaces reported
by Ansible rather than assuming a particular NIC name. The OpenVPN RADIUS
plugin path is discovered after package installation, including Debian's
architecture-specific library directories.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Run
## Add your files
Configure inventory in `inventories/prod/hosts.ini`, then run:
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab/next-gen-portal/ansible/vpn-node-config.git
git branch -M main
git push -uf origin main
```sh
ansible-playbook playbooks/openvpn.yml
```
## Integrate with your tools
The target hosts must run Ubuntu 24.04 and Ansible must gather facts.
- [ ] [Set up project integrations](https://gitlab/next-gen-portal/ansible/vpn-node-config/-/settings/integrations)
## Private VM internet access
## Collaborate with your team
The `vpn-gateway` VM provides NAT for private VPN nodes. A private VM sends
internet-bound traffic to the Hetzner private-network router (`10.0.0.1`). The
Hetzner network route for `0.0.0.0/0` then delivers it to the gateway's private
address (`10.100.0.4`), where iptables masquerades it out `eth0`. The route in
Hetzner's network and the operating-system default route on each private VM are
separate settings: both must exist. The gateway itself keeps its public default
route through `eth0`.
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
`vpn_nodes` contains private VPN nodes and `nat_gateways` contains only the
gateway. Add new private VMs to `vpn_nodes` with their management address and
private address, and set the private routing role variables in host/group vars
if their interface or gateway differs. Do not add a gateway to `vpn_nodes`.
The routing role detects Netplan or systemd-networkd and adds only a route
fragment; review the host's existing route metrics and manager before rollout.
The Netplan fragment adds a metric 100 default route. Internal destinations
continue to use more-specific routes; validate the FreeRADIUS NodePort path on
each host.
## Test and Deploy
Install required collections with `ansible-galaxy collection install -r
requirements.yml`, then check syntax and deploy independently:
Use the built-in continuous integration in GitLab.
```sh
ansible-playbook --syntax-check playbooks/nat-gateway.yml
ansible-playbook --syntax-check playbooks/private-vpn-routing.yml
ansible-playbook --check playbooks/nat-gateway.yml --limit nat_gateways
ansible-playbook playbooks/nat-gateway.yml --limit nat_gateways
ansible-playbook --check playbooks/private-vpn-routing.yml --limit vpn_nodes
ansible-playbook playbooks/private-vpn-routing.yml --limit vpn_nodes
```
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
Check mode cannot validate actual kernel routes or persistence and may report
handlers without applying them. `netplan apply` and restarting
systemd-networkd can briefly interrupt remote connectivity; schedule route
rollout with console access or a maintenance window. Do not reboot automatically.
***
Verify the gateway after deployment (and separately after a planned reboot):
# Editing this README
```sh
sysctl net.ipv4.ip_forward
iptables -t nat -S POSTROUTING
iptables -S FORWARD
systemctl is-enabled nat-gateway-firewall.service
systemctl status nat-gateway-firewall.service --no-pager
ip -4 route show default
```
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
Expect forwarding value `1`, the subnet-specific MASQUERADE and two narrow
FORWARD rules, an enabled firewall persistence service, and the gateway public
default via `eth0`. The service re-adds only these scoped rules at boot and
does not save or flush the full firewall ruleset. On each private VM:
## Suggestions for a good README
```sh
ip -4 route show default
ip -4 route get 8.8.8.8
getent hosts google.com
curl -I --max-time 10 https://google.com
```
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
Also connect to the existing FreeRADIUS NodePort endpoint using its configured
address and port. DNS and NodePort checks require live network access. The
inventory gateway IP/interface values are taken from the supplied task; verify
them against the live Hetzner VM before applying.
## Name
Choose a self-explaining name for your project.
## Monitoring exporter
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
Run `playbooks/monitoring-exporter.yml` for the VPN nodes and NAT gateway.
Set `monitoring_vm_ip` in `inventories/prod/group_vars/all.yml` to the monitoring
VM's address on the `10.100.0.x` private network. It is the only allowed source
to TCP port 9100. The identical `node_exporter` role defaults to port 9100,
binds to `private_ip` then `keepalived_src_ip` then `ansible_host`, and uses
`monitoring_vm_ip` as its firewall source. It creates the root-owned,
world-readable `/var/lib/node_exporter/textfile` directory and enables
systemd, conntrack, filesystem, netdev, textfile, time, and timex collectors;
`node_exporter_systemd_unit_filter` restricts unit metrics.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
On the NAT gateway, `nat_gateway_node_exporter_port` defaults to 9100 and
`nat_gateway_node_exporter_allowed_source` uses `monitoring_vm_ip`. Both the
ACCEPT for that source and DROP for all other sources on the port are written
into `ensure-nat-gateway-firewall.j2`, so the gateway firewall persistence
service owns them.
+2
View File
@@ -1,4 +1,6 @@
timezone: Europe/Berlin
# Required: monitoring VM private address on the 10.100.0.x private network.
monitoring_vm_ip: "10.100.0.30"
common_packages:
- vim
- curl
+6 -2
View File
@@ -1,4 +1,8 @@
[vpn_nodes]
vpn01 ansible_host=65.108.95.144 private_ip=10.100.0.1
# vpn01-test ansible_host=65.108.95.144 private_ip=10.100.0.2
# vpn01 ansible_host=65.108.95.144 private_ip=10.100.0.1
vpn01-test ansible_host=10.100.0.2 private_ip=10.100.0.2
vpn02-test ansible_host=10.100.0.5 private_ip=10.100.0.5
# vpn01-bmw ansible_host=65.108.93.171 private_ip=10.100.0.3
[nat_gateways]
vpn-gateway ansible_host=178.104.249.28 private_ip=10.100.0.4
+17
View File
@@ -0,0 +1,17 @@
---
- name: Configure node exporter on VPN nodes
hosts: vpn_nodes
become: true
roles:
- role: node_exporter
tags: [monitoring]
- name: Configure node exporter and firewall on NAT gateway
hosts: nat_gateways
become: true
roles:
- role: nat_gateway
- role: node_exporter
vars:
node_exporter_manage_firewall: false
tags: [monitoring]
+5
View File
@@ -0,0 +1,5 @@
---
- name: Configure NAT gateway
hosts: nat_gateways
become: true
roles: [nat_gateway]
+7
View File
@@ -0,0 +1,7 @@
---
- name: Prepare OpenVPN JWT identities
hosts: vpn_nodes
become: true
roles:
- role: openvpn_pki
+5
View File
@@ -0,0 +1,5 @@
---
- name: Configure private VPN node default routes
hosts: vpn_nodes
become: true
roles: [private_routing]
+5
View File
@@ -0,0 +1,5 @@
---
collections:
- name: ansible.posix
- name: community.general
- name: community.crypto
+13
View File
@@ -1,8 +1,21 @@
---
- name: Validate supported operating system and CPU architecture
ansible.builtin.assert:
that:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_version == '24.04'
- ansible_architecture in ['x86_64', 'aarch64']
fail_msg: >-
vpn-node-config supports Debian-family hosts on linux/amd64 (x86_64) and
linux/arm64 (aarch64); detected {{ ansible_os_family }} /
{{ ansible_architecture }}.
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
update_cache_retries: 5
update_cache_retry_max_delay: 12
- name: Upgrade packages
ansible.builtin.apt:
+8
View File
@@ -0,0 +1,8 @@
---
nat_gateway_private_cidr: 10.100.0.0/16
nat_gateway_private_interface: enp7s0
nat_gateway_public_interface: eth0
nat_gateway_firewall_script: /usr/local/sbin/ensure-nat-gateway-firewall
# Exporter firewall accepts this private source and drops all others on its port.
nat_gateway_node_exporter_port: 9100
nat_gateway_node_exporter_allowed_source: "{{ monitoring_vm_ip }}"
+10
View File
@@ -0,0 +1,10 @@
---
- name: Apply NAT gateway sysctl
ansible.builtin.command: sysctl --system
changed_when: false
- name: Restart NAT gateway firewall persistence
ansible.builtin.systemd:
name: nat-gateway-firewall.service
enabled: true
daemon_reload: true
state: restarted
+91
View File
@@ -0,0 +1,91 @@
---
- name: Install iptables tools
ansible.builtin.apt:
name: [iptables, prometheus-node-exporter]
state: present
- name: Install idempotent NAT firewall restore script
ansible.builtin.template:
src: ensure-nat-gateway-firewall.j2
dest: "{{ nat_gateway_firewall_script }}"
owner: root
group: root
mode: "0750"
notify: Restart NAT gateway firewall persistence
- name: Install NAT firewall persistence unit
ansible.builtin.template:
src: nat-gateway-firewall.service.j2
dest: /etc/systemd/system/nat-gateway-firewall.service
owner: root
group: root
mode: "0644"
notify: Restart NAT gateway firewall persistence
- name: Enable NAT firewall persistence at boot
ansible.builtin.systemd:
name: nat-gateway-firewall.service
enabled: true
daemon_reload: true
state: started
- name: Configure persistent IPv4 forwarding
ansible.builtin.copy:
dest: /etc/sysctl.d/99-nat-gateway.conf
content: "net.ipv4.ip_forward=1\n"
owner: root
group: root
mode: "0644"
notify: Apply NAT gateway sysctl
- name: Enable IPv4 forwarding immediately
ansible.posix.sysctl:
name: net.ipv4.ip_forward
value: "1"
sysctl_file: /etc/sysctl.d/99-nat-gateway.conf
reload: true
- name: Create node exporter textfile directory
ansible.builtin.file:
path: /var/lib/node_exporter/textfile
state: directory
owner: root
group: root
mode: "0755"
- name: Allow private subnet outbound through public interface
ansible.builtin.iptables:
table: nat
chain: POSTROUTING
source: "{{ nat_gateway_private_cidr }}"
out_interface: "{{ nat_gateway_public_interface }}"
jump: MASQUERADE
state: present
notify: Restart NAT gateway firewall persistence
- name: Allow private subnet forwarding to public interface
ansible.builtin.iptables:
chain: FORWARD
in_interface: "{{ nat_gateway_private_interface }}"
out_interface: "{{ nat_gateway_public_interface }}"
source: "{{ nat_gateway_private_cidr }}"
jump: ACCEPT
state: present
notify: Restart NAT gateway firewall persistence
- name: Allow established return traffic to private subnet
ansible.builtin.iptables:
chain: FORWARD
in_interface: "{{ nat_gateway_public_interface }}"
out_interface: "{{ nat_gateway_private_interface }}"
destination: "{{ nat_gateway_private_cidr }}"
ctstate: [ESTABLISHED, RELATED]
jump: ACCEPT
state: present
notify: Restart NAT gateway firewall persistence
- name: Assert gateway retains public default route
ansible.builtin.command: ip -4 route show default
register: nat_gateway_default_route
changed_when: false
failed_when: nat_gateway_public_interface not in nat_gateway_default_route.stdout
@@ -0,0 +1,17 @@
#!/bin/sh
set -eu
iptables -t nat -C POSTROUTING -s {{ nat_gateway_private_cidr }} -o {{ nat_gateway_public_interface }} -j MASQUERADE 2>/dev/null || \
iptables -t nat -A POSTROUTING -s {{ nat_gateway_private_cidr }} -o {{ nat_gateway_public_interface }} -j MASQUERADE
iptables -C FORWARD -i {{ nat_gateway_private_interface }} -o {{ nat_gateway_public_interface }} -s {{ nat_gateway_private_cidr }} -j ACCEPT 2>/dev/null || \
iptables -A FORWARD -i {{ nat_gateway_private_interface }} -o {{ nat_gateway_public_interface }} -s {{ nat_gateway_private_cidr }} -j ACCEPT
iptables -C FORWARD -i {{ nat_gateway_public_interface }} -o {{ nat_gateway_private_interface }} -d {{ nat_gateway_private_cidr }} -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT 2>/dev/null || \
iptables -A FORWARD -i {{ nat_gateway_public_interface }} -o {{ nat_gateway_private_interface }} -d {{ nat_gateway_private_cidr }} -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -C INPUT -p tcp -s {{ nat_gateway_node_exporter_allowed_source }} --dport {{ nat_gateway_node_exporter_port }} -j ACCEPT 2>/dev/null || \
iptables -I INPUT 1 -p tcp -s {{ nat_gateway_node_exporter_allowed_source }} --dport {{ nat_gateway_node_exporter_port }} -j ACCEPT
iptables -C INPUT -p tcp --dport {{ nat_gateway_node_exporter_port }} -j DROP 2>/dev/null || \
iptables -I INPUT 2 -p tcp --dport {{ nat_gateway_node_exporter_port }} -j DROP
@@ -0,0 +1,12 @@
[Unit]
Description=Ensure scoped NAT gateway firewall rules are present
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart={{ nat_gateway_firewall_script }}
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
@@ -3,4 +3,6 @@ net.ipv4.ip_forward=1
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.enp7s0.rp_filter=0
{% for interface in ansible_interfaces | default([]) if interface not in ['lo', 'br-main-vpn', 'tap0'] %}
net.ipv4.conf.{{ interface }}.rp_filter=0
{% endfor %}
+24
View File
@@ -0,0 +1,24 @@
---
# Bind to private_ip, then the LB keepalived source IP, and use public ansible_host
# only if neither private address is configured.
node_exporter_listen_address: "{{ private_ip | default(keepalived_src_ip | default(ansible_host)) }}"
# TCP listener port for node_exporter.
node_exporter_port: 9100
# Required: set to monitoring_vm_ip in inventory/group_vars.
node_exporter_allowed_source: "{{ monitoring_vm_ip }}"
# Root-owned, world-readable textfile collector directory.
node_exporter_textfile_dir: /var/lib/node_exporter/textfile
# Restrict systemd collector output to relevant service units.
node_exporter_systemd_unit_filter: "^(openvpn.*|squid@.*|keepalived.service|nat-gateway-firewall.service)$"
# Collect systemd, connection tracking, filesystem, network, textfile, time, and timex metrics.
node_exporter_collectors:
- systemd
- conntrack
- filesystem
- netdev
- textfile
- time
- timex
# Use iptables allow/drop rules locally; NAT gateway disables this because its
# firewall script owns those rules.
node_exporter_manage_firewall: true
+5
View File
@@ -0,0 +1,5 @@
---
- name: Restart node exporter
ansible.builtin.systemd:
name: prometheus-node-exporter
state: restarted
+91
View File
@@ -0,0 +1,91 @@
---
- name: Require the monitoring VM private source address
ansible.builtin.assert:
that:
- monitoring_vm_ip is defined
- monitoring_vm_ip | length > 0
fail_msg: Set monitoring_vm_ip to the monitoring VM's 10.100.0.x address.
tags: [monitoring]
- name: Install node exporter package
ansible.builtin.apt:
name: prometheus-node-exporter
state: present
update_cache: true
cache_valid_time: 3600
tags: [monitoring]
- name: Install iptables persistence packages
ansible.builtin.apt:
name: [iptables, iptables-persistent]
state: present
update_cache: true
cache_valid_time: 3600
environment:
DEBIAN_FRONTEND: noninteractive
tags: [monitoring]
- name: Create node exporter textfile directory
ansible.builtin.file:
path: "{{ node_exporter_textfile_dir }}"
state: directory
owner: root
group: root
mode: "0755"
tags: [monitoring]
- name: Configure node exporter arguments
ansible.builtin.copy:
dest: /etc/default/prometheus-node-exporter
owner: root
group: root
mode: "0644"
content: >-
ARGS="--web.listen-address={{ node_exporter_listen_address }}:{{ node_exporter_port }}
{% for collector in node_exporter_collectors %}--collector.{{ collector }} {% endfor %}
--collector.systemd.unit-include={{ node_exporter_systemd_unit_filter }}
--collector.textfile.directory={{ node_exporter_textfile_dir }}"
notify: Restart node exporter
tags: [monitoring]
- name: Allow monitoring VM to access node exporter
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_port: "{{ node_exporter_port }}"
source: "{{ node_exporter_allowed_source }}"
jump: ACCEPT
comment: Allow monitoring VM node exporter
action: insert
rule_num: 1
register: node_exporter_allow_rule
tags: [monitoring]
when: node_exporter_manage_firewall
- name: Drop other node exporter access
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_port: "{{ node_exporter_port }}"
jump: DROP
comment: Drop other node exporter access
action: insert
rule_num: 2
register: node_exporter_drop_rule
tags: [monitoring]
when: node_exporter_manage_firewall
- name: Persist node exporter firewall rules
ansible.builtin.command: netfilter-persistent save
when:
- node_exporter_manage_firewall
- node_exporter_allow_rule is changed or node_exporter_drop_rule is changed
changed_when: true
tags: [monitoring]
- name: Enable and start node exporter
ansible.builtin.systemd:
name: prometheus-node-exporter
state: started
enabled: true
tags: [monitoring]
+1
View File
@@ -7,6 +7,7 @@ openvpn_cert_dir: /etc/openvpn/certs
openvpn_service: openvpn@server.service
openvpn_radius_plugin_path: ""
openvpn_radius_server: 10.1.0.101
openvpn_radius_auth_port: 1812
+25 -20
View File
@@ -1,25 +1,30 @@
-----BEGIN CERTIFICATE-----
MIIEIzCCAwugAwIBAgIIXQADw2Y0rCkwDQYJKoZIhvcNAQELBQAwdDELMAkGA1UE
MIIFHTCCBAWgAwIBAgIIQ5gRV6nKlhwwDQYJKoZIhvcNAQELBQAwdDELMAkGA1UE
BhMCREUxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdCYXZhcmlhMQ8wDQYDVQQHEwZN
dW5pY2gxEjAQBgNVBAoTCU15Q29tcGFueTEMMAoGA1UECxMDVlBOMRMwEQYDVQQD
EwpPcGVuVlBOLUNBMB4XDTI1MTExMTA5MjYwMFoXDTI2MTExMTA5MjYwMFowazEL
EwpPcGVuVlBOLUNBMB4XDTI2MTExNjExMTkwMFoXDTMwMTExNjExMTkwMFowZTEL
MAkGA1UEBhMCREUxEDAOBgNVBAgTB0JhdmFyaWExDzANBgNVBAcTBk11bmljaDES
MBAGA1UEChMJTXlDb21wYW55MQwwCgYDVQQLEwNWUE4xFzAVBgNVBAMTDjEyOC4x
NDAuMzEuMTMwMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqS+40lrT
JnMvpdATIwPkK+tlgRSMP6o7T3lPrEQs5hs3i7cz/7iQyKA+m6aGbBeq9UkjZEn1
YBL0B7W+JN5EKQIRB5CSP+dQPX1v29KJpg2pBERoz//q5s0HDDm+cGm7g/eyDoeU
mQRq2coJlSCTMxDBIbh5kBzWckA0wI1ttFJgrWkNg8vlC/tMcScUs8dUcq2fD2AK
p8MPlj6y2/P91VOcfKHied96tJFZ4AQa9NXgfKVp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Yu4Yrc6v2KthFKnxSqf7ycfjmL2sFhKC8A
eNESwb21YfE8cDRJcxWMLaB0RT3h0BFSrJm9kQrXGYfzVuzqZzYuJsHWEklrKqyM
EiEpcjnVHYKtirndZKQG02GVlj+O0hbzTTI6W1ZIllVBUeKU93qstLQOm4AxHgs3
FAEi9b1uMxpUKM3GP9NPlzyOiC68cdunFBz0mqDgXgvtO0QB1Z6ClWl8vrXLFkJ6
ceN81JI+TRgN5QC8mr1+asuMdTQqfyzxAoIBAGueFquOes04tOWzKOnwI/jKMsUM
tbC5sTFEb/Prub4OFWPU+AIGHmcTICF8ez7iiZFkPcJFQ4xqcWl41e3YBQaYTRCz
2RUwyk3CLLcSdLIH6u6CeND+XVtI3RrKPuy/64N4pMEbIgeM/UMJc9xyNWyQCMmQ
gl8bseanfRM1zLUkyCvE6QFLjsjFJkQUHzEM4qTUKqIxLx/Y5tED6LhkqS39sbEO
4i/+d+Atz5uRtA3ziCXkokbfE8VYFOivAgqiGzVR60MR0Ptctnf7esM/KNefHS9f
kAC98L5t3Qvf73hSFVJfZB8a7GSbobsfAo//YHVEm0Gm5SS/9N4THfafMJI=
-----END RSA PRIVATE KEY-----
+18
View File
@@ -0,0 +1,18 @@
-----BEGIN OpenVPN Static key V1-----
50233c0e81ad6e32db57614c6475e318
3b89cc7d5955d14d86ecb94574f2c813
0de8f6ee461eedd7c7c8dc412f3ef5da
08fbff0d8216b05c9c8b288ba05b4262
3b6869c97763ccb5c871edf274ce2631
eaf92c23c2eb200d5296cdb7194ea366
21556274bc5b26e584c6e44b28d2d0e7
bb1b31b5a3ea115ec87f519a70543746
1e26900f527c3e6e2a2c8b4ae34127e1
7f85b059a7d88198b9b6a659958db81e
238b1257805a97509d47b53b697721d0
a54044df487f4441a95e41e39118fda5
3040f9a3ea581f4b43875b36b17a4566
5f968e0d3262a0eb1b56c03acac7cf40
f5d8111f55b51aa00926948f282af910
51c00fd604de92af7612823a560a6c2c
-----END OpenVPN Static key V1-----
+11
View File
@@ -22,6 +22,7 @@
owner: root
group: root
mode: "0644"
notify: Restart openvpn
- name: Deploy server private key
ansible.builtin.copy:
@@ -30,3 +31,13 @@
owner: root
group: root
mode: "0600"
notify: Restart openvpn
- name: Deploy tls-crypt key
ansible.builtin.copy:
src: certs/tls-crypt.key
dest: "{{ openvpn_cert_dir }}/tls-crypt.key"
owner: root
group: root
mode: "0600"
notify: Restart openvpn
+26
View File
@@ -7,6 +7,32 @@
state: present
update_cache: true
- name: Locate RADIUS authentication plugin
ansible.builtin.find:
paths:
- /usr/lib
- /usr/lib/{{ ansible_architecture }}-linux-gnu
- /usr/lib/aarch64-linux-gnu
- /usr/lib/x86_64-linux-gnu
patterns: radiusplugin.so
recurse: true
file_type: file
register: openvpn_radius_plugin_candidates
- name: Configure RADIUS authentication plugin path
ansible.builtin.set_fact:
openvpn_radius_plugin_path: "{{ (openvpn_radius_plugin_candidates.files | sort(attribute='path') | first).path }}"
when: openvpn_radius_plugin_candidates.matched | int > 0
- name: Ensure RADIUS authentication plugin was found
ansible.builtin.assert:
that:
- openvpn_radius_plugin_candidates.matched | int > 0
fail_msg: >-
The openvpn-auth-radius package is installed but radiusplugin.so was not
found. Set openvpn_radius_plugin_path to its installed path for this
distribution and architecture.
- name: Create OpenVPN directories
ansible.builtin.file:
path: "{{ item }}"
+2 -1
View File
@@ -15,7 +15,7 @@ mode server
vlan-tagging
plugin /usr/lib/openvpn/radiusplugin.so /etc/openvpn/radiusplugin.cnf
plugin {{ openvpn_radius_plugin_path }} /etc/openvpn/radiusplugin.cnf
verify-client-cert none
username-as-common-name
@@ -28,6 +28,7 @@ client-connect /etc/openvpn/scripts/client-connect.sh
ca {{ openvpn_cert_dir }}/ca.crt
cert {{ openvpn_cert_dir }}/server.crt
key {{ openvpn_cert_dir }}/server.key
tls-crypt {{ openvpn_cert_dir }}/tls-crypt.key
dh none
ecdh-curve prime256v1
+63
View File
@@ -0,0 +1,63 @@
# 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`.
+6
View File
@@ -0,0 +1,6 @@
---
openvpn_pki_jwt_directory: /etc/vault-jwt
openvpn_pki_jwt_private_key_path: "{{ openvpn_pki_jwt_directory }}/private.pem"
openvpn_pki_jwt_public_key_path: "{{ openvpn_pki_jwt_directory }}/public.pem"
openvpn_pki_jwt_rsa_bits: 3072
openvpn_pki_public_key_artifact_directory: "{{ playbook_dir }}/../artifacts/openvpn-pki-public-keys"
+62
View File
@@ -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
+3
View File
@@ -0,0 +1,3 @@
---
- name: Import JWT identity preparation tasks
ansible.builtin.import_tasks: identity.yml
+7
View File
@@ -0,0 +1,7 @@
---
private_routing_interface: enp7s0
private_routing_gateway: 10.0.0.1
private_routing_metric: 100
private_routing_nameservers:
- 1.1.1.1
- 9.9.9.9
+93
View File
@@ -0,0 +1,93 @@
---
- name: Find Netplan configuration files
ansible.builtin.find:
paths: /etc/netplan
patterns: "*.yaml,*.yml"
file_type: file
register: private_routing_netplan_files
failed_when: false
- name: Determine whether systemd-networkd manages the interface
ansible.builtin.command: networkctl status "{{ private_routing_interface }}"
register: private_routing_networkctl
changed_when: false
failed_when: false
when: private_routing_netplan_files.matched | default(0) == 0
- name: Refuse unknown network manager rather than overwrite network settings
ansible.builtin.assert:
that:
- (private_routing_netplan_files.matched | default(0) > 0) or
(private_routing_networkctl.rc | default(1) == 0)
fail_msg: >-
No Netplan configuration or active systemd-networkd interface found for
{{ private_routing_interface }}; refusing to change network configuration.
# ---- Netplan path ----
- name: Install Netplan route drop-in
ansible.builtin.copy:
dest: /etc/netplan/99-private-vpn-default-route.yaml
content: |
network:
version: 2
ethernets:
{{ private_routing_interface }}:
routes:
- to: default
via: {{ private_routing_gateway }}
metric: {{ private_routing_metric }}
nameservers:
addresses: {{ private_routing_nameservers | to_json }}
owner: root
group: root
mode: "0600"
validate: python3 -c "import yaml,sys; yaml.safe_load(open(sys.argv[1]))" %s
when: private_routing_netplan_files.matched | default(0) > 0
- name: Apply Netplan route configuration
ansible.builtin.command: netplan apply
changed_when: false
when: private_routing_netplan_files.matched | default(0) > 0
# ---- systemd-networkd path ----
- name: Install systemd-networkd route drop-in
ansible.builtin.copy:
dest: "/etc/systemd/network/90-{{ private_routing_interface }}-private-vpn-route.network"
content: |
[Match]
Name={{ private_routing_interface }}
[Network]
{% for ns in private_routing_nameservers %}
DNS={{ ns }}
{% endfor %}
[Route]
Destination=0.0.0.0/0
Gateway={{ private_routing_gateway }}
Metric={{ private_routing_metric }}
owner: root
group: root
mode: "0644"
when: private_routing_netplan_files.matched | default(0) == 0
- name: Apply systemd-networkd route configuration
ansible.builtin.systemd:
name: systemd-networkd
state: restarted
when: private_routing_netplan_files.matched | default(0) == 0
# ---- Verification (both paths) ----
- name: Verify selected route to internet
ansible.builtin.command: ip -4 route get 8.8.8.8
register: private_routing_route_get
changed_when: false
failed_when: private_routing_gateway not in private_routing_route_get.stdout or private_routing_interface not in private_routing_route_get.stdout
- name: Verify DNS resolution through the gateway
ansible.builtin.command: getent hosts archive.ubuntu.com
register: private_routing_dns_check
changed_when: false
retries: 5
delay: 3
until: private_routing_dns_check.rc == 0
+3 -3
View File
@@ -1,7 +1,7 @@
---
- name: Check if Syft is installed
ansible.builtin.command: syft version
register: syft_check
register: sbom_syft_check
failed_when: false
changed_when: false
@@ -10,12 +10,12 @@
url: https://raw.githubusercontent.com/anchore/syft/main/install.sh
dest: /tmp/install-syft.sh
mode: "0755"
when: syft_check.rc != 0
when: sbom_syft_check.rc != 0
- name: Install Syft
ansible.builtin.command:
cmd: /tmp/install-syft.sh -b /usr/local/bin
when: syft_check.rc != 0
when: sbom_syft_check.rc != 0
changed_when: true
- name: Create report directory
+10
View File
@@ -0,0 +1,10 @@
[
{
"namespace": "infrastructure",
"role": "gitlab-vpn-node-config",
"mount": "ssh",
"path": "vpn-admin",
"field": "private_key",
"variable": "VPN_ADMIN_PRIVATE_KEY"
}
]