From 01c82dbaa325336698b3c826ba0ba451b90eefe0 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 13 Apr 2015 10:24:44 +0200 Subject: [PATCH 1/6] core89: Create temporary files in update to avoid reboot --- config/rootfiles/core/89/update.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/rootfiles/core/89/update.sh b/config/rootfiles/core/89/update.sh index 832feaad6..404315488 100644 --- a/config/rootfiles/core/89/update.sh +++ b/config/rootfiles/core/89/update.sh @@ -72,6 +72,12 @@ rm -f \ /usr/sbin/ovpn-collectd-convert chown nobody.nobody /var/ipfire/ovpn/collectd.vpn +mkdir -p /var/run/openvpn +touch /var/run/ovpnserver.log +chown nobody.nobody \ + /var/run/openvpn \ + /var/run/ovpnserver.log + # Fix #10625 mkdir -p /etc/logrotate.d From 9aeac09636461df05f2423b65f7e0dc476eb0eb9 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 13 Apr 2015 10:49:14 +0200 Subject: [PATCH 2/6] core89: Fix permissions of /var/ipfire/dns --- config/rootfiles/core/89/update.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/rootfiles/core/89/update.sh b/config/rootfiles/core/89/update.sh index 404315488..435b45362 100644 --- a/config/rootfiles/core/89/update.sh +++ b/config/rootfiles/core/89/update.sh @@ -78,6 +78,9 @@ chown nobody.nobody \ /var/run/openvpn \ /var/run/ovpnserver.log +# Fix permissions +chown nobody.nobody /var/ipfire/dns + # Fix #10625 mkdir -p /etc/logrotate.d From 5c5b4000b9053d8bf993d5d0a87393f7540786c9 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 13 Apr 2015 10:57:09 +0200 Subject: [PATCH 3/6] vpn-stats: Show daily graph as *all* other graphs do, too --- html/cgi-bin/netovpnrw.cgi | 2 +- html/cgi-bin/netovpnsrv.cgi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/html/cgi-bin/netovpnrw.cgi b/html/cgi-bin/netovpnrw.cgi index e0b114884..fed6d4d03 100755 --- a/html/cgi-bin/netovpnrw.cgi +++ b/html/cgi-bin/netovpnrw.cgi @@ -59,7 +59,7 @@ if ( $querry[0] ne "" && $querry[0] ne "UNDEF"){ if(@vpns){ foreach (@vpns) { &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); - &Graphs::makegraphbox("netovpnrw.cgi",$_,"week"); + &Graphs::makegraphbox("netovpnrw.cgi",$_, "day"); &Header::closebox(); } }else{ diff --git a/html/cgi-bin/netovpnsrv.cgi b/html/cgi-bin/netovpnsrv.cgi index f843462db..ddf41771a 100755 --- a/html/cgi-bin/netovpnsrv.cgi +++ b/html/cgi-bin/netovpnsrv.cgi @@ -59,7 +59,7 @@ if ( $querry[0] ne ""){ if (@vpns){ foreach (@vpns) { &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); - &Graphs::makegraphbox("netovpnsrv.cgi",$_,"week"); + &Graphs::makegraphbox("netovpnsrv.cgi",$_, "day"); &Header::closebox(); } }else{ From 8d679040b7798330441c470ae361ec67db00b635 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 13 Apr 2015 11:39:08 +0200 Subject: [PATCH 4/6] core89: Move converter to the end because collectd should be restarted at last --- config/rootfiles/core/89/update.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/rootfiles/core/89/update.sh b/config/rootfiles/core/89/update.sh index 435b45362..bb6c7a544 100644 --- a/config/rootfiles/core/89/update.sh +++ b/config/rootfiles/core/89/update.sh @@ -68,16 +68,16 @@ rm -f \ /opt/pakfire/db/*/meta-sqlite \ /opt/pakfire/db/rootfiles/sqlite -# Update OpenVPN/collectd configuration -/usr/sbin/ovpn-collectd-convert -chown nobody.nobody /var/ipfire/ovpn/collectd.vpn - mkdir -p /var/run/openvpn touch /var/run/ovpnserver.log chown nobody.nobody \ /var/run/openvpn \ /var/run/ovpnserver.log +# Update OpenVPN/collectd configuration +/usr/sbin/ovpn-collectd-convert +chown nobody.nobody /var/ipfire/ovpn/collectd.vpn + # Fix permissions chown nobody.nobody /var/ipfire/dns From 18bbd71bdcc95b7f335061aa22e61c39df912e8c Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 13 Apr 2015 15:45:52 +0200 Subject: [PATCH 5/6] collectd: Ignore any errors if openvpn status files are missing --- .../collectd/silence-openvpn-errors.patch | 55 ++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/src/patches/collectd/silence-openvpn-errors.patch b/src/patches/collectd/silence-openvpn-errors.patch index c9097616c..c2584864a 100644 --- a/src/patches/collectd/silence-openvpn-errors.patch +++ b/src/patches/collectd/silence-openvpn-errors.patch @@ -1,8 +1,28 @@ diff --git a/src/openvpn.c b/src/openvpn.c -index d446e9957b68..cc33eed61e25 100644 +index d446e9957b68..ef5bf1078285 100644 --- a/src/openvpn.c +++ b/src/openvpn.c -@@ -567,7 +567,7 @@ static int openvpn_read (void) +@@ -70,6 +70,7 @@ static const char *config_keys[] = + }; + static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); + ++static int version_detect (const char *filename); + + /* Helper function + * copy-n-pasted from common.c - changed delim to "," */ +@@ -540,6 +541,11 @@ static int openvpn_read (void) + continue; + } + ++ // If the version was not detected yet, we try to guess again ++ if (vpn_list[i]->version == 0) { ++ vpn_list[i]->version = version_detect(vpn_list[i]->file); ++ } ++ + switch (vpn_list[i]->version) + { + case SINGLE: +@@ -567,7 +573,7 @@ static int openvpn_read (void) read += vpn_read; } @@ -11,3 +31,34 @@ index d446e9957b68..cc33eed61e25 100644 } /* int openvpn_read */ static int version_detect (const char *filename) +@@ -630,16 +636,6 @@ static int version_detect (const char *filename) + } + } + +- if (version == 0) +- { +- /* This is only reached during configuration, so complaining to +- * the user is in order. */ +- NOTICE ("openvpn plugin: %s: Unknown file format, please " +- "report this as bug. Make sure to include " +- "your status file, so the plugin can " +- "be adapted.", filename); +- } +- + fclose (fh); + + return version; +@@ -656,13 +652,6 @@ static int openvpn_config (const char *key, const char *value) + /* try to detect the status file format */ + status_version = version_detect (value); + +- if (status_version == 0) +- { +- WARNING ("openvpn plugin: unable to detect status version, \ +- discarding status file \"%s\".", value); +- return (1); +- } +- + status_file = sstrdup (value); + if (status_file == NULL) + { From daf34294f233a414cd14d08b1269b8192b591096 Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Mon, 13 Apr 2015 15:03:17 +0200 Subject: [PATCH 6/6] vpn-statistic: update old n2n configs in update.sh --- config/rootfiles/core/89/update.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/config/rootfiles/core/89/update.sh b/config/rootfiles/core/89/update.sh index bb6c7a544..90a6d776b 100644 --- a/config/rootfiles/core/89/update.sh +++ b/config/rootfiles/core/89/update.sh @@ -75,6 +75,18 @@ chown nobody.nobody \ /var/run/ovpnserver.log # Update OpenVPN/collectd configuration +files=`find /var/ipfire/ovpn/n2nconf/ -type d` +for i in $files; +do + if ! grep -q "status-version" $i/${i##*/}.conf; then + echo "# Logfile" >> $i/${i##*/}.conf + echo "status-version 1" >> $i/${i##*/}.conf + fi + if ! grep -q "status " $i/${i##*/}.conf; then + echo "status /var/run/openvpn/${i##*/}-n2n 10" >> $i/${i##*/}.conf + fi +done + /usr/sbin/ovpn-collectd-convert chown nobody.nobody /var/ipfire/ovpn/collectd.vpn