diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt
index 0b430ef..6fb70d7 100644
--- a/ReleaseNotes.txt
+++ b/ReleaseNotes.txt
@@ -1,13 +1,15 @@
------------------------------------------------------------------------------------------------------------------------------------
-Network Tools V 1.2.0 - A. GIBERT - 2026/04/xx
+Network Tools V 1.2.0 - A. GIBERT - 2026/04/20
------------------------------------------------------------------------------------------------------------------------------------
- Split repository to remove the Rx3 configuration part and push it to rx3-config repo,
- Switch this repository to public,
- Migrate Network Tools to the new Rx3 Base Bash library,
+- Move usr/lib, usr/sbin & var/www to lib, sbin & www,
+- Add dns_host_update() to dns library,
- Add RPM Spec & bash completion files,
-- Move install dir form /usr/locla to usr,
-- Support now rx3-base 1.1.1.
+- Move install dir form /usr/local to usr,
+- Support now rx3-base 1.1.2.
diff --git a/SPECS/network_tools.spec b/SPECS/network_tools.spec
new file mode 100644
index 0000000..7175e09
--- /dev/null
+++ b/SPECS/network_tools.spec
@@ -0,0 +1,188 @@
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Network Tools
+#
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; If not, see
+# .
+#
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+
+
+%define name network_tools
+%define version 1.2.0
+%define release %mkrel 1rx3
+
+%global debug_package %{nil}
+
+%global _webdir %{_localstatedir}/www
+%global _webcgi %{_webdir}/cgi-bin
+%global _webhtml %{_webdir}/html
+
+
+
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Summary: Rx3 Network Tools
+License: GPL
+URL: https://git.rx3.org/gitea/rx3/%{name}
+
+Source0: https://git.rx3.org/gitea/rx3/%{name}/archive/%{name}-%{version}.tar.gz
+
+Distribution: Rx3 Free Software
+Vendor: Rx3
+Packager: Arnaud G. GIBERT
+
+BuildArch: noarch
+
+Requires: rx3-base
+
+%description
+These tools aims to manage network operation on Rx3 systems. This include:
+ - Boot time network setup,
+ - Comand line management tools,
+ - Web interface tools.
+
+The following topics are tageted:
+ - Virtual network interface,
+ - VPN,
+ - Proxy,
+ - Port forwarding,
+ - Dynamic DNS.
+
+This release support IPTables and OpenVPN.
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Prep
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+%prep
+%setup -q -n %{name}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Build
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+%build
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Install
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+%install
+
+# Config
+%{__mkdir_p} %{buildroot}%{_sysconfdir}/sysconfig
+cp etc/sysconfig/* %{buildroot}%{_sysconfdir}/sysconfig
+
+# SystemD
+%{__mkdir_p} %{buildroot}%{_unitdir}
+cp etc/systemd/system/* %{buildroot}%{_unitdir}
+
+
+# Bash completion
+%{__mkdir_p} %{buildroot}%{_sysconfdir}/bash_completion.d
+cp etc/bash_completion.d/* %{buildroot}%{_sysconfdir}/bash_completion.d
+
+# Lib
+%{__mkdir_p} %{buildroot}%{_prefix}/lib/rx3
+cp lib/rx3/*.bash %{buildroot}%{_prefix}/lib/rx3
+
+# Bin
+%{__mkdir_p} %{buildroot}%{_sbindir}
+cp sbin/* %{buildroot}%{_sbindir}
+
+# WWW
+%{__mkdir_p} %{buildroot}%{_webcgi}
+cp www/cgi-bin/*.cgi %{buildroot}%{_webcgi}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Check
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+%check
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Post
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+%post
+%_post_service %{name}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Preun
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+%preun
+%_preun_service %{name}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Files
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+%files
+%doc ReadMe.txt ReleaseNotes.txt ToDo.txt
+%license COPYING COPYING.LESSER GNU_GPL-3.0.txt GNU_LGPL-3.0.txt GNU_FDL-1.3.txt
+%config(noreplace) %{_sysconfdir}/sysconfig/*
+%defattr(644,root,root)
+ %{_sysconfdir}/bash_completion.d/*
+ %{_unitdir}/*.service
+ %{_prefix}/lib/rx3/*
+%defattr(0755,root,root)
+ %{_sbindir}/*
+ %{_webcgi}/*.cgi
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# ChangeLog
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+%changelog
+* Mon Apr 20 2026 Arnaud G. GIBERT - 1.2.0-1rx3.mga9
+- Create initial SPEC file for 1.2.0 on Mageia 9
diff --git a/ToDo.txt b/ToDo.txt
new file mode 100644
index 0000000..e8bfc71
--- /dev/null
+++ b/ToDo.txt
@@ -0,0 +1 @@
+- ...
diff --git a/etc/bash_completion.d/cert_dump b/etc/bash_completion.d/cert_dump
new file mode 100644
index 0000000..86c4866
--- /dev/null
+++ b/etc/bash_completion.d/cert_dump
@@ -0,0 +1,90 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 Cert Dump Bash Completion
+#
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; If not, see
+# .
+#
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Cert Dump Completion
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+_cert_dump_completion()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local prev="${COMP_WORDS[COMP_CWORD-1]}"
+ local opts="-h --help -V --version -v --verbose"
+
+ local pos=0
+ local i
+
+ COMPREPLY=()
+
+ # Count non-option positional arguments already provided
+ for (( i=1; i/dev/null | sed 's|.*/||; s|\.crt$||; s|^ca$||')" -- "${cur}") )
+ ;;
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ ;;
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+
+ return 0
+}
+
+
+
+complete -o filenames -F _cert_dump_completion cert_dump
diff --git a/etc/bash_completion.d/ip_host_update b/etc/bash_completion.d/ip_host_update
new file mode 100644
index 0000000..8924763
--- /dev/null
+++ b/etc/bash_completion.d/ip_host_update
@@ -0,0 +1,89 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 IP Host Update Bash Completion
+#
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; If not, see
+# .
+#
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# IP Host Update Completion
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+_ip_host_update_completion()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local prev="${COMP_WORDS[COMP_CWORD-1]}"
+ local opts="-h --help -V --version -v --verbose"
+
+ local pos=0
+ local i
+
+ COMPREPLY=()
+
+ # Count non-option positional arguments already provided
+ for (( i=1; i/dev/null | grep -oP 'zone\s+\"\K[^\"]+' | sort -u)" -- "${cur}") )
+ ;;
+ 2)
+ COMPREPLY=()
+ ;;
+ 3)
+ COMPREPLY=( $(compgen -W "60 300 600 3600 86400" -- "${cur}") )
+ ;;
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+
+ return 0
+}
+
+
+
+complete -o filenames -F _ip_host_update_completion ip_host_update
diff --git a/etc/bash_completion.d/openvpn-status b/etc/bash_completion.d/openvpn-status
new file mode 100644
index 0000000..89bbe1c
--- /dev/null
+++ b/etc/bash_completion.d/openvpn-status
@@ -0,0 +1,80 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 OpenVPN Status Bash Completion
+#
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; If not, see
+# .
+#
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# OpenVPN Status Completion
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+_openvpn_status_completion()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local prev="${COMP_WORDS[COMP_CWORD-1]}"
+ local opts="-h --help -V --version -v --verbose"
+
+ local pos=0
+ local i
+
+ COMPREPLY=()
+
+ # Count non-option positional arguments already provided
+ for (( i=1; i/dev/null | sed 's|.*/||; s|\.status$||')" -- "${cur}") )
+ ;;
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+
+ return 0
+}
+
+
+
+complete -o filenames -F _openvpn_status_completion openvpn-status
diff --git a/etc/bash_completion.d/rx3_net_adm b/etc/bash_completion.d/rx3_net_adm
index 615e31e..ddae5d4 100644
--- a/etc/bash_completion.d/rx3_net_adm
+++ b/etc/bash_completion.d/rx3_net_adm
@@ -22,6 +22,8 @@
#
#-----------------------------------------------------------------------------------------------------------------------------------
+
+
#-----------------------------------------------------------------------------------------------------------------------------------
# Rx3 Net Adm Completion
#-----------------------------------------------------------------------------------------------------------------------------------
diff --git a/etc/bash_completion.d/rx3_vpn_admin b/etc/bash_completion.d/rx3_vpn_admin
new file mode 100644
index 0000000..107e4ef
--- /dev/null
+++ b/etc/bash_completion.d/rx3_vpn_admin
@@ -0,0 +1,80 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 Vpn Adm Bash Completion
+#
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; If not, see
+# .
+#
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Rx3 Vpn Adm Completion
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+_rx3_vpn_adm_completion()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local prev="${COMP_WORDS[COMP_CWORD-1]}"
+ local opts="-h --help -V --version -v --verbose"
+
+ local pos=0
+ local i
+
+ COMPREPLY=()
+
+ # Count non-option positional arguments already provided
+ for (( i=1; i.
+#
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Includes
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+: "${RX3_LIB_DIR:=/usr/lib/rx3}"
+. "${RX3_LIB_DIR}/base.bash"
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Global Variables
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+declare -g VERSION="1.2.0"
+declare -g NAME="cert_dump"
+declare -g HELP="usage: [-h | --help] | [-V | --version] | [-v | --verbose] {ca|tc|key|csr|crt} [host]"
+
+declare -g MODE="DEFAULT"
+declare -g VERBOSE="FALSE"
+declare -g DRY_RUN="FALSE"
+declare -g RETVAL=0
+
+declare -g DEBUG=""
+#declare -g DEBUG="echo"
+#declare -g DEBUG=":"
+
+declare -g LOG=""
+#declare -g LOG=":"
+#declare -g LOG="echo"
+
+declare -g OPENVPN_DIR="/etc/openvpn"
+declare -g TYPE=""
+declare -g HOST=""
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Version Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+cdu_version_print()
+{
+ version_print
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Help Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+cdu_help_print()
+{
+ cdu_version_print
+ help_print
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Arg Parse
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+cdu_args_parse()
+{
+ tmp_args=$(getopt -o hvV --long help,verbose,version -n "${NAME}" -- "$@")
+
+ if [ $? != 0 ]; then echo "Terminating..." >&2; exit 1; fi
+
+ eval set -- "${tmp_args}"
+
+ while true
+ do
+ case "$1" in
+ # Options
+ -h|--help) MODE="EXIT"; cdu_help_print; shift;;
+ -V|--version) MODE="EXIT"; cdu_version_print; shift;;
+ -v|--verbose) VERBOSE="TRUE"; shift;;
+
+ # End of options
+ --) shift; break;;
+ *) echo "args_parse internal error [$1]!"; exit 1;;
+ esac
+ done
+
+ if [[ "${MODE}" != "EXIT" ]]
+ then
+ if [[ "${#}" -lt "1" ]]
+ then
+ MODE="EXIT"
+
+ echo_error "Not enough args!"
+ cdu_help_print
+ else
+ case "$1" in
+ "ca"|"tc")
+ MODE="$(echo "$1" | tr '[:lower:]' '[:upper:]')"
+ ;;
+
+ "key"|"csr"|"crt")
+ if [[ "${#}" -lt "2" ]]
+ then
+ MODE="EXIT"
+
+ echo_error "Missing host argument for type: [$1]"
+ cdu_help_print
+ else
+ MODE="$(echo "$1" | tr '[:lower:]' '[:upper:]')"
+ HOST="$2"
+ fi
+ ;;
+
+ *)
+ MODE="EXIT"
+
+ echo_error "Invalid type: [$1]"
+ cdu_help_print
+ ;;
+ esac
+ fi
+ fi
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Cert Dump Ca
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+cdu_cert_dump_ca()
+{
+ cat "${OPENVPN_DIR}/tls/certs/ca.crt"
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Cert Dump Tc
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+cdu_cert_dump_tc()
+{
+ cat "${OPENVPN_DIR}/tls/private/tc.key"
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Cert Dump Key
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+cdu_cert_dump_key()
+{
+ local host="$1"
+
+ cat "${OPENVPN_DIR}/tls/private/${host}.key"
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Cert Dump Csr
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+cdu_cert_dump_csr()
+{
+ local host="$1"
+
+ cat "${OPENVPN_DIR}/tls/certs/${host}.csr"
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Cert Dump Crt
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+cdu_cert_dump_crt()
+{
+ local host="$1"
+
+ cat "${OPENVPN_DIR}/tls/certs/${host}.crt"
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Main
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+cdu_args_parse "$@"
+
+
+
+if [[ "${MODE}" == "EXIT" ]]
+then
+ exit 0
+fi
+
+
+
+case "${MODE}" in
+ "CA")
+ cdu_cert_dump_ca
+ ;;
+
+ "TC")
+ cdu_cert_dump_tc
+ ;;
+
+ "KEY")
+ cdu_cert_dump_key "${HOST}"
+ ;;
+
+ "CSR")
+ cdu_cert_dump_csr "${HOST}"
+ ;;
+
+ "CRT")
+ cdu_cert_dump_crt "${HOST}"
+ ;;
+
+ *)
+ cdu_help_print
+ RETVAL=1
+ ;;
+esac
+
+
+
+exit ${RETVAL}
diff --git a/sbin/ip_host_update b/sbin/ip_host_update
new file mode 100755
index 0000000..4cf859e
--- /dev/null
+++ b/sbin/ip_host_update
@@ -0,0 +1,183 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 IP Host Update
+#
+# 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}/dns.bash"
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Global Variables
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+declare -g VERSION="1.0.0"
+declare -g NAME="ip_host_update"
+declare -g HELP="usage: [-h | --help] | [-V | --version] | [-v | --verbose] "
+
+declare -g MODE="DEFAULT"
+declare -g VERBOSE="FALSE"
+declare -g DRY_RUN="FALSE"
+declare -g RETVAL=0
+
+declare -g DEBUG=""
+#declare -g DEBUG="echo"
+#declare -g DEBUG=":"
+
+declare -g LOG=""
+#declare -g LOG=":"
+#declare -g LOG="echo"
+
+declare -g HOST=""
+declare -g ZONE=""
+declare -g IP=""
+declare -g TTL=""
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Version Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ihu_version_print()
+{
+ version_print
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Help Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ihu_help_print()
+{
+ ihu_version_print
+ help_print
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Arg Parse
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ihu_args_parse()
+{
+ tmp_args=$(getopt -o hvV --long help,verbose,version -n "${NAME}" -- "$@")
+
+ if [ $? != 0 ]; then echo "Terminating..." >&2; exit 1; fi
+
+ eval set -- "${tmp_args}"
+
+ while true
+ do
+ case "$1" in
+ # Options
+ -h|--help) MODE="EXIT"; ihu_help_print; shift;;
+ -V|--version) MODE="EXIT"; ihu_version_print; shift;;
+ -v|--verbose) VERBOSE="TRUE"; shift;;
+
+ # End of options
+ --) shift; break;;
+ *) echo "args_parse internal error [$1]!"; exit 1;;
+ esac
+ done
+
+ if [[ "${MODE}" != "EXIT" ]]
+ then
+ if [[ "${#}" -lt "4" ]]
+ then
+ MODE="EXIT"
+
+ echo_error "Not enough args!"
+ ihu_help_print
+ else
+ MODE="UPDATE"
+ HOST="$1"
+ ZONE="$2"
+ IP="$3"
+ TTL="$4"
+ fi
+ fi
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Host Update
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ihu_host_update()
+{
+ local host="$1"
+ local zone="$2"
+ local ip="$3"
+ local ttl="$4"
+
+ dns_host_update "${host}" "${zone}" "${ip}" "${ttl}"
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Main
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ihu_args_parse "$@"
+
+if [[ "${MODE}" == "EXIT" ]]
+then
+ exit 0
+fi
+
+case "${MODE}" in
+ UPDATE)
+ ihu_host_update "${HOST}" "${ZONE}" "${IP}" "${TTL}"
+ ;;
+
+ *)
+ echo "Usage: $0 "
+ RETVAL=1
+ ;;
+esac
+
+exit ${RETVAL}
diff --git a/usr/sbin/ns-launch b/sbin/ns-launch
similarity index 100%
rename from usr/sbin/ns-launch
rename to sbin/ns-launch
diff --git a/sbin/openvpn-client-down b/sbin/openvpn-client-down
new file mode 100755
index 0000000..29af617
--- /dev/null
+++ b/sbin/openvpn-client-down
@@ -0,0 +1,75 @@
+#!/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
diff --git a/sbin/openvpn-client-up b/sbin/openvpn-client-up
new file mode 100755
index 0000000..048772f
--- /dev/null
+++ b/sbin/openvpn-client-up
@@ -0,0 +1,77 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 OpenVPN Client Up
+#
+# 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.0.0"
+declare -g NAME="openvpn-client-up"
+
+declare -g DEBUG=""
+#declare -g DEBUG="echo"
+#declare -g DEBUG=":"
+
+declare -g LOG=""
+#declare -g LOG=":"
+#declare -g LOG="echo"
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Main
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+network_init
+
+output_param_file="$1"
+
+
+
+line="[${dev}]: Local_Int_Address: [${ifconfig_local}] Remote_Int_Address: [${ifconfig_pool_remote_ip}] Remote_Ext_Address: [${untrusted_ip}] Common_Name: [${common_name}] Output_Param_File: [${output_param_file}]"
+
+log_info "VPN-Client-Up" "${line}"
+
+touch /etc/openvpn/status/${common_name}.status
+
+
+
+log_trace "VPN-Client-Up" "[${dev}]: Done!"
+
+network_deinit
diff --git a/sbin/openvpn-down b/sbin/openvpn-down
new file mode 100755
index 0000000..a854ed2
--- /dev/null
+++ b/sbin/openvpn-down
@@ -0,0 +1,79 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 OpenVPN 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.0.0"
+declare -g NAME="openvpn-down"
+
+declare -g DEBUG=""
+#declare -g DEBUG="echo"
+#declare -g DEBUG=":"
+
+declare -g LOG=""
+#declare -g LOG=":"
+#declare -g LOG="echo"
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Main
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+local dev="$1"
+local local_mtu="$2"
+local remote_mtu="$3"
+local local_address="$4"
+local local_netmask="$5"
+local phase="$6"
+
+
+network_init
+
+
+log_info "VPN-Down" "[${dev}]: Local_MTU: [${local_mtu}] Remote_MTU: [${remote_mtu}] Local_Address: [${local_address}] Local_Netmask: [${local_netmask}] Phase: [${phase}]"
+
+
+network_device_deinit "" "${dev}"
+
+log_trace "VPN-Down" "[${dev}]: Done!"
+
+network_deinit
diff --git a/sbin/openvpn-status b/sbin/openvpn-status
new file mode 100755
index 0000000..5b7e76a
--- /dev/null
+++ b/sbin/openvpn-status
@@ -0,0 +1,193 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 OpenVPN Status
+#
+# 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}/base.bash"
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Global Variables
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+declare -g VERSION="1.0.0"
+declare -g NAME="openvpn-status"
+declare -g HELP="usage: [-h | --help] | [-V | --version] | [-v | --verbose] [dev]"
+
+declare -g MODE="DEFAULT"
+declare -g VERBOSE="FALSE"
+declare -g DRY_RUN="FALSE"
+declare -g RETVAL=0
+
+declare -g DEBUG=""
+#declare -g DEBUG="echo"
+#declare -g DEBUG=":"
+
+declare -g LOG=""
+#declare -g LOG=":"
+#declare -g LOG="echo"
+
+declare -g STATUS_DIR="/var/lib/openvpn"
+declare -g DEV=""
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Version Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ovs_version_print()
+{
+ version_print
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Help Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ovs_help_print()
+{
+ ovs_version_print
+ help_print
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Arg Parse
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ovs_args_parse()
+{
+ tmp_args=$(getopt -o hvV --long help,verbose,version -n "${NAME}" -- "$@")
+
+ if [ $? != 0 ]; then echo "Terminating..." >&2; exit 1; fi
+
+ eval set -- "${tmp_args}"
+
+ while true
+ do
+ case "$1" in
+ # Options
+ -h|--help) MODE="EXIT"; ovs_help_print; shift;;
+ -V|--version) MODE="EXIT"; ovs_version_print; shift;;
+ -v|--verbose) VERBOSE="TRUE"; shift;;
+
+ # End of options
+ --) shift; break;;
+ *) echo "args_parse internal error [$1]!"; exit 1;;
+ esac
+ done
+
+ if [[ "${MODE}" != "EXIT" ]]
+ then
+ if [[ "${#}" -ge "1" ]]
+ then
+ MODE="DEVICE"
+ DEV="$1"
+ else
+ MODE="ALL"
+ fi
+ fi
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Status Device
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ovs_status_device()
+{
+ local dev="$1"
+
+ cat "${STATUS_DIR}/${dev}.status"
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Status All
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ovs_status_all()
+{
+ awk '{print FILENAME ": " $0}' "${STATUS_DIR}"/*.status
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Main
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+ovs_args_parse "$@"
+
+
+
+if [[ "${MODE}" == "EXIT" ]]
+then
+ exit 0
+fi
+
+
+
+case "${MODE}" in
+ DEVICE)
+ ovs_status_device "${DEV}"
+ ;;
+
+ ALL)
+ ovs_status_all
+ ;;
+
+ *)
+ echo "Usage: $0 [dev]"
+ RETVAL=1
+ ;;
+esac
+
+exit ${RETVAL}
diff --git a/sbin/openvpn-up b/sbin/openvpn-up
new file mode 100755
index 0000000..da7a832
--- /dev/null
+++ b/sbin/openvpn-up
@@ -0,0 +1,78 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 OpenVPN Up
+#
+# 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.0.0"
+declare -g NAME="openvpn-up"
+
+declare -g DEBUG=""
+#declare -g DEBUG="echo"
+#declare -g DEBUG=":"
+
+declare -g LOG=""
+#declare -g LOG=":"
+#declare -g LOG="echo"
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Main
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+local dev="$1"
+local local_mtu="$2"
+local remote_mtu="$3"
+local local_address="$4"
+local local_netmask="$5"
+local phase="$6"
+
+
+network_init
+
+
+log_info "VPN-Up" "[${dev}]: Local_MTU: [${local_mtu}] Remote_MTU: [${remote_mtu}] Local_Address: [${local_address}] Local_Netmask: [${local_netmask}] Phase: [${phase}]"
+
+
+network_device_init "" "${dev}"
+
+log_trace "VPN-Up" "[${dev}]: Done!"
+
+
+network_deinit
diff --git a/usr/sbin/rx3_net_adm b/sbin/rx3_net_adm
similarity index 99%
rename from usr/sbin/rx3_net_adm
rename to sbin/rx3_net_adm
index cab6179..95838da 100755
--- a/usr/sbin/rx3_net_adm
+++ b/sbin/rx3_net_adm
@@ -22,6 +22,8 @@
#
#-----------------------------------------------------------------------------------------------------------------------------------
+
+
#-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#-----------------------------------------------------------------------------------------------------------------------------------
@@ -31,11 +33,13 @@
+
+
#-----------------------------------------------------------------------------------------------------------------------------------
# Global Variables
#-----------------------------------------------------------------------------------------------------------------------------------
-declare -g VERSION="1.0.0"
+declare -g VERSION="1.2.0"
declare -g NAME="rx3_net_adm"
declare -g HELP="usage: [-h | --help] | [-V | --version] | [-v | --verbose] {start|stop|restart|status|dump|table_set|refresh_address} [args...]"
@@ -123,6 +127,7 @@ rna_args_parse()
start|stop|restart|status|dump|table_set|refresh_address)
MODE="$(echo "$1" | tr '[:lower:]' '[:upper:]')"
;;
+
*)
MODE="EXIT"
diff --git a/sbin/rx3_vpn_adm b/sbin/rx3_vpn_adm
new file mode 100755
index 0000000..a6406c3
--- /dev/null
+++ b/sbin/rx3_vpn_adm
@@ -0,0 +1,271 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 Vpn Adm
+#
+# 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}/vpn.bash"
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Global Variables
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+declare -g VERSION="1.2.0"
+declare -g NAME="rx3_vpn_adm"
+declare -g HELP="usage: [-h | --help] | [-V | --version] | [-v | --verbose] {start | stop | restart | status | dump} [args...]"
+
+declare -g MODE="DEFAULT"
+declare -g VERBOSE="FALSE"
+declare -g DRY_RUN="FALSE"
+declare -g RETVAL=0
+declare -g prog="rx3-vpn"
+
+declare -g DEBUG=""
+#declare -g DEBUG="echo"
+#declare -g DEBUG=":"
+
+declare -g LOG=""
+#declare -g LOG=":"
+#declare -g LOG="echo"
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Version Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+rva_version_print()
+{
+ version_print
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Help Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+rva_help_print()
+{
+ rva_version_print
+ help_print
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Arg Parse
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+rva_args_parse()
+{
+ tmp_args=$(getopt -o hvV --long help,verbose,version -n "${NAME}" -- "$@")
+
+ if [ $? != 0 ]; then echo "Terminating..." >&2; exit 1; fi
+
+ eval set -- "${tmp_args}"
+
+ while true
+ do
+ case "$1" in
+ # Options
+ -h|--help) MODE="EXIT"; rva_help_print; shift;;
+ -V|--version) MODE="EXIT"; rva_version_print; shift;;
+ -v|--verbose) VERBOSE="TRUE"; shift;;
+
+ # End of options
+ --) shift; break;;
+ *) echo "args_parse internal error [$1]!"; exit 1;;
+ esac
+ done
+
+ if [[ "${MODE}" != "EXIT" ]]
+ then
+ if [[ "${#}" -lt "1" ]]
+ then
+ MODE="EXIT"
+
+ echo_error "Not enough args!"
+ rva_help_print
+ else
+ case "$1" in
+ start|stop|restart|status|dump)
+ MODE="$(echo "$1" | tr '[:lower:]' '[:upper:]')"
+ ;;
+
+ *)
+ MODE="EXIT"
+
+ echo_error "Invalid command: [$1]"
+ rva_help_print
+ ;;
+ esac
+ fi
+ fi
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Start
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+rva_start()
+{
+ echo "Starting..."
+
+ if [ -r /var/lock/subsys/rx3-vpn ]
+ then
+ echo "already started"
+ RETVAL=0
+ else
+ vpn_start
+
+ RETVAL=$?
+ [ "${RETVAL}" = 0 ] && touch /var/lock/subsys/rx3-vpn
+ fi
+
+ echo
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Stop
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+rva_stop()
+{
+ echo "Stopping..."
+
+ if [ -r /var/lock/subsys/rx3-vpn ]
+ then
+ vpn_stop
+
+ RETVAL=$?
+ else
+ echo "already stopped"
+ RETVAL=0
+ fi
+
+ [ "${RETVAL}" = 0 ] && rm -f /var/lock/subsys/rx3-vpn
+
+ echo
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Status
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+rva_status()
+{
+ vpn_status
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Dump
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+rva_dump()
+{
+ vpn_job_tab_dump
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Main
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+rva_args_parse "$@"
+
+
+
+if [[ "${MODE}" == "EXIT" ]]
+then
+ exit 0
+fi
+
+vpn_init
+
+case "${MODE}" in
+ START)
+ rva_start
+ ;;
+
+ STOP)
+ rva_stop
+ ;;
+
+ RESTART)
+ rva_stop
+ sleep 1
+ rva_start
+ ;;
+
+ STATUS)
+ rva_status
+ ;;
+
+ DUMP)
+ rva_dump
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|restart|status|dump}"
+ RETVAL=1
+ ;;
+esac
+
+vpn_deinit
+
+exit ${RETVAL}
diff --git a/usr/lib/default.bash b/usr/lib/default.bash
deleted file mode 100644
index 33fdb22..0000000
--- a/usr/lib/default.bash
+++ /dev/null
@@ -1,404 +0,0 @@
-#!/bin/bash
-
-if [[ "${DEFAULT_BASH}" != "" ]]
-then
- return
-else
- declare -g DEFAULT_BASH=1
-fi
-
-
-
-# Global Variable
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-declare -g LOG_FILE=""
-declare -g LOG_LOCK=""
-declare -g LOG_ECHO=""
-declare -g LOG_TRACE="DISABLED"
-
-
-
-
-
-# Default Options
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-shopt -s extglob
-
-
-
-
-
-# Print Version
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-version_print()
-{
- echo "$VERSION" | sed -e 's/.*: //' -e 's/-/ /' -e 's/_/\./g' -e 's/\$$//'
-}
-
-
-
-
-
-# Prin Help
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-help_print()
-{
- echo "${NAME} ${HELP}"
-
-}
-
-
-
-
-
-# Quote Str
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-quote_str()
-{
- local quoted=${1//\'/\'\\\'\'}
- printf "'%s'" "$quoted"
-}
-
-
-
-
-
-# Escape Str
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-escape_str()
-{
- echo "$*" | sed -e "s/\"/\\\\\"/g"
-}
-
-
-
-
-
-# Line Echo
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-line_echo()
-{
- string="$1"
- count="$2"
-
- echo -en "\e[2K\r"
-
- if [[ "${count}" != "" ]]
- then
- printf "%05d: %s" "${count}"
- echo -en "${string}"
- fi
-}
-
-
-
-
-
-# Err Echo
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-err_echo()
-{
- echo "$@" 1>&2
-}
-
-
-
-
-
-# Exec CMD
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-exec_cmd()
-{
- cmd="$1"
-
-
- if [[ "${verbose}" == "true" ]]
- then
- echo "${cmd}" 1>&2
- fi
-
- if [[ "${dry_run}" != "true" ]]
- then
- eval "${cmd}"
- fi
-}
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# tab_assign
-#--------------------------------------------------------------------------------------------------------------------------
-
-tab_assign()
-{
- declare -n ta_tab=$1
- ta_key=$2
- ta_value=$3
-
-
- if [[ "${ta_value}" == "-" ]]
- then
- ta_value=""
- fi
-
- ta_tab[${ta_key}]="${ta_value}"
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# var_assign
-#--------------------------------------------------------------------------------------------------------------------------
-
-var_assign()
-{
- declare -n va_var=$1
- va_value=$2
- va_mode=$3
-
-
- if [[ "${va_value}" == "-" ]]
- then
- va_value=""
- fi
-
- if [[ "${va_mode}" == "INC" ]]
- then
- va_var="${va_var} ${va_value}"
- else
- va_var="${va_value}"
- fi
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# file_dir_init
-#--------------------------------------------------------------------------------------------------------------------------
-
-file_dir_init()
-{
- local File="$1"
- local Owner="$2"
- local Group="$3"
-
- local dir
-
-
- if [ ! -f ${File} ]
- then
- if [[ "$( id -u)" != "0" ]]
- then
- ${ECHO} "Can't perform file init of: [${File}] as non root user!"
- else
- dir="$( dirname ${File})"
-
- if [ ! -d ${dir} ]
- then
- ${ECHO} "Initializing directory: [${dir}]"
-
- mkdir ${dir}
- chmod ug+rwx ${dir}
- chown ${Owner}:${Group} ${dir}
- fi
-
- ${ECHO} "Initializing file: [${File}]"
-
- >${File}
- chmod ug+rw ${File}
- chown ${Owner}:${Group} ${File}
- fi
- fi
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# file_lock
-#--------------------------------------------------------------------------------------------------------------------------
-
-file_lock()
-{
- local file="$1"
- local mode="$2"
- local desc="$3"
-
-
- if [[ ( "${mode}" == "EXCLUSIVE" ) || ( "${mode}" == "WRITE" ) ]]
- then
- flag="-x"
- else
- flag="-s"
- fi
-
- if [[ "${desc}" == "" ]]
- then
- desc="9"
- fi
-
-
- eval "exec ${desc}<>\"\${file}\""
-
- if ! flock ${flag} -w 5 ${desc}
- then
- err_echo "Failed to acquire [${mode}] lock on: [${file}]"
- exit 1
- fi
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# file_unlock
-#--------------------------------------------------------------------------------------------------------------------------
-
-file_unlock()
-{
- local desc="$1"
-
-
- if [[ "${desc}" == "" ]]
- then
- desc="9"
- fi
-
-
- eval "exec ${desc}<&-"
- eval "exec ${desc}>&-"
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# log_set
-#--------------------------------------------------------------------------------------------------------------------------
-
-log_set()
-{
- local log_file="$1"
- local lock_file="$2"
- local echo_function="$3"
- local log_trace="$4"
-
-
- LOG_FILE="${log_file}"
- LOG_LOCK="${lock_file}"
- LOG_ECHO="${echo_function}"
-
- if [[ ${log_trace} != "" ]]
- then
- LOG_TRACE="${log_trace}"
- fi
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# log_print
-#--------------------------------------------------------------------------------------------------------------------------
-
-log_print()
-{
- local log_file="$1"
- local lock_file="$2"
- local echo_function="$3"
- local log_type="$4"
- local log_prefix="$5"
-
-
- shift; shift; shift; shift; shift
-
- if [[ "${log_type}" != "TRA" ]] || [[ "${LOG_TRACE}" != "DISABLED" ]]
- then
- ${echo_function} "($BASHPID):" "$*"
-
- if [[ "${log_file}" != "" ]]
- then
- if [[ "${lock_file}" != "" ]]
- then
- file_lock "${lock_file}" WRITE 8
- fi
-
- printf >> "${log_file}" "%s %9s %3s %16s %s\n" "$(date --rfc-3339=seconds -u)" "($BASHPID)" "${log_type}" "${log_prefix}:" "$*"
-
- if [[ "${lock_file}" != "" ]]
- then
- file_unlock 8
- fi
- fi
- fi
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# log_trace
-#--------------------------------------------------------------------------------------------------------------------------
-
-log_trace()
-{
- log_print "${LOG_FILE}" "${LOG_LOCK}" "${LOG_ECHO}" "TRA" "$@"
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# log_info
-#--------------------------------------------------------------------------------------------------------------------------
-
-log_info()
-{
- log_print "${LOG_FILE}" "${LOG_LOCK}" "${LOG_ECHO}" "INF" "$@"
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# log_warning
-#--------------------------------------------------------------------------------------------------------------------------
-
-log_warning()
-{
- log_print "${LOG_FILE}" "${LOG_LOCK}" "${LOG_ECHO}" "WRN" "$@"
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# log_error
-#--------------------------------------------------------------------------------------------------------------------------
-
-log_error()
-{
- log_print "${LOG_FILE}" "${LOG_LOCK}" "${LOG_ECHO}" "ERR" "$@"
-}
diff --git a/usr/sbin/cert_dump b/usr/sbin/cert_dump
deleted file mode 100755
index 03c3c78..0000000
--- a/usr/sbin/cert_dump
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-
-OPENVPN_DIR=/etc/openvpn
-
-type=$1
-host=$2
-
-case "${type}"
-in
- "ca")
- cat ${OPENVPN_DIR}/tls/certs/ca.crt
- ;;
-
- "tc")
- cat ${OPENVPN_DIR}/tls/private/tc.key
- ;;
-
- "key")
- cat ${OPENVPN_DIR}/tls/private/${host}.key
- ;;
-
- "csr")
- cat ${OPENVPN_DIR}/tls/certs/${host}.csr
- ;;
-
- "crt")
- cat ${OPENVPN_DIR}/tls/certs/${host}.crt
- ;;
-esac
diff --git a/usr/sbin/ip_host_update b/usr/sbin/ip_host_update
deleted file mode 100755
index 5620bb4..0000000
--- a/usr/sbin/ip_host_update
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-host=$1
-zone=$2
-ip=$3
-ttl=$4
-
-
-
-date="$(date --rfc-3339 seconds)"
-
-(
- echo "prereq yxrrset ${host}.${zone}. A"
- echo "update delete ${host}.${zone}. A"
- echo "update add ${host}.${zone}. ${ttl} A ${ip}"
- echo "update delete ${host}.${zone}. TXT"
- echo "update add ${host}.${zone}. ${ttl} TXT ${date}"
- echo ""
-) | nsupdate
diff --git a/usr/sbin/openvpn-client-down b/usr/sbin/openvpn-client-down
deleted file mode 100755
index dd3a8df..0000000
--- a/usr/sbin/openvpn-client-down
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-
-#DEBUG=""
-#DEBUG="echo"
-#DEBUG=":"
-
-#LOG=":"
-#LOG="echo"
-#LOG=""
-
-
-
-# Includes
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-. /usr/local/lib/network.bash
-
-
-
-# Global Variables
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-#LOG_FILE=/var/log/openvpn/up-down.log
-
-
-
-
-
-# Main
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-network_init
-
-
-
-line="[${dev}]: Local_Int_Address: [${ifconfig_local}] Remote_Int_Address: [${ifconfig_pool_remote_ip}] Remote_Ext_Addres: [${untrusted_ip}] Common_Name: [${common_name}] Duration: [${time_duration}]"
-
-log_info "VPN-Client-Down" "$line" " Status: [OK]"
-
-touch /etc/openvpn/status/${common_name}.status
-
-log_trace "VPN-Client-Down" "[${dev}]: Done!"
diff --git a/usr/sbin/openvpn-client-up b/usr/sbin/openvpn-client-up
deleted file mode 100755
index 6972e47..0000000
--- a/usr/sbin/openvpn-client-up
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-
-#DEBUG=""
-#DEBUG="echo"
-#DEBUG=":"
-
-#LOG=":"
-#LOG="echo"
-#LOG=""
-
-
-
-# Includes
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-. /usr/local/lib/network.bash
-
-
-
-# Global Variables
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-#LOG_FILE=/var/log/openvpn/up-down.log
-
-
-
-
-
-# Main
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-Output_Param_File="$1"
-
-
-network_init
-
-
-
-line="[${dev}]: Local_Int_Address: [${ifconfig_local}] Remote_Int_Address: [${ifconfig_pool_remote_ip}] Remote_Ext_Addres: [${untrusted_ip}] Common_Name: [${common_name}] Output_Param_File: [${Output_Param_File}]"
-
-log_info "VPN-Client-Up" "$line" " Status: [OK]"
-
-touch /etc/openvpn/status/${common_name}.status
-
-log_trace "VPN-Client-Up" "[${dev}]: Done!"
diff --git a/usr/sbin/openvpn-down b/usr/sbin/openvpn-down
deleted file mode 100755
index 1cf319a..0000000
--- a/usr/sbin/openvpn-down
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-#DEBUG=""
-#DEBUG="echo"
-#DEBUG=":"
-
-#LOG=":"
-#LOG="echo"
-
-
-
-# Includes
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-. /usr/local/lib/network.bash
-
-
-
-# Global Variables
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-#LOG_FILE=/var/log/openvpn/up-down.log
-
-
-
-
-
-# Main
-#-----------------------------------------------------------------------------------------------------------------------------------
-
- Dev="$1"
- Local_MTU="$2"
- Remote_MTU="$3"
-Local_Address="$4"
-Local_Netmask="$5"
- Phase="$6"
-
-
-network_init
-
-
-log_info "VPN-Down" "[${Dev}]: Local_MTU: [${Local_MTU}] Remote_MTU: [${Remote_MTU}] Local_Address: [${Local_Address}] Local_Netmask: [${Local_Netmask}] Dst_Table: [${dst_table}] Phase: [${Phase}] Status: [OK]"
-
-network_device_deinit "" "${Dev}"
-
-log_trace "VPN-Down" "[${Dev}]: Done!"
diff --git a/usr/sbin/openvpn-status b/usr/sbin/openvpn-status
deleted file mode 100755
index 33ddfe4..0000000
--- a/usr/sbin/openvpn-status
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-dev=$1
-
-if [[ "$1" != "" ]]
-then
- cat /var/lib/openvpn/$dev.status
-else
- awk '{print FILENAME ": " $0}' /var/lib/openvpn/*.status
-fi
diff --git a/usr/sbin/openvpn-up b/usr/sbin/openvpn-up
deleted file mode 100755
index 6eb794d..0000000
--- a/usr/sbin/openvpn-up
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-#DEBUG=""
-#DEBUG="echo"
-#DEBUG=":"
-
-#LOG=":"
-#LOG="echo"
-#LOG=""
-
-
-
-# Includes
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-. /usr/local/lib/network.bash
-
-
-
-# Global Variables
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-#LOG_FILE=/var/log/openvpn/up-down.log
-
-
-
-
-
-# Main
-#-----------------------------------------------------------------------------------------------------------------------------------
-
- Dev="$1"
- Local_MTU="$2"
- Remote_MTU="$3"
-Local_Address="$4"
-Local_Netmask="$5"
- Phase="$6"
-
-
-network_init
-
-
-
-log_info "VPN-Up" "[${Dev}]: Local_MTU: [${Local_MTU}] Remote_MTU: [${Remote_MTU}] Local_Address: [${Local_Address}] Local_Netmask: [${Local_Netmask}] Phase: [${Phase}] Status: [OK]"
-
-network_device_init "" "${Dev}"
-
-log_trace "VPN-Up" "[${Dev}]: Done!"
diff --git a/usr/sbin/rx3_vpn_adm b/usr/sbin/rx3_vpn_adm
deleted file mode 100755
index 424134b..0000000
--- a/usr/sbin/rx3_vpn_adm
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/bash
-
-RETVAL=0
-
-#DEBUG=""
-#DEBUG="echo"
-#DEBUG=":"
-
-#LOG=":"
-#LOG="echo"
-
-
-
-# Includes
-#-----------------------------------------------------------------------------------------------------------------------------------
-
-. /usr/local/lib/vpn.bash
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Start
-#--------------------------------------------------------------------------------------------------------------------------
-
-start()
-{
- echo "Starting..."
-
- if [ -r /var/lock/subsys/rx3-vpn ]
- then
- echo "already started"
- RETVAL=0
- else
- vpn_start
-
- RETVAL=$?
- [ "$RETVAL" = 0 ] && touch /var/lock/subsys/rx3-vpn
- fi
-
- echo
-}
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Stop
-#--------------------------------------------------------------------------------------------------------------------------
-
-stop()
-{
- echo "Stopping..."
-
- if [ -r /var/lock/subsys/rx3-vpn ]
- then
- vpn_stop
-
- RETVAL=$?
- else
- echo "already stopped"
- RETVAL=0
- fi
-
- [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/rx3-vpn
-
- echo
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Status
-#--------------------------------------------------------------------------------------------------------------------------
-
-status()
-{
- vpn_status
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Dump
-#--------------------------------------------------------------------------------------------------------------------------
-
-dump()
-{
- vpn_job_tab_dump
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Main
-#--------------------------------------------------------------------------------------------------------------------------
-
-vpn_init
-
-case "$1" in
- start)
- start
- ;;
-
- stop)
- stop
- ;;
-
- restart)
- stop
- sleep 1
- start
- ;;
-
- status)
- status
- ;;
-
- dump)
- dump
- ;;
-
- *)
- echo "Usage: $0 {start|stop|restart|status|dump}"
- RETVAL=1
- ;;
-esac
-
-vpn_deinit
-
-exit $RETVAL
diff --git a/var/www/cgi-bin/ns-admin_board.cgi b/var/www/cgi-bin/ns-admin_board.cgi
deleted file mode 100755
index 19cdc9c..0000000
--- a/var/www/cgi-bin/ns-admin_board.cgi
+++ /dev/null
@@ -1,460 +0,0 @@
-#!/bin/bash
-
-. /etc/sysconfig/rx3-ns
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Lookup Domain Owner ()
-#--------------------------------------------------------------------------------------------------------------------------
-
-Lookup_Domain_Owner ()
-{
- for ldo_blk in ${NS_LIST}
- do
- OIFS=${IFS}
- IFS=:
- set ${ldo_blk}
- ldo_domain=$1
- ldo_host=$2
- ldo_owner=$3
- IFS=${OIFS}
-
- if [[ "${host}.${domain}" == "${ldo_host}.${ldo_domain}" ]]
- then
- echo ${ldo_owner}
- fi
- done
-}
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Header Print
-#--------------------------------------------------------------------------------------------------------------------------
-
-Header_Print ()
-{
- case "${format}"
- in
- "html")
- echo "Content-type: text/html"
- echo ""
-
- echo ""
- echo ""
- echo " "
- echo " "
-
- if [[ "${refresh}" == "yes" ]]
- then
- echo " "
- fi
-
- echo " "
- echo " "
- echo " "
- echo " Rx3 NS Admin: ${cmd_status}"
-
- echo " "
- echo " "
- ;;
-
- "txt")
- echo "Content-disposition: attachment; filename=${file_name}"
- echo "Content-type: text/plain"
- echo ""
- ;;
- esac
-}
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Tailer
-#--------------------------------------------------------------------------------------------------------------------------
-
-Footer_Print ()
-{
- case "${format}"
- in
- "html")
- echo " "
- echo ""
- echo ""
- ;;
-
- esac
-}
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Main
-#--------------------------------------------------------------------------------------------------------------------------
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Args
-#--------------------------------------------------------------------------------------------------------------------------
-
-cmd=""
-format=""
-ip=""
-host=""
-domain=""
-redirect=""
-
-remote_ip="${REMOTE_ADDR}"
-
-if [[ "${QUERY_STRING}" != "" ]]
-then
- OIFS=${IFS}
- IFS="\&"
- set ${QUERY_STRING}
- IFS=${OIFS}
-
- i=$#
-
- while [[ "${i}" != 0 ]]
- do
- var=${1/=*/}
- arg=${1/*=/}
-
- case "${var}"
- in
- "format")
- format=${arg}
- ;;
-
- "cmd")
- cmd=${arg}
- ;;
-
- "host")
- host=${arg}
- ;;
-
- "domain")
- domain=${arg}
- ;;
-
- "ip")
- ip=${arg}
- ;;
-
- "ttl")
- ttl=${arg}
- ;;
- esac
-
- shift
- i=$((i - 1))
- done
-fi
-
-if [[ "${format}" == "" ]]
-then
- format="html"
-fi
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Usage_Print
-#--------------------------------------------------------------------------------------------------------------------------
-
-Usage_Print ()
-{
- if [[ "${format}" == "html" ]]
- then
- echo "
"
- echo " "
- echo "
"
- echo ""
- echo "
Rx3 NS Admin Service Usage
"
- echo ""
- echo "
"
- echo "
"
- echo "
"
- echo "
"
- echo "
"
- echo "
"
- echo "
"
-
- echo " "
- echo " - cmd=address_get: Get the host IP address "
- echo " + [format=html|txt]: Output request format (Default to "html") "
- echo " + host=<Host Name>: Host name to show "
- echo " + domain=<Domaine Name>: Domain name of the host name "
- echo " "
- echo " - cmd=address_set: Set the host IP address "
- echo " + [format=html|txt]: Output request format (Default to "html") "
- echo " + host=<Host Name>: Host name to set "
- echo " + domain=<Domaine Name>: Domain name of the host name "
- echo " + [ip=<IP Address>]: IP address to be set (Default to requestor address) "
- echo " + [ttl=<TTL>]: TTL to be set (Default to 600) "
- echo " "
- echo " - Example: https://www.rx3.net/cgi-bin-private/ns-admin_board.cgi?cmd=address_get&host=vpn0&domain=vpn.rx3 "
-
- echo "
"
- echo "
"
- echo "
"
- echo "
"
- echo "
"
- echo "
"
- echo "
"
- else
- echo "Rx3 NS Service Usage:"
- echo " - cmd=address_get: Get the host IP address"
- echo " + [format=html|txt]: Output request format (Default to "html")"
- echo " + host=: Host name to show"
- echo " + domain=: Domain name of the host name"
- echo ""
- echo " - cmd=address_set: Set the host IP address"
- echo " + [format=html|txt]: Output request format (Default to "html")"
- echo " + host=: Host name to set"
- echo " + domain=: Domain name of the host name"
- echo " + [ip=]: IP address to be set (Default to requestor address)"
- echo " + [ttl=]: TTL to be set (Default to 600) "
- fi
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Main Board Print
-#--------------------------------------------------------------------------------------------------------------------------
-
-Main_Board_Print ()
-{
- if [[ "${format}" == "html" ]]
- then
- echo ""
- echo "
"
- fi
-}
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Main
-#--------------------------------------------------------------------------------------------------------------------------
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Args
-#--------------------------------------------------------------------------------------------------------------------------
-
-cmd=""
-format=""
-user=""
-status=""
-ip=""
-vpn=""
-type=""
-redirect=""
-cmd_status=""
-admin=""
-
-if [[ "${QUERY_STRING}" != "" ]]
-then
- OIFS=${IFS}
- IFS="\&"
- set ${QUERY_STRING}
- IFS=${OIFS}
-
- i=$#
-
- while [[ "${i}" != 0 ]]
- do
- var=${1/=*/}
- arg=${1/*=/}
-
- case "${var}"
- in
- "cmd")
- cmd=${arg}
- ;;
-
- "format")
- format=${arg}
- ;;
-
- "admin")
- admin=${arg}
- ;;
-
- "filter")
- filter=${arg}
- ;;
-
- "user")
- user=${arg}
- ;;
-
- "status")
- status=${arg}
- ;;
-
- "ip")
- ip=${arg}
- ;;
-
- "vpn")
- vpn=${arg}
- ;;
-
- "type")
- type=${arg}
- ;;
-
- "filename")
- filename=${arg}
- ;;
-
- "defroute")
- defroute=${arg}
- ;;
- esac
-
- shift
- i=$((i - 1))
- done
-fi
-
-if [[ "${format}" == "" ]]
-then
- format="html"
-fi
-
-
-
-
-
-#--------------------------------------------------------------------------------------------------------------------------
-# Command Handler
-#--------------------------------------------------------------------------------------------------------------------------
-
-network_init
-
-#network_tab_dump
-
-if [[ ( ${admin} == "true") && ( " ${ADMIN_USER_LIST} " != *" ${REMOTE_USER} "*) ]]
-then
- cmd_status="${cmd}: Admin NOT_AUTHORIZED"
-
- redirect="?user=${user}&up=${up}"
-
- Header_Print
- Footer_Print
-else
-
- case "${cmd}"
- in
- "")
- Header_Print
- Main_Board_Print
- Footer_Print
- ;;
-
- "route_set")
- network_src_tab_ip_lookup "${ip}"
- network_src_tab_get "${src_id}"
-
- network_dst_tab_get "${vpn}"
-
- if [[ ( ${admin} == "true") || ( ( "${REMOTE_USER}" == "${src_owner}") && ( "${dst_type}" != 1)) ]]
- then
- sudo /usr/local/sbin/rx3_net_adm table_set ${ip} ${dst_table} 1>&2
-
- if [[ "$?" == 0 ]]
- then
- cmd_status="route_set: OK"
- else
- cmd_status="route_set: KO"
- fi
- else
- cmd_status="route_set: NOT_AUTHORIZED [${REMOTE_USER}]/[${src_owner}]/[${dst_type}]"
- fi
-
- redirect="?admin=${admin}&filter=${filter}"
-
- Header_Print
- Footer_Print
- ;;
-
- "cert_download")
- network_src_tab_ip_lookup "${ip}"
- network_src_tab_get "${src_id}"
-
- if [[ ( ${admin} == "true") || ( "${REMOTE_USER}" == "${src_owner}") || ( "${type}" == "ca") || ( "${type}" == "crt") ]]
- then
- cmd_status="cert_download: OK"
- format="txt"
-
- case "${type}"
- in
- "ca")
- file_name="ca.crt"
- host_name=""
- ;;
-
- "tc")
- file_name="tc.key"
- host_name=""
- ;;
-
- *)
- host_name=$(host ${ip} | sed -e 's/.*domain name pointer //' -e 's/.$//')
- file_name="${host_name}.${type}"
- ;;
- esac
-
- Header_Print
- sudo /usr/local/sbin/cert_dump ${type} ${host_name}
- else
- cmd_status="cert_download: NOT_AUTHORIZED"
-
- redirect="?admin=${admin}&filter=${filter}"
-
- format="html"
- Header_Print
- Footer_Print
- fi
- ;;
-
- "config_download")
- network_src_tab_ip_lookup "${ip}"
- network_src_tab_get "${src_id}"
-
- if [[ ( ${admin} == "true") || ( "${REMOTE_USER}" == "${src_owner}") || ( "${type}" == "ext") ]]
- then
- cmd_status="config_download: OK"
-
- host_name=$(host ${ip} | sed -e 's/.*domain name pointer //' -e 's/.$//')
- template_name="rx3-client.ovpn"
-
- if [[ "${defroute}" == "false" ]]
- then
- defroute_pipe="sed s/#pull-filter/pull-filter/"
- route_type="nodefroute"
- else
- defroute_pipe="cat"
- route_type="defroute"
- fi
-
- format="txt"
-
- if [[ "${type}" == "ext" ]]
- then
- file_name="${host_name}-${route_type}-external.ovpn"
- Header_Print
-
- sed \"; sudo \/usr\/local\/sbin\/cert_dump ca; echo \"<\/ca>\")/" -e "s/cert tls\/certs\/CLIENT_FQDN.crt/\$(echo \"\"; sudo \/usr\/local\/sbin\/cert_dump crt CLIENT_FQDN; echo \"<\/cert>\")/" -e "s/key tls\/private\/CLIENT_FQDN.key/\$(echo \"\"; sudo \/usr\/local\/sbin\/cert_dump key CLIENT_FQDN; echo \"<\/key>\")/" -e "s/tls-crypt tls\/private\/tc.key/\$(echo \"\"; sudo \/usr\/local\/sbin\/cert_dump tc; echo \"<\/tls-crypt>\")/" -e "s/CLIENT_FQDN/${host_name}/g")\"" | ${defroute_pipe}
- fi
- else
- cmd_status="config_download: NOT_AUTHORIZED"
-
- redirect="?admin=${admin}&filter=${filter}"
-
- format="html"
- Header_Print
- Footer_Print
- fi
- ;;
-
- *)
- cmd_status="${cmd}: UNKNOWN_CMD"
-
- Header_Print
- Footer_Print
- ;;
- esac
-fi
-
-network_deinit
diff --git a/www/cgi-bin/ns-admin_board.cgi b/www/cgi-bin/ns-admin_board.cgi
new file mode 100755
index 0000000..a65f3a8
--- /dev/null
+++ b/www/cgi-bin/ns-admin_board.cgi
@@ -0,0 +1,534 @@
+#!/bin/bash
+#-----------------------------------------------------------------------------------------------------------------------------------
+#
+# Rx3 NS Admin Board CGI
+#
+# 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}/dns.bash"
+
+. /etc/sysconfig/rx3-ns # To be removed?
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Global Variables
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+declare -g VERSION="1.2.0"
+declare -g NAME="ns-admin_board.cgi"
+
+declare -g DEBUG=""
+#declare -g DEBUG="echo"
+#declare -g DEBUG=":"
+
+# No Log please
+export LOG=""
+
+declare -g CMD=""
+declare -g FORMAT=""
+declare -g IP=""
+declare -g HOST=""
+declare -g DOMAIN=""
+declare -g REDIRECT=""
+declare -g CMD_STATUS=""
+declare -g REFRESH=""
+declare -g TTL=""
+declare -g STATUS=""
+declare -g FILE_NAME=""
+declare -g REMOTE_IP="${REMOTE_ADDR}"
+declare -g HOST_INFO=""
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Lookup Domain Owner
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+nab_lookup_domain_owner()
+{
+ local ldo_blk
+ local ldo_domain
+ local ldo_host
+ local ldo_owner
+ local OIFS
+
+ for ldo_blk in ${NS_LIST}
+ do
+ OIFS="${IFS}"
+ IFS=":"
+ set ${ldo_blk}
+ ldo_domain="$1"
+ ldo_host="$2"
+ ldo_owner="$3"
+ IFS="${OIFS}"
+
+ if [[ "${HOST}.${DOMAIN}" == "${ldo_host}.${ldo_domain}" ]]
+ then
+ echo "${ldo_owner}"
+ fi
+ done
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Header Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+nab_header_print()
+{
+ case "${FORMAT}"
+ in
+ "html")
+ echo "Content-type: text/html"
+ echo ""
+
+ echo ""
+ echo ""
+ echo " "
+ echo " "
+
+ if [[ "${REFRESH}" == "yes" ]]
+ then
+ echo " "
+ fi
+
+ echo " "
+ echo " "
+ echo " "
+ echo " Rx3 NS Admin: ${CMD_STATUS}"
+ echo " "
+ echo " "
+ ;;
+
+ "txt")
+ echo "Content-disposition: attachment; filename=${FILE_NAME}"
+ echo "Content-type: text/plain"
+ echo ""
+ ;;
+ esac
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Footer Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+nab_footer_print()
+{
+ case "${FORMAT}"
+ in
+ "html")
+ echo " "
+ echo ""
+ echo ""
+ ;;
+ esac
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Usage Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+nab_usage_print()
+{
+ if [[ "${FORMAT}" == "html" ]]
+ then
+ echo "
"
+ echo " "
+ echo "
"
+ echo ""
+ echo "
Rx3 NS Admin Service Usage
"
+ echo ""
+ echo "
"
+ echo "
"
+ echo "
"
+ echo "
"
+ echo "
"
+ echo " - cmd=address_get: Get the host IP address"
+ echo " + [format=html|txt]: Output request format (Default to html)"
+ echo " + host=<Host Name>: Host name to show"
+ echo " + domain=<Domain Name>: Domain name of the host name"
+ echo ""
+ echo " - cmd=address_set: Set the host IP address"
+ echo " + [format=html|txt]: Output request format (Default to html)"
+ echo " + host=<Host Name>: Host name to set"
+ echo " + domain=<Domain Name>: Domain name of the host name"
+ echo " + [ip=<IP Address>]: IP address to be set (Default to requestor address)"
+ echo " + [ttl=<TTL>]: TTL to be set (Default to 600)"
+ echo ""
+ echo " - Example: https://www.rx3.net/cgi-bin-private/ns-admin_board.cgi?cmd=address_get&host=vpn0&domain=vpn.rx3"
+ echo "
"
+ echo "
"
+ echo "
"
+ echo "
"
+ echo "
"
+ else
+ echo "Rx3 NS Service Usage:"
+ echo " - cmd=address_get: Get the host IP address"
+ echo " + [format=html|txt]: Output request format (Default to html)"
+ echo " + host=: Host name to show"
+ echo " + domain=: Domain name of the host name"
+ echo ""
+ echo " - cmd=address_set: Set the host IP address"
+ echo " + [format=html|txt]: Output request format (Default to html)"
+ echo " + host=: Host name to set"
+ echo " + domain=: Domain name of the host name"
+ echo " + [ip=]: IP address to be set (Default to requestor address)"
+ echo " + [ttl=]: TTL to be set (Default to 600)"
+ fi
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Result Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+nab_result_print()
+{
+ local message="$1"
+
+ if [[ "${FORMAT}" == "html" ]]
+ then
+ echo "
"
+ echo "
"
+ echo "
"
+ echo "
"
+ echo "
"
+ echo "${message}"
+ echo "
"
+ echo "
"
+ echo "
"
+ echo "
"
+ echo "
"
+ else
+ echo "${message}"
+ fi
+}
+
+
+
+
+
+#-----------------------------------------------------------------------------------------------------------------------------------
+# Main Board Print
+#-----------------------------------------------------------------------------------------------------------------------------------
+
+nab_main_board_print()
+{
+ local blk
+ local domain
+ local host
+ local owner
+ local address
+ local ttl
+ local date
+ local class
+ local idx=0
+ local OIFS
+
+ if [[ "${FORMAT}" == "html" ]]
+ then
+ echo ""
+ echo "