Created
February 2, 2019 17:00
-
-
Save heywoodlh/aa96ebcc2483015e64ee780e67029c6a to your computer and use it in GitHub Desktop.
Wireguard scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Assigned VPN Client IP address: " | |
read CLIENT_IP | |
echo '' | |
echo "Client private key: " | |
read CLIENT_PRIVATE_KEY | |
echo '' | |
echo "DNS server IP: " | |
read DNS | |
echo '' | |
echo "Server public key: " | |
read SERVER_PUBLIC_KEY | |
echo '' | |
echo "Server hostname: " | |
read SERVER_HOSTNAME | |
echo '' | |
read -p "Use default Wireguard port -- 51820 -- (y/n)?" choice | |
case "$choice" in | |
y|Y ) SERVER_PORT=51820;; | |
n|N ) echo "Server port: " && read SERVER_PORT;; | |
* ) echo "invalid";; | |
esac | |
echo '' | |
echo "Config file name to save (e.g. work-laptop.conf): " | |
read CONF_FILE | |
cat <<EOT >> $CONF_FILE | |
[Interface] | |
Address = $CLIENT_IP/32 | |
PrivateKey = $CLIENT_PRIVATE_KEY | |
DNS = $DNS | |
[Peer] | |
PublicKey = $SERVER_PUBLIC_KEY | |
Endpoint = $SERVER_HOSTNAME:$SERVER_PORT | |
AllowedIPs = 0.0.0.0/0 | |
PersistentKeepalive = 21 | |
EOT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment