aboutsummaryrefslogtreecommitdiff
path: root/wireguard-install.sh
diff options
context:
space:
mode:
authorLuca Albuquerque <lucalacerda1@gmail.com>2019-06-05 13:19:01 -0300
committerLuca Albuquerque <lucalacerda1@gmail.com>2019-06-05 13:19:01 -0300
commita09de9c57adce50bc3f76c3eeee4d8aee94b9883 (patch)
tree66e6a004ac58a5462ec700571afec43824773db5 /wireguard-install.sh
parent8c9c13e58213e097e53eefbdd688093336b4e9db (diff)
Update confirmation
Diffstat (limited to 'wireguard-install.sh')
-rw-r--r--wireguard-install.sh10
1 files 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