Files
network_tools/sbin/openvpn-client-down
Arnaud G. GIBERT ad3862a5e0 - Complete migration,
- Move usr/lib, usr/sbin & var/www to lib, sbin & www,
- Add dns_host_update() to dns library,
- Add RPM Spec & bash completion files.
2026-04-20 18:27:56 +02:00

76 lines
2.5 KiB
Bash
Executable File

#!/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
# <https://www.gnu.org/licenses/>.
#
#-----------------------------------------------------------------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------------------------------
# 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