diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2026-07-12 17:34:14 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2026-07-12 17:34:14 +0300 |
| commit | 659238b46057ed8a57e28004bb9dc07d6415a959 (patch) | |
| tree | 973353c6af95c0641714ef806b578fed15385e5f /roles/jails/16_dl/templates/wg_random_tunnel.j2 | |
| parent | c101bc05df0960f97ba621fc3c86e8b3f3f07615 (diff) | |
Set up dl jail
Diffstat (limited to 'roles/jails/16_dl/templates/wg_random_tunnel.j2')
| -rw-r--r-- | roles/jails/16_dl/templates/wg_random_tunnel.j2 | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/roles/jails/16_dl/templates/wg_random_tunnel.j2 b/roles/jails/16_dl/templates/wg_random_tunnel.j2 new file mode 100644 index 0000000..3cc9492 --- /dev/null +++ b/roles/jails/16_dl/templates/wg_random_tunnel.j2 @@ -0,0 +1,17 @@ +#!/bin/sh + +set -eux + +CONF=$(ls /usr/local/etc/wireguard/ | sort -R | head -n1) +GATEWAY={{ ingress_ip }} + +# Shut down current tunnel +wg-quick down $(wg show interfaces) || true + +wg-quick up "/usr/local/etc/wireguard/${CONF}" + +TUNNEL_IF=$(wg show interfaces) +TUNNEL_IP=$(wg show $TUNNEL_IF endpoints | awk '{print $2}' | tr ':' ' ' | awk '{print $1}') + +route delete $TUNNEL_IP +route add $TUNNEL_IP $GATEWAY |
