blob: a0c5e4784c6d011e495d21a5e16c07ec47bd88c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
|