diff options
author | Stanislas <angristan@pm.me> | 2019-06-09 16:51:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-09 16:51:47 +0200 |
commit | dc7f30cb6147fb64f3717afcf9cb59f017cfb73e (patch) | |
tree | d7c2ae2f4fe939202c7a4ee1b6a58212da123f48 | |
parent | cee0b88b2b6d7aa4827e1df5374fca0a97614b9c (diff) | |
parent | 7bda5435e6fd992d51fa5cee27db6ce67fb0f1bf (diff) |
Merge pull request #19 from lucawen/master
Add support for pre-shared symmetric key
Fix #12
-rw-r--r-- | wireguard-install.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/wireguard-install.sh b/wireguard-install.sh index 07ef9a1..b0bd456 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -67,6 +67,10 @@ read -rp "First DNS resolver to use for the client: " -e -i "$CLIENT_DNS_1" CLIE CLIENT_DNS_2="176.103.130.131" read -rp "Second DNS resolver to use for the client: " -e -i "$CLIENT_DNS_2" CLIENT_DNS_2 +# Ask for pre-shared symmetric key +IS_PRE_SYMM="y" +read -rp "Want to use pre-shared symmetric key? [Y/n]: " -e -i "$IS_PRE_SYMM" IS_PRE_SYMM + if [[ $SERVER_PUB_IP =~ .*:.* ]] then echo "IPv6 Detected" @@ -133,6 +137,15 @@ PublicKey = $SERVER_PUB_KEY Endpoint = $ENDPOINT AllowedIPs = 0.0.0.0/0,::/0" >> "$HOME/$SERVER_WG_NIC-client.conf" +# Add pre shared symmetric key to respective files +case "$IS_PRE_SYMM" in + [yY][eE][sS]|[yY]) + CLIENT_SYMM_PRE_KEY=$( wg genpsk ) + echo "PresharedKey = $CLIENT_SYMM_PRE_KEY" >> "/etc/wireguard/$SERVER_WG_NIC.conf" + echo "PresharedKey = $CLIENT_SYMM_PRE_KEY" >> "$HOME/$SERVER_WG_NIC-client.conf" + ;; +esac + chmod 600 -R /etc/wireguard/ # Enable routing on the server |