summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/wireguard-add-peer.sh19
-rw-r--r--scripts/wireguard-new-client.sh (renamed from scripts/wireguard-new-peer.sh)0
-rw-r--r--scripts/wireguard-new-if.sh26
3 files changed, 45 insertions, 0 deletions
diff --git a/scripts/wireguard-add-peer.sh b/scripts/wireguard-add-peer.sh
new file mode 100644
index 0000000..97c3cf3
--- /dev/null
+++ b/scripts/wireguard-add-peer.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+set -euo pipefail
+IFS=$'\n\t'
+
+if [[ $# -ne 1 ]]; then
+ echo "Usage: $0 <wg server config file>"
+ exit 1
+fi
+
+cat >> "$1" <<EOF
+
+# Auto-Generated
+[Peer]
+PublicKey = TODO
+AllowedIPs = ::/0, 0.0.0.0/0
+Endpoint = TODO
+
+EOF
diff --git a/scripts/wireguard-new-peer.sh b/scripts/wireguard-new-client.sh
index 28ca90e..28ca90e 100644
--- a/scripts/wireguard-new-peer.sh
+++ b/scripts/wireguard-new-client.sh
diff --git a/scripts/wireguard-new-if.sh b/scripts/wireguard-new-if.sh
new file mode 100644
index 0000000..a0c5e47
--- /dev/null
+++ b/scripts/wireguard-new-if.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -euo pipefail
+IFS=$'\n\t'
+
+if [[ $# -ne 1 ]]; then
+ echo "Usage: $0 <wg server config file>"
+ exit 1
+fi
+
+[[ -a "$1" ]] && echo "File already exists. Nope." >&2 && exit 1
+
+# create client keypair
+srv_privkey=$(wg genkey)
+srv_pubkey=$(wg pubkey <<< "$srv_privkey")
+
+umask 177
+
+cat >> "$1" <<EOF
+[Interface]
+PrivateKey = $srv_privkey
+Address = TODO
+ListenPort = TODO
+Table = off
+# Pubkey = $srv_pubkey
+EOF