-
Notifications
You must be signed in to change notification settings - Fork 0
Gateway client
Arti Zirk edited this page Jan 9, 2020
·
1 revision
#!/bin/bash
set -x
CONF_URL="http://127.0.0.1:5000/config/export/1/wg-sync"
WG_IF="wg0"
PRIVATE_KEY="asdf"
ip link add ${WG_IF} type wireguard
ip addr flush dev ${WG_IF}
ip addr add fe80::/64 dev ${WG_IF}
wg set ${WG_IF} listen-port 51821
wg set ${WG_IF} private-key <(echo ${PRIVATE_KEY})
ip link set ${WG_IF} up
while true; do
wg syncconf "${WG_IF}" <(
curl "${CONF_URL}" | \
sed "/\[Interface\]/a\PrivateKey=${PRIVATE_KEY}"
)
sleep 1
done