aboutsummaryrefslogtreecommitdiff
path: root/wireguard-install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'wireguard-install.sh')
-rw-r--r--wireguard-install.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/wireguard-install.sh b/wireguard-install.sh
index 07ef9a1..cbb9309 100644
--- a/wireguard-install.sh
+++ b/wireguard-install.sh
@@ -67,6 +67,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_IP =~ .*:.* ]]
then
echo "IPv6 Detected"
@@ -133,6 +136,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