From a91c3d370d8acdfd8d2ee0595f9a7f39a62b03ac Mon Sep 17 00:00:00 2001 From: Mo Balaa Date: Thu, 11 Jul 2024 23:37:00 -0500 Subject: [PATCH] Patch from sideos --- src/client-link/entrypoint.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client-link/entrypoint.sh b/src/client-link/entrypoint.sh index 3be694b..4ca764e 100755 --- a/src/client-link/entrypoint.sh +++ b/src/client-link/entrypoint.sh @@ -3,8 +3,16 @@ set -euxo pipefail echo $GATEWAY_CLIENT_WG_PRIVKEY > /etc/wireguard/link0.key +cleanupLink() { + if ip link show link0 > /dev/null 2>&1; then + ip link delete link0 + fi +} -ip link add link0 type wireguard +if ! ip link show link0 > /dev/null 2>&1; then + trap cleanupLink EXIT + ip link add link0 type wireguard +fi wg set link0 private-key /etc/wireguard/link0.key wg set link0 listen-port 18521