add PERSISTENTKEEPALIVE support

This commit is contained in:
DerDanilo 2021-06-06 01:10:43 +02:00
parent 96102d009c
commit 88a701c16a
3 changed files with 15 additions and 0 deletions

View file

@ -1129,6 +1129,13 @@ installPiVPN(){
echo "pivpnPROTO=${pivpnPROTO}" >> ${tempsetupVarsFile}
echo "pivpnMTU=${pivpnMTU}" >> ${tempsetupVarsFile}
# Write PERSISTENTKEEPALIVE if provided via unattended file
# May also be added manually to /etc/pivpn/wireguard/setupVars.conf
# post installation to be used for client profile generation
if [ "$pivpnPERSISTENTKEEPALIVE" ]; then
echo "pivpnPERSISTENTKEEPALIVE=${pivpnPERSISTENTKEEPALIVE}" >> ${tempsetupVarsFile}
fi
fi
{

View file

@ -9,4 +9,8 @@ pivpnPORT=51820
pivpnDNS1=9.9.9.9
pivpnDNS2=149.112.112.112
pivpnHOST=pivpn.example.com
# Optional, but might be useful
# Can also be added to setupVars post setup
# to be used during client profile generation
pivpnPERSISTENTKEEPALIVE=21
UNATTUPG=1

View file

@ -120,6 +120,10 @@ PublicKey = $(cat keys/server_pub)
PresharedKey = $(cat "keys/${CLIENT_NAME}_psk")
Endpoint = ${pivpnHOST}:${pivpnPORT}
AllowedIPs = ${ALLOWED_IPS}" >> "configs/${CLIENT_NAME}.conf"
if [ -n "${pivpnPERSISTENTKEEPALIVE}" ]; then
echo "PersistentKeepalive = ${pivpnPERSISTENTKEEPALIVE}" >> "configs/${CLIENT_NAME}.conf"
fi
echo "::: Client config generated"
echo "### begin ${CLIENT_NAME} ###