aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib/systemd
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-07-05 16:01:31 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2016-07-05 16:01:31 +0200
commit4e04bee9152657a33a787e41625ed37ea0f4380d (patch)
tree9d1c97153ceeac72aa2d05818bd162c06c40ac57 /contrib/systemd
parentwg: always fallback to /dev/urandom (diff)
downloadwireguard-tools-4e04bee9152657a33a787e41625ed37ea0f4380d.tar.xz
wireguard-tools-4e04bee9152657a33a787e41625ed37ea0f4380d.zip
contrib: organize example scripts and add synergy
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'contrib/systemd')
-rw-r--r--contrib/systemd/README5
-rw-r--r--contrib/systemd/wgserver.service15
2 files changed, 20 insertions, 0 deletions
diff --git a/contrib/systemd/README b/contrib/systemd/README
new file mode 100644
index 0000000..1ef51aa
--- /dev/null
+++ b/contrib/systemd/README
@@ -0,0 +1,5 @@
+Until WireGuard receives full integration to the various network
+management utilities, there are a number of ways of setting up
+a WireGuard tunnel at boot time. This systemd unit file is one
+such way of doing things. Probably it should be tweaked before
+using.
diff --git a/contrib/systemd/wgserver.service b/contrib/systemd/wgserver.service
new file mode 100644
index 0000000..dfce1e9
--- /dev/null
+++ b/contrib/systemd/wgserver.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=WireGuard Server
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/ip link add dev wgserver type wireguard
+ExecStart=/bin/ip address add 192.168.177.1/24 dev wgserver
+ExecStart=/usr/bin/wg setconf wgserver /etc/wireguard-server.conf
+ExecStart=/bin/ip link set up dev wgserver
+ExecStop=/bin/sh -c 'umask 077; /usr/bin/wg showconf wgserver > /etc/wireguard-server.conf.tmp && mv /etc/wireguard-server.conf.tmp /etc/wireguard-server.conf'
+ExecStop=/bin/ip link del dev wgserver
+
+[Install]
+WantedBy=multi-user.target