X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Findex.cgi;h=53adeacce8c9d852a99fc79629157eb53531b0a7;hb=8e23b35195bd004c64bb83b45d4358488a2dc67e;hp=a497607f174d0fad9352afc8bd7b731a5127d77e;hpb=36d44213e93fadcd3fac982f14bacc61f4ce977d;p=ipfire-2.x.git diff --git a/html/cgi-bin/index.cgi b/html/cgi-bin/index.cgi index a497607f17..53adeacce8 100644 --- a/html/cgi-bin/index.cgi +++ b/html/cgi-bin/index.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2012 IPFire Team # +# Copyright (C) 2007-2014 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -158,6 +158,11 @@ if ( ( $pppsettings{'VALID'} eq 'yes' && $modemsettings{'VALID'} eq 'yes' ) || ( close IPADDR; chomp ($ipaddr); } + if (open(IPADDR,"${General::swroot}/red/local-ipaddress")) { + $ipaddr = ; + close IPADDR; + chomp ($ipaddr); + } } elsif ($modemsettings{'VALID'} eq 'no') { print "$Lang::tr{'modem settings have errors'}\n \n"; } else { @@ -166,18 +171,22 @@ if ( ( $pppsettings{'VALID'} eq 'yes' && $modemsettings{'VALID'} eq 'yes' ) || ( print < - - - - - - - +
$Lang::tr{'network'}$Lang::tr{'ip address'}$Lang::tr{'status'}
$Lang::tr{'internet'}
$ipaddr $connstate
+ + + + + + + + + + END my $HOSTNAME = (gethostbyaddr(pack("C4", split(/\./, $ipaddr)), 2))[0]; if ( "$HOSTNAME" ne "" ) { print < + END } @@ -187,120 +196,151 @@ END chomp($GATEWAY); close TMP; print < + END } - #Read DNS server 1 - open (DNS1, "<${General::swroot}/red/dns1"); - my $DNS1 = ; - chomp($DNS1); - close DNS1; - #Read DNS server 2 - open (DNS2, "<${General::swroot}/red/dns2"); - my $DNS2 = ; - chomp($DNS2); - close DNS2; + + my @dns_servers = (); + foreach my $f ("${General::swroot}/red/dns1", "${General::swroot}/red/dns2") { + open(DNS, "<$f"); + my $dns_server = ; + close(DNS); + + chomp($dns_server); + if ($dns_server) { + push(@dns_servers, $dns_server); + } + } + my $dns_servers_str = join(", ", @dns_servers); print < - - +
$Lang::tr{'network'}$Lang::tr{'ip address'}$Lang::tr{'status'}
$Lang::tr{'internet'}
$ipaddr $connstate
Hostname:$HOSTNAME
$Lang::tr{'hostname'}:$HOSTNAMEGateway:$GATEWAY
$Lang::tr{'gateway'}:$GATEWAY
- $Lang::tr{'dns server'} - - $DNS1 + $Lang::tr{'dns servers'}: - $DNS2 + + $dns_servers_str
END #Dial profiles if ( $netsettings{'RED_TYPE'} ne "STATIC" && $netsettings{'RED_TYPE'} ne "DHCP" ){ -print `/usr/local/bin/dialctrl.pl show`; -print < - + if ( ( $pppsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) ) { + print < +
+ + +
$Lang::tr{'profile'}: -
-
- - -
- -
-
- -
-
+ + + +
+ + + + + +
+
+ +
+
+
+ +
+
+
END } else { - print "$Lang::tr{'profile has errors'}\n \n"; + print "
$Lang::tr{'profile has errors'}
"; } - print""; } - if ( $netsettings{'GREEN_DEV'} ) { + + +print < + + + + + + +END + +if ( $netsettings{'GREEN_DEV'} ) { my $sub=&General::iporsubtocidr($netsettings{'GREEN_NETMASK'}); print < -
$Lang::tr{'network'}$Lang::tr{'ip address'}$Lang::tr{'status'}
- - - - - + + '; + print ''; } - if ( $netsettings{'BLUE_DEV'} ) { +if ( $netsettings{'BLUE_DEV'} ) { my $sub=&General::iporsubtocidr($netsettings{'BLUE_NETMASK'}); print < + + '; + print ''; } - if ( $netsettings{'ORANGE_DEV'} ) { +if ( $netsettings{'ORANGE_DEV'} ) { my $sub=&General::iporsubtocidr($netsettings{'ORANGE_NETMASK'}); print < + + + + END } #check if IPSEC is running if ( $vpnsettings{'ENABLED'} eq 'on' || $vpnsettings{'ENABLED_BLUE'} eq 'on' ) { my $ipsecip = $vpnsettings{'VPN_IP'}; print< + + + + END } @@ -316,20 +356,21 @@ if (($confighash{'ENABLED'} eq "on") || $ovpnip="$ovpnip/$sub"; print < - - + + END } -print"
$Lang::tr{'network'}$Lang::tr{'ip address'}$Lang::tr{'status'}
$Lang::tr{'lan'} - $netsettings{'GREEN_ADDRESS'}/$sub - + + $Lang::tr{'lan'} + $netsettings{'GREEN_ADDRESS'}/$sub END if ( $proxysettings{'ENABLE'} eq 'on' ) { print $Lang::tr{'advproxy on'}; if ( $proxysettings{'TRANSPARENT'} eq 'on' ) { print " (transparent)"; } } else { print $Lang::tr{'advproxy off'}; } + print '
$Lang::tr{'wireless'}
-
$netsettings{'BLUE_ADDRESS'}/$sub - +
+ $Lang::tr{'wireless'} + $netsettings{'BLUE_ADDRESS'}/$sub + END if ( $proxysettings{'ENABLE_BLUE'} eq 'on' ) { print $Lang::tr{'advproxy on'}; if ( $proxysettings{'TRANSPARENT_BLUE'} eq 'on' ) { print " (transparent)"; } } else { print $Lang::tr{'advproxy off'}; } + print '
$Lang::tr{'dmz'}
-
$netsettings{'ORANGE_ADDRESS'}/$sub - Online +
+ $Lang::tr{'dmz'} + $netsettings{'ORANGE_ADDRESS'}/$subOnline
$Lang::tr{'ipsec'}
-
$ipsecip - Online +
+ $Lang::tr{'ipsec'} + $ipsecipOnline
- OpenVPN
+
+ OpenVPN $ovpnip - Online + $ovpnipOnline
"; +print""; &Header::closebox(); #Check if there are any vpns configured (ipsec and openvpn) &General::readhasharray("${General::swroot}/vpn/config", \%vpnconfig); foreach my $key (sort { ncmp($vpnconfig{$a}[1],$vpnconfig{$b}[1]) } keys %vpnconfig) { - if ($vpnconfig{$key}[0] eq 'on'){ + if ($vpnconfig{$key}[0] eq 'on' && $vpnconfig{$key}[3] ne 'host'){ $showipsec=1; $showbox=1; last; @@ -347,7 +388,8 @@ foreach my $dkey (sort { ncmp($ovpnconfig{$a}[1],$ovpnconfig{$b}[1])} keys %ovpn if ($showbox){ # Start of Box wich contains all vpn connections &Header::openbox('100%', 'center', $Lang::tr{'vpn'}); -#show ipsec connectiontable + + #show ipsec connectiontable if ( $showipsec ) { my $ipsecip = $vpnsettings{'VPN_IP'}; my @status = `/usr/local/bin/ipsecctrl I`; @@ -357,58 +399,57 @@ if ($showbox){ my $col=""; my $count=0; print < - +
- - - + + + END foreach my $key (sort { uc($vpnconfig{$a}[1]) cmp uc($vpnconfig{$b}[1]) } keys %vpnconfig) { - if ($vpnconfig{$key}[0] eq 'on') { + if ($vpnconfig{$key}[0] eq 'on' && $vpnconfig{$key}[3] ne 'host') { $count++; my ($vpnip,$vpnsub) = split("/",$vpnconfig{$key}[11]); $vpnsub=&General::iporsubtocidr($vpnsub); $vpnip="$vpnip/$vpnsub"; if ($count % 2){ - $col="bgcolor='$color{'color22'}'"; + $col = $color{'color22'}; }else{ - $col="bgcolor='$color{'color20'}'"; - } - if ($id % 2) { - print ""; - } else { - print ""; + $col = $color{'color20'}; } - my $active = ""; + print ""; + print ""; + print ""; + + my $activecolor = $Header::colourred; + my $activestatus = $Lang::tr{'capsclosed'}; if ($vpnconfig{$key}[0] eq 'off') { - $active = ""; + $activecolor = $Header::colourblue; + $activestatus = $Lang::tr{'capsclosed'}; } else { foreach my $line (@status) { if (($line =~ /\"$vpnconfig{$key}[1]\".*IPsec SA established/) || ($line =~/$vpnconfig{$key}[1]\{.*INSTALLED/ )){ - $active = ""; + $activecolor = $Header::colourgreen; + $activestatus = $Lang::tr{'capsopen'}; } } } - print "$active"; + print ""; + print ""; } } - print "
$Lang::tr{'ipsec network'}$Lang::tr{'ip address'}$Lang::tr{'status'}$Lang::tr{'ipsec network'}$Lang::tr{'ip address'}$Lang::tr{'status'}
$vpnconfig{$key}[1]$vpnip
$vpnconfig{$key}[1]$vpnip$Lang::tr{'capsclosed'}
$vpnconfig{$key}[1]$vpnip$Lang::tr{'capsclosed'}$Lang::tr{'capsopen'}$activestatus
"; + print ""; } -### -# Check if there is any OpenVPN connection configured. -### - + # Check if there is any OpenVPN connection configured. if ( $showovpn ){ print < - +
+
- - - + + + END # Check if the OpenVPN server for Road Warrior Connections is running and display status information. @@ -435,9 +476,9 @@ END $display = $tustate[1]; } if ($count %2){ - $col="bgcolor='$color{'color22'}'"; + $col = $color{'color22'}; }else{ - $col="bgcolor='$color{'color20'}'"; + $col = $color{'color20'}; } $active='off'; #make cidr from ip @@ -446,16 +487,16 @@ END my $vpnip="$vpnip/$vpnsub"; print < - - - + + + END } } } if ($active ne 'off'){ - print ""; + print ""; } print"
$Lang::tr{'openvpn network'}$Lang::tr{'ip address'}$Lang::tr{'status'}$Lang::tr{'openvpn network'}$Lang::tr{'ip address'}$Lang::tr{'status'}$ovpnconfig{$dkey}[1]$vpnip$display$ovpnconfig{$dkey}[1]$vpnip$display
$Lang::tr{'ovpn no connections'}
$Lang::tr{'ovpn no connections'}
"; } @@ -475,7 +516,7 @@ $free[2] =~ m/(\d+)/; my $used = $1; my $pct = int 100 * ($mem - $used) / $mem; if ($used / $mem > 90) { - $warnmessage .= "
  • $Lang::tr{'high memory usage'}: $pct% !
  • \n"; + $warnmessage .= "
  • $Lang::tr{'high memory usage'}: $pct% !
  • "; } # Diskspace usage warning @@ -490,7 +531,7 @@ foreach my $line (@df) { if ($1<5) { # available:plain value in MB, and not %used as 10% is too much to waste on small disk # and root size should not vary during time - $warnmessage .= "
  • $Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$1M !
  • \n"; + $warnmessage .= "
  • $Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$1M !
  • "; } } else { @@ -499,7 +540,7 @@ foreach my $line (@df) { if ($1>90) { @temp = split(/ /,$line); $temp2=int(100-$1); - $warnmessage .= "
  • $Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$temp2% !
  • \n"; + $warnmessage .= "
  • $Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$temp2% !
  • "; } } } @@ -511,7 +552,7 @@ foreach my $file (@files) { my $disk=`echo $file | cut -d"-" -f2`; chomp ($disk); if (`/bin/grep "SAVE ALL DATA" $file`) { - $warnmessage .= "
  • $Lang::tr{'smartwarn1'} /dev/$disk $Lang::tr{'smartwarn2'} !
  • \n\n"; + $warnmessage .= "
  • $Lang::tr{'smartwarn1'} /dev/$disk $Lang::tr{'smartwarn2'} !
  • "; } } @@ -519,24 +560,25 @@ foreach my $file (@files) { my @files = `mount | grep " reiser4 (" 2>/dev/null`; foreach my $disk (@files) { chomp ($disk); - $warnmessage .= "
  • $disk - $Lang::tr{'deprecated fs warn'}
  • \n\n"; + $warnmessage .= "
  • $disk - $Lang::tr{'deprecated fs warn'}
  • "; } if ($warnmessage) { &Header::openbox('100%','center', ); - print ""; + print "
    "; print ""; - print "
    $Lang::tr{'fwhost hint'}
    $warnmessage
    "; + print "$warnmessage"; + print ""; &Header::closebox(); } -print "
    "; &Pakfire::dblist("upgrade", "notice"); if ( -e "/var/run/need_reboot" ) { - print "

    $Lang::tr{'needreboot'}!"; + print "
    "; + print "

    $Lang::tr{'needreboot'}!"; + print "
    "; } -print "
    "; - &Header::closebigbox(); &Header::closepage(); +