diff options
author | uvok cheetah | 2024-05-27 19:08:23 +0200 |
---|---|---|
committer | uvok cheetah | 2024-05-27 19:08:23 +0200 |
commit | cf3cd322192a2f21c4d6b141c5820e9d1619a848 (patch) | |
tree | 179f6057e997a25ba143fdaea039a7bbe257661a /scripts | |
parent | 4e5fee8fa1a64a8f03253d3976090de305281067 (diff) |
Add new wireguard helper scripts
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/wireguard-add-peer.sh | 19 | ||||
-rw-r--r-- | scripts/wireguard-new-client.sh (renamed from scripts/wireguard-new-peer.sh) | 0 | ||||
-rw-r--r-- | scripts/wireguard-new-if.sh | 26 |
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 |