From 4e04bee9152657a33a787e41625ed37ea0f4380d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 5 Jul 2016 16:01:31 +0200 Subject: [PATCH] contrib: organize example scripts and add synergy Signed-off-by: Jason A. Donenfeld --- .../README | 0 .../client.sh | 0 .../server.sh | 0 contrib/synergy/README | 3 +++ contrib/synergy/synergy-client.sh | 18 ++++++++++++++++++ contrib/synergy/synergy-server.sh | 17 +++++++++++++++++ contrib/systemd/README | 5 +++++ contrib/{ => systemd}/wgserver.service | 0 8 files changed, 43 insertions(+) rename contrib/{client-server-example => ncat-client-server}/README (100%) rename contrib/{client-server-example => ncat-client-server}/client.sh (100%) rename contrib/{client-server-example => ncat-client-server}/server.sh (100%) create mode 100644 contrib/synergy/README create mode 100755 contrib/synergy/synergy-client.sh create mode 100755 contrib/synergy/synergy-server.sh create mode 100644 contrib/systemd/README rename contrib/{ => systemd}/wgserver.service (100%) diff --git a/contrib/client-server-example/README b/contrib/ncat-client-server/README similarity index 100% rename from contrib/client-server-example/README rename to contrib/ncat-client-server/README diff --git a/contrib/client-server-example/client.sh b/contrib/ncat-client-server/client.sh similarity index 100% rename from contrib/client-server-example/client.sh rename to contrib/ncat-client-server/client.sh diff --git a/contrib/client-server-example/server.sh b/contrib/ncat-client-server/server.sh similarity index 100% rename from contrib/client-server-example/server.sh rename to contrib/ncat-client-server/server.sh diff --git a/contrib/synergy/README b/contrib/synergy/README new file mode 100644 index 0000000..b75fb77 --- /dev/null +++ b/contrib/synergy/README @@ -0,0 +1,3 @@ +These scripts should be modified according to your precise setup. +They provide a very simple way of tunneling synergy inside of a +WireGuard tunnel, to protect your data in transit. diff --git a/contrib/synergy/synergy-client.sh b/contrib/synergy/synergy-client.sh new file mode 100755 index 0000000..56cfdb2 --- /dev/null +++ b/contrib/synergy/synergy-client.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -ex +if [[ $UID == 0 ]]; then + ip link del dev synergy || true + ip link add dev synergy type wireguard + ip address add 10.193.125.39/32 peer 10.193.125.38/32 dev synergy + wg set synergy \ + listen-port 29184 \ + private-key <(echo oNcsXA5Ma56q9xHmvvKuzLfwXYy7Uqy+bTmmXg/XtVs=) \ + peer m321UMZXoJ6qw8Jli2spbAVBc2MdOzV/EHDKfZQy0g0= \ + allowed-ips 10.193.125.38/32 \ + endpoint 10.10.10.100:29184 + ip link set up dev synergy +else + sudo "$(readlink -f "$0")" + killall synergyc || true + synergyc 10.193.125.38:38382 +fi diff --git a/contrib/synergy/synergy-server.sh b/contrib/synergy/synergy-server.sh new file mode 100755 index 0000000..6bef423 --- /dev/null +++ b/contrib/synergy/synergy-server.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -ex +if [[ $UID == 0 ]]; then + ip link del dev synergy || true + ip link add dev synergy type wireguard + ip address add 10.193.125.38/32 peer 10.193.125.39/32 dev synergy + wg set synergy \ + listen-port 29184 \ + private-key <(echo 2InSrlZA5eQfI/MvnvPieqNTBo9cd+udc3SOO9yFpXo=) \ + peer CBnoidQLjlbRsrqrI56WQbANWwkll41w/rVUIW9zISI= \ + allowed-ips 10.193.125.39/32 + ip link set up dev synergy +else + sudo "$(readlink -f "$0")" + killall synergys || true + synergys -a 10.193.125.38:38382 +fi 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/wgserver.service b/contrib/systemd/wgserver.service similarity index 100% rename from contrib/wgserver.service rename to contrib/systemd/wgserver.service