blob: 3cc9492b7bf3875750b72a407da464ccd57d7c2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
|