core89: Update OpenVPN configuration during the update

This commit is contained in:
Alexander Marx
2015-04-10 13:16:33 +02:00
committed by Michael Tremer
parent 82e454712b
commit 831a5ef6ad
4 changed files with 31 additions and 0 deletions

View File

@@ -124,6 +124,7 @@ usr/local/bin/update-lang-cache
#usr/local/src
#usr/sbin
usr/sbin/ovpn-ccd-convert
usr/sbin/ovpn-collectd-convert
#usr/share
#usr/share/doc
#usr/share/doc/licenses

View File

@@ -13,6 +13,7 @@ srv/web/ipfire/cgi-bin/ovpnmain.cgi
srv/web/ipfire/cgi-bin/vpnmain.cgi
usr/local/bin/collectdctrl
usr/local/bin/openvpnctrl
usr/sbin/ovpn-collectd-convert
usr/sbin/setup
var/ipfire/backup/bin/backup.pl
var/ipfire/graphs.pl

View File

@@ -66,6 +66,9 @@ rm -f \
/opt/pakfire/db/*/meta-sqlite \
/opt/pakfire/db/rootfiles/sqlite
# Update OpenVPN/collectd configuration
/usr/sbin/ovpn-collectd-convert
# Fix #10625
mkdir -p /etc/logrotate.d

View File

@@ -0,0 +1,26 @@
#!/usr/bin/perl
# Converter script for adding existing OpenVPN N2N connections to collectd
# Used for core update 89
my %ovpnconfig=();
require '/var/ipfire/general-functions.pl';
open(COLLECTDVPN, ">${General::swroot}/ovpn/collectd.vpn") or die "Unable to open collectd.vpn: $!";
print COLLECTDVPN "Loadplugin openvpn\n";
print COLLECTDVPN "\n";
print COLLECTDVPN "<Plugin openvpn>\n";
print COLLECTDVPN "Statusfile \"/var/run/ovpnserver.log\"\n";
&General::readhasharray("/var/ipfire/ovpn/ovpnconfig", \%ovpnconfig);
foreach my $key (keys %ovpnconfig) {
if ($ovpnconfig{$key}[0] eq 'on' && $ovpnconfig{$key}[3] eq 'net') {
print COLLECTDVPN "Statusfile \"/var/run/openvpn/$ovpnconfig{$key}[1]-n2n\"\n";
}
}
print COLLECTDVPN "</Plugin>\n";
close(COLLECTDVPN);
# Reload collectd afterwards
system("/usr/local/bin/collectdctrl restart &>/dev/null");