Add symmetric key option

This commit is contained in:
Luca Albuquerque 2019-06-04 20:28:47 -03:00
parent 7e71ea7dbb
commit ed75f787b8

View File

@ -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