Commit 5c1c56b5 authored by David Kempe's avatar David Kempe
Browse files

Set status-version 2 as the default setting for new installs

Make status fuction check for status-version 2 and fallback/warn if it isn't used
Matt
parent 8aad4545
......@@ -191,6 +191,7 @@ persist-key
persist-tun
status /var/lib/openvpn-server/openvpn/status.log
status-version 2
verb 1
mute 5
......
......@@ -146,7 +146,7 @@ function create_Html_Status() {
}
function echo_status() {
function Echo_Status() {
grep CLIENT_LIST "$status_log" | head -n1 | sed -e "s/HEADER,//g" | awk -F "," '{printf "%-20s %-18s %-18s %-25s %14s %12s Routes\n",$2,$3,$4,$7,$5,$6}'
......@@ -155,8 +155,12 @@ function echo_status() {
routes=$(grep ^ROUTING_TABLE "$status_log" | grep "$client" | awk -F "," '{printf "%s|",$2}')
echo "$row,${routes::-1}" | awk -F "," '{printf "%-20s %-18s %-18s %-25s %11.0f MB %9.0f MB %2s\n",$2,$3,$4,$7,$5/1024/1024,$6/1024/1024,$10}'
done
echo " "
Bandwidth
}
function Bandwidth() {
# TODO: This needs fixing to show interface, ip, mac and send/recieve amounts
ifconfig tun0
......@@ -164,6 +168,7 @@ function echo_status() {
ifstat -i tun0 1 4
}
script_name="$0"
. /etc/openvpn-server/config.sh
......@@ -171,16 +176,27 @@ script_name="$0"
status_log=`grep "status " /etc/openvpn/$OVPN_ORGNICK-server.conf |cut -f2 -d ' '`
connection_type=""
case $1 in
--help)
Usage
;;
--html|--connect|--disconnect)
connection_type=`echo "$1" | sed "s/-//g"`
Create_Html_Status
;;
*)
echo_status
;;
esac
if grep -q "status-version 2" "/etc/openvpn/$OVPN_ORGNICK-server.conf" ; then
case $1 in
--help)
Usage
;;
--html|--connect|--disconnect)
connection_type=`echo "$1" | sed "s/-//g"`
Create_Html_Status
;;
*)
Echo_Status
;;
esac
else
echo "INFO: Add the line 'status-version 2' to /etc/openvpn/$OVPN_ORGNICK-server.conf for fancy or html output"
echo " "
cat $status_log
echo " "
Bandwidth
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment