]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/netexternal.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2005-2010 IPFire Team #
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. #
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. #
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/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 #use CGI::Carp 'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl';
29 require "${General::swroot}/lang.pl";
30 require "${General::swroot}/header.pl";
31 require "${General::swroot}/graphs.pl";
34 my %mainsettings = ();
36 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
37 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
38 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
43 my @querry = split(/\?/,$ENV{'QUERY_STRING'});
44 $querry[0] = '' unless defined $querry[0];
45 $querry[1] = 'hour' unless defined $querry[1];
47 if ( $querry[0] ne~ ""){
48 print "Content-type: image/png\n\n";
50 &Graphs
::updateifgraph
($querry[0],$querry[1]);
53 &Header
::showhttpheaders
();
54 &Header
::openpage
($Lang::tr
{'network traffic graphs external'}, 1, '');
55 &Header
::openbigbox
('100%', 'left');
57 if ($netsettings{'RED_TYPE'} ne 'PPPOE'){
58 if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}){
59 push (@graphs, ($netsettings{'RED_DEV'}));
62 push (@graphs, "ppp0");
65 if (-e
"/var/log/rrd/collectd/localhost/interface/if_octets-ipsec0.rrd"){
66 push (@graphs, ("ipsec0"));
69 if (-e
"/var/log/rrd/collectd/localhost/interface/if_octets-tun0.rrd"){
70 push (@graphs, ("tun0"));
74 &Header
::openbox
('100%', 'center', "$_ $Lang::tr{'graph'}");
75 &Graphs
::makegraphbox
("netexternal.cgi",$_,"day");
81 foreach my $f ("${General::swroot}/red/dns1", "${General::swroot}/red/dns2") {
83 my $nameserver = <DNS
>;
88 push(@nameservers, $nameserver);
92 &Header
::openbox
('100%', 'center', $Lang::tr
{'dnssec information'});
95 <table class="tbl" width='66%'>
99 <strong>$Lang::tr{'nameserver'}</strong>
102 <strong>$Lang::tr{'status'}</strong>
110 for my $nameserver (@nameservers) {
111 my $status = &check_dnssec
($nameserver, "ping.ipfire.org");
117 # DNSSEC Not supported
119 $message = $Lang::tr
{'dnssec not supported'};
121 $bgcolour = ${Header
::colourred
};
124 } elsif ($status == 1) {
125 $message = $Lang::tr
{'dnssec aware'};
127 $bgcolour = ${Header
::colouryellow
};
130 } elsif ($status == 2) {
131 $message = $Lang::tr
{'dnssec validating'};
133 $bgcolour = ${Header
::colourgreen
};
137 $colour = ${Header
::colourred
};
140 my $table_colour = ($id++ % 2) ?
$color{'color22'} : $color{'color20'};
143 <tr bgcolor="$table_colour">
145 <td bgcolor="$bgcolour" align="center">
146 <font color="$colour"><strong>$message</strong></font>
159 if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} eq "DHCP"){
161 &Header
::openbox
('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
162 if (-s
"${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
164 &General
::readhash
("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \
%dhcpinfo);
166 my $DNS1=`echo $dhcpinfo{'domain_name_servers'} | cut -f 1 -d " "`;
167 my $DNS2=`echo $dhcpinfo{'domain_name_servers'} | cut -f 2 -d " "`;
171 if ($dhcpinfo{'dhcp_lease_time'} ne "") {
172 $lsetme=$dhcpinfo{'dhcp_lease_time'};
173 $lsetme=($lsetme/60);
176 $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
178 $leasetime=$lsetme." Minute";
182 $leasetime=$leasetime."s";
189 if ($dhcpinfo{'dhcp_renewal_time'} ne "") {
190 $rentme=$dhcpinfo{'dhcp_renewal_time'};
191 $rentme=($rentme/60);
194 $rentme=($rentme/60); $rnwltime=$rentme." Hour";
196 $rnwltime=$rentme." Minute";
200 $rnwltime=$rnwltime."s";
207 if ($dhcpinfo{'dhcp_rebinding_time'} ne "") {
208 $maxtme=$dhcpinfo{'dhcp_rebinding_time'};
209 $maxtme=($maxtme/60);
212 $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
214 $maxtime=$maxtme." Minute";
218 $maxtime=$maxtime."s";
225 <tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'domain_name'}</td></tr>
226 <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'routers'}</td></tr>
227 <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
228 <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
229 <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'dhcp_server_identifier'}</td></tr>
230 <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
231 <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
232 <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
237 print "$Lang::tr{'no dhcp lease'}";
242 &Header
::closebigbox
();
243 &Header
::closepage
();
246 sub check_dnssec
($$) {
247 my $nameserver = shift;
250 my @command = ("dig", "+dnssec", $record, "\@$nameserver");
252 my @output = qx(@command);
253 my $output = join("", @output);
256 if ($output =~ m/status: (\w+)/) {
257 $status = ($1 eq "NOERROR");
265 if ($output =~ m/flags: (.*);/) {
266 @flags = split(/ /, $1);
269 my $aware = ($output =~ m/RRSIG/);
270 my $validating = ("ad" ~~ @flags);
272 return $aware + $validating;