From 48ef68fdfd87bd6ddaf3678b92963d13847c985e Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Fri, 5 Apr 2024 18:29:55 +0200 Subject: Add quick & dirty Wireguard script --- scripts/wireguard-new-peer.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 scripts/wireguard-new-peer.sh diff --git a/scripts/wireguard-new-peer.sh b/scripts/wireguard-new-peer.sh new file mode 100644 index 0000000..d810d4f --- /dev/null +++ b/scripts/wireguard-new-peer.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +set -euo pipefail +IFS=$'\n\t' + +if [[ $# -ne 3 ]]; then + echo "Usage: $0 " + exit 1 +fi + +# create client keypair +cli_privkey=$(wg genkey) +cli_pubkey=$(wg pubkey <<< "$cli_privkey") + +# PrivateKey = ... +# if you don't leave a space, this won't work +srv_pubkey=$(awk -e '/PrivateKey/ { print $3; }' "$1" | wg pubkey) + +# create client config +echo "*** Scan this with your mobile phone ***" +qrencode -t ansiutf8 <