Skip to content

Commit

Permalink
wireguard enrollment script
Browse files Browse the repository at this point in the history
  • Loading branch information
ifd3f committed Mar 23, 2024
1 parent b593a12 commit c8b698e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions wireguard/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VbaDq7X13wt0MSRGBk6OYkd9lRUSrhGDhEJJbQrzk1M=
22 changes: 22 additions & 0 deletions wireguard/enroll.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -euo pipefail

hostname=$(hostname)
username=$(whoami)
filename="$username@$hostname"
dstdir="$HOME/.config/nyahaus-wireguard/"
private_key="$dstdir/private.key"

umask 077
mkdir -p "$dstdir"
chmod 700 "$dstdir"

echo "writing private key to $private_key"
wg genkey > "$private_key"
chmod 600 "$private_key"

echo "writing public key to $filename.pub"
umask 777
cat "$private_key" | wg pubkey | tee "$filename.pub"

0 comments on commit c8b698e

Please sign in to comment.