aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--contrib/examples/systemd-resolved/README8
-rwxr-xr-xcontrib/examples/systemd-resolved/apply.sh9
-rw-r--r--contrib/examples/systemd-resolved/systemd-resolve.bash11
3 files changed, 28 insertions, 0 deletions
diff --git a/contrib/examples/systemd-resolved/README b/contrib/examples/systemd-resolved/README
new file mode 100644
index 0000000..4f262b8
--- /dev/null
+++ b/contrib/examples/systemd-resolved/README
@@ -0,0 +1,8 @@
+systemd-resolved(8) support for wg-quick(8)
+===========================================
+
+This is a stop gap solution until systemd 239 comes out with resolvconf
+emulation. Running 'apply.sh` in this directory will insert 'systemd-resolve.bash`
+into the right place in 'wg-quick.bash`. It is recommended that distributions
+who use systemd-resolved by default run this before calling 'make install` in
+their packaging scripts.
diff --git a/contrib/examples/systemd-resolved/apply.sh b/contrib/examples/systemd-resolved/apply.sh
new file mode 100755
index 0000000..7340eea
--- /dev/null
+++ b/contrib/examples/systemd-resolved/apply.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
+
+ME="$(readlink -f "$(dirname "$(readlink -f "$0")")")"
+TOOLS="$ME/../../../src/tools"
+
+sed -i "/~~ function override insertion point ~~/r $ME/systemd-resolve.bash" "$TOOLS/wg-quick/linux.bash"
diff --git a/contrib/examples/systemd-resolved/systemd-resolve.bash b/contrib/examples/systemd-resolved/systemd-resolve.bash
new file mode 100644
index 0000000..4ea1cf9
--- /dev/null
+++ b/contrib/examples/systemd-resolved/systemd-resolve.bash
@@ -0,0 +1,11 @@
+set_dns() {
+ [[ ${#DNS[@]} -gt 0 ]] || return 0
+ cmd systemd-resolve --interface="$INTERFACE" "${DNS[@]/#/--set-dns=}" --set-domain=~.
+ HAVE_SET_DNS=1
+}
+
+unset_dns() {
+ # We don't need to call --revert here, since the interface is being deleted
+ # anyway, and systemd-resolved knows about that.
+ return 0
+}