#!/bin/sh . /usr/lib/libmodcgi.sh . /mod/etc/conf/openvpn.cfg NAMES="${OPENVPN_CONFIG_NAMES#*\#}" NAMES="openvpn${NAMES//#/\nopenvpn_}" MODE="${OPENVPN_MODE#*\#}" LOG="${OPENVPN_LOGFILE#*\#}" nth() { echo -e "${2//#/\n}" | sed -n "$1 p" } cgi_begin "OpenVPN Clients" sec_begin '$(lang de:"Verbundene VPN-Clients" en:"Connected clients")' sec-connected echo "

$(lang de:"Laut Status-Datei sind folgende Clients verbunden:" en:"Status file entries of connected sessions:")

" c=1 for config in $(echo -e "$NAMES"); do if [ "yes" = "$(nth $c $LOG)" -a "server" = "$(nth $c $MODE)" -a -r /var/log/${config}.log ]; then [ $OPENVPN_CONFIG_COUNT -gt 1 ] && echo "$(lang de:"Konfiguration" en:"Configuration") ${config} " echo '' echo "" sed -n '/Since/,/ROUTING/ s%\(^[^\,]*\)\,\([0-9\.]*\)[^\,]*\,[0-9]*\,[0-9]*\,\(.*\)%% p' /var/log/${config}.log echo "
ClientnameIP$(lang de:"verbunden seit" en:"connected since")
\1\2\3
" echo "($(lang de:"Status von" en:"Status at"): $(sed -n 's/^Updated\,//p' /var/log/${config}.log ))

" fi let c++ done echo '

$(lang de:"Angezeigt nur für konfigurierte Server mit angewählter Option \"Statusprotokoll\"" en:"Shown only for server configurations with selected option \"Log status\"")

' sec_end cgi_end