auto-l3/auto-l3/sv/wireguard/run

23 lines
498 B
Bash
Executable File

#!/bin/sh
set -ex
for CONF in /auto-l3/wireguard/*.conf; do
[ -r "$CONF" ] || continue
IFACE=$(basename "$CONF" .conf)
ip link add dev "$IFACE" \
mtu 1412 \
master auto-l3 \
group auto-l3-wireguard \
type wireguard
wg setconf "$IFACE" "$CONF"
LL=$(wg show "$IFACE" public-key | base64 -d | hexdump -vn8 -e'3/2 "%04x:" "%04x" 1 "\n"')
ip address add "fe80::${LL}/64" dev "$IFACE"
ip link set "$IFACE" up
done
ip -c link show group auto-l3-wireguard
exec chpst -b wireguard pause