]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - html/cgi-bin/netovpnsrv.cgi
suricata: Change midstream policy to "pass-flow"
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / netovpnsrv.cgi
CommitLineData
5795fc1b
AM
1#!/usr/bin/perl
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2014 Alexnder Marx #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21
22use strict;
23
24# enable only the following on debugging purpose
25#use warnings;
26#use CGI::Carp 'fatalsToBrowser';
27
28require '/var/ipfire/general-functions.pl';
29require "${General::swroot}/lang.pl";
30require "${General::swroot}/header.pl";
31require "${General::swroot}/graphs.pl";
32
33my %color = ();
34my %mainsettings = ();
35&General::readhash("${General::swroot}/main/settings", \%mainsettings);
8186b372 36&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
5795fc1b 37
1e2b2577
MT
38my %vpnsettings = ();
39&General::readhasharray("${General::swroot}/vpn/config", \%vpnsettings);
40
5795fc1b
AM
41my @vpns=();
42
1e2b2577
MT
43# Make list of all IPsec graphs
44my %ipsecgraphs = ();
45foreach my $key (sort {$vpnsettings{$a}[1] <=> $vpnsettings{$b}[1]} keys %vpnsettings) {
46 my $interface_mode = $vpnsettings{$key}[36];
47 next unless ($interface_mode);
48
49 $ipsecgraphs{$vpnsettings{$key}[1]} = "${interface_mode}${key}";
50}
51
4190b2a6
LAH
52&Header::showhttpheaders();
53&Header::openpage($Lang::tr{'vpn statistic n2n'}, 1, '');
54&Header::openbigbox('100%', 'left');
5795fc1b 55
4190b2a6
LAH
56my @vpngraphs = `find /var/log/rrd/collectd/localhost/openvpn-*-n2n/ -not -path *openvpn-UNDEF* -name *traffic.rrd 2>/dev/null|sort`;
57foreach (@vpngraphs){
58 if($_ =~ /(.*)\/openvpn-(.*)\/if_octets_derive-traffic.rrd/){
59 push(@vpns,$2);
60 }
61}
62if (@vpns || %ipsecgraphs) {
63 foreach my $name (sort keys %ipsecgraphs) {
64 &Header::openbox('100%', 'center', "$Lang::tr{'ipsec connection'}: $name");
65 &Graphs::makegraphbox("netovpnsrv.cgi", "ipsec-$ipsecgraphs{$name}", "day");
66 &Header::closebox();
5795fc1b 67 }
1e2b2577 68
4190b2a6
LAH
69 foreach (@vpns) {
70 &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}");
71 &Graphs::makegraphbox("netovpnsrv.cgi",$_, "day");
72 &Header::closebox();
5795fc1b 73 }
4190b2a6
LAH
74}else{
75 print "<center>".$Lang::tr{'no data'}."</center>";
76}
77my $output = '';
5795fc1b 78
4190b2a6
LAH
79&Header::closebigbox();
80&Header::closepage();