#!/bin/bash #----------------------------------------------------------------------------------------------------------------------------------- # # Rx3 OpenVPN Client Down # # Copyright (C) 2025-2026 Arnaud G. GIBERT # mailto:arnaud@rx3.net # # This is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; If not, see # . # #----------------------------------------------------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------------------------------------------------- # Includes #----------------------------------------------------------------------------------------------------------------------------------- : "${RX3_LIB_DIR:=/usr/lib/rx3}" . "${RX3_LIB_DIR}/network.bash" #----------------------------------------------------------------------------------------------------------------------------------- # Global Variables #----------------------------------------------------------------------------------------------------------------------------------- declare -g VERSION="1.2.0" declare -g NAME="openvpn-client-down" declare -g DEBUG="" #declare -g DEBUG="echo" #declare -g DEBUG=":" declare -g LOG="" #declare -g LOG=":" #declare -g LOG="echo" #----------------------------------------------------------------------------------------------------------------------------------- # Main #----------------------------------------------------------------------------------------------------------------------------------- network_init line="[${dev}]: Local_Int_Address: [${ifconfig_local}] Remote_Int_Address: [${ifconfig_pool_remote_ip}] Remote_Ext_Address: [${untrusted_ip}] Common_Name: [${common_name}] Duration: [${time_duration}]" log_info "VPN-Client-Down" "${line}" touch /etc/openvpn/status/${common_name}.status log_trace "VPN-Client-Down" "[${dev}]: Done!" network_deinit