From 659238b46057ed8a57e28004bb9dc07d6415a959 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sun, 12 Jul 2026 17:34:14 +0300 Subject: Set up dl jail --- roles/jails/16_dl/templates/wg_random_tunnel.j2 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 roles/jails/16_dl/templates/wg_random_tunnel.j2 (limited to 'roles/jails/16_dl/templates/wg_random_tunnel.j2') 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 -- cgit v1.3