From ca50df06d6a3f931a01c614936de8d82d70d9801 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sat, 30 Mar 2019 14:45:32 +0100 Subject: [PATCH] Add a config parameter: Enable the notification to the client that the server restarts (explicit-exit-notify) --- bin/ovpn_genconfig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/ovpn_genconfig b/bin/ovpn_genconfig index 50388be..67d627c 100755 --- a/bin/ovpn_genconfig +++ b/bin/ovpn_genconfig @@ -109,6 +109,7 @@ usage() { echo " -K Set a client config directory. Default Disable. Example: 'ccd'." echo " -V Enable the the record of client <-> virtual IP address (store in a config file)." echo " -L Configure log mode: 'disable', 'enable', 'append'. Default 'disable'." + echo " -F Enable the notification to the client that the server restarts." } process_route_config() { @@ -177,12 +178,13 @@ OVPN_DISABLE_REDUCE_DEAMON_S_PRIVILEGES=0 OVPN_CLIENT_CONFIG_DIR='' OVPN_ENABLE_KEEP_CLIENT_VIRTUAL_IP=0 OVPN_LOG_MODE="disable" +OVPN_ENABLE_NOTIFY_SERVER_RESTARTS=0 # Import existing configuration if present [ -r "$OVPN_ENV" ] && source "$OVPN_ENV" # Parse arguments -while getopts ":a:e:E:C:T:r:s:du:bcp:n:k:DNm:f:tz2S:RK:VL:" opt; do +while getopts ":a:e:E:C:T:r:s:du:bcp:n:k:DNm:f:tz2S:RK:VL:F" opt; do case $opt in a) OVPN_AUTH="$OPTARG" @@ -278,6 +280,9 @@ while getopts ":a:e:E:C:T:r:s:du:bcp:n:k:DNm:f:tz2S:RK:VL:" opt; do L) OVPN_LOG_MODE="$OPTARG" ;; + F) + OVPN_ENABLE_NOTIFY_SERVER_RESTARTS=1 + ;; \?) set +x echo "Invalid option: -$OPTARG" >&2 @@ -392,6 +397,8 @@ fi [ "$OVPN_ENABLE_KEEP_CLIENT_VIRTUAL_IP" == "1" ] && echo "ifconfig-pool-persist /etc/openvpn/client_vitual_ip.txt" >> "$conf" +[ "$OVPN_ENABLE_NOTIFY_SERVER_RESTARTS" == "1" ] && echo "explicit-exit-notify 1" >> "$conf" + if [ "${OVPN_LOG_MODE}" == "enable" ]; then echo "log /var/log/openvpn/openvpn.log" >> "$conf" else