From 0515fafaf83bacad435b71e2bd9445dee01b9499 Mon Sep 17 00:00:00 2001 From: dadevel Date: Sun, 15 Nov 2020 17:13:46 +0100 Subject: [PATCH] provide optional systemd service --- README.md | 2 ++ extras/systemd/wg-netns@.service | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 extras/systemd/wg-netns@.service diff --git a/README.md b/README.md index 58eaff6..22cf8db 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,5 @@ Or connect a container to it. podman run -it --rm --network ns:/var/run/netns/my-vpn alpine wget -O - https://ipinfo.io ~~~ +You can find a `wg-quick@.service` equivalent at [extras/systemd/wg-netns@.service](./extras/systemd/wg-netns@.service). + diff --git a/extras/systemd/wg-netns@.service b/extras/systemd/wg-netns@.service new file mode 100644 index 0000000..0509a06 --- /dev/null +++ b/extras/systemd/wg-netns@.service @@ -0,0 +1,16 @@ +[Unit] +Description=WireGuard Network Namespace (%i) +Wants=network-online.target nss-lookup.target +After=network-online.target nss-lookup.target + +[Service] +Type=oneshot +RemainAfterExit=yes + +Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity +ExecStart=wg-netns up %i +ExecStop=wg-netns down %i + +[Install] +WantedBy=multi-user.target +