From ed75f787b80ab1461c0348d595d6ee9c32dbff0b Mon Sep 17 00:00:00 2001 From: Luca Albuquerque Date: Tue, 4 Jun 2019 20:28:47 -0300 Subject: [PATCH 1/4] Add symmetric key option --- wireguard-install.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wireguard-install.sh b/wireguard-install.sh index cec2b4b..f0487fe 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -132,6 +132,16 @@ PublicKey = $SERVER_PUB_KEY Endpoint = $ENDPOINT AllowedIPs = 0.0.0.0/0,::/0" >> "$HOME/$SERVER_WG_NIC-client.conf" +# Ask for pre-shared symmetric key +read -r -p "Want to use pre-shared symmetric key? [y/N] " response +case "$response" in + [yY][eE][sS]|[yY]) + CLIENT_SYMM_PRE_KEY=$( wg genpsk ) + echo "PresharedKey = $CLIENT_PRE_KEY" >> "/etc/wireguard/$SERVER_WG_NIC.conf" + echo "PresharedKey =$CLIENT_PRE_KEY" >> "$HOME/$SERVER_WG_NIC-client.conf" + ;; +esac + chmod 600 -R /etc/wireguard/ # Enable routing on the server From 8c9c13e58213e097e53eefbdd688093336b4e9db Mon Sep 17 00:00:00 2001 From: Luca Albuquerque Date: Tue, 4 Jun 2019 20:36:53 -0300 Subject: [PATCH 2/4] Update names --- wireguard-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wireguard-install.sh b/wireguard-install.sh index f0487fe..571e2b3 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -137,8 +137,8 @@ read -r -p "Want to use pre-shared symmetric key? [y/N] " response case "$response" in [yY][eE][sS]|[yY]) CLIENT_SYMM_PRE_KEY=$( wg genpsk ) - echo "PresharedKey = $CLIENT_PRE_KEY" >> "/etc/wireguard/$SERVER_WG_NIC.conf" - echo "PresharedKey =$CLIENT_PRE_KEY" >> "$HOME/$SERVER_WG_NIC-client.conf" + 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 From a09de9c57adce50bc3f76c3eeee4d8aee94b9883 Mon Sep 17 00:00:00 2001 From: Luca Albuquerque Date: Wed, 5 Jun 2019 13:19:01 -0300 Subject: [PATCH 3/4] Update confirmation --- wireguard-install.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wireguard-install.sh b/wireguard-install.sh index 571e2b3..1dc8f21 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -69,6 +69,9 @@ 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 +read -rp "Want to use pre-shared symmetric key? [y/N] " is_pre_symm + if [[ $SERVER_PUB_IPV6_USED = 'y' ]]; then ENDPOINT="[$SERVER_PUB_IP]:$SERVER_PORT" else @@ -132,13 +135,12 @@ PublicKey = $SERVER_PUB_KEY Endpoint = $ENDPOINT AllowedIPs = 0.0.0.0/0,::/0" >> "$HOME/$SERVER_WG_NIC-client.conf" -# Ask for pre-shared symmetric key -read -r -p "Want to use pre-shared symmetric key? [y/N] " response -case "$response" in +# 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" + echo "PresharedKey = $CLIENT_SYMM_PRE_KEY" >> "$HOME/$SERVER_WG_NIC-client.conf" ;; esac From 7bda5435e6fd992d51fa5cee27db6ce67fb0f1bf Mon Sep 17 00:00:00 2001 From: Luca Lacerda Date: Sat, 8 Jun 2019 03:40:24 -0300 Subject: [PATCH 4/4] Update names and default selection --- wireguard-install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wireguard-install.sh b/wireguard-install.sh index cbb9309..b0bd456 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -68,7 +68,8 @@ 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 -read -rp "Want to use pre-shared symmetric key? [y/N] " is_pre_symm +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 @@ -137,7 +138,7 @@ 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 +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"