]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/index.cgi
suricata: Change midstream policy to "pass-flow"
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / index.cgi
index 7c1746259d34bf653f86bd0033d801bfe3d09e09..5e32ce038196058e735e32e44ad65e4461316552 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2014  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2023  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # 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        #
@@ -70,11 +70,11 @@ $pppsettings{'PROFILENAME'} = 'None';
 my %color = ();
 my %mainsettings = ();
 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
-&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
 
 my $connstate = &Header::connectionstatus();
 
-if ( -e "/var/ipfire/main/gpl-accepted" ) {
+if ( -e "/var/ipfire/main/gpl_accepted" ) {
        if ($connstate =~ /$Lang::tr{'connecting'}/ || /$Lang::tr{'connection closed'}/ ){
                $refresh = "<meta http-equiv='refresh' content='5;'>";
        }elsif ($connstate =~ /$Lang::tr{'dod waiting'}/ || -e "${General::swroot}/main/refreshindex") {
@@ -113,15 +113,15 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'dial profile'})
        chmod 0600, "${General::swroot}/ppp/secrets";
        close FILE;
 
-       &General::log("$Lang::tr{'profile made current'} $tempcgiparams{'PROFILENAME'}"); 
+       &General::log("$Lang::tr{'profile made current'} $tempcgiparams{'PROFILENAME'}");
        $cgiparams{'ACTION'} = "$Lang::tr{'dial'}";
 }
 
 if ($cgiparams{'ACTION'} eq $Lang::tr{'dial'}) {
-       system('/usr/local/bin/redctrl start > /dev/null') == 0
+       &General::system('/usr/local/bin/redctrl', 'start') == 0
        or &General::log("Dial failed: $?"); sleep 1;
 }elsif ($cgiparams{'ACTION'} eq $Lang::tr{'hangup'}) {
-       system('/usr/local/bin/redctrl stop > /dev/null') == 0
+       &General::system('/usr/local/bin/redctrl', 'stop') == 0
        or &General::log("Hangup failed: $?"); sleep 1;
 }
 
@@ -138,7 +138,7 @@ for ($c = 1; $c <= $maxprofiles; $c++)
 }
 my %selected;
 for ($c = 1; $c <= $maxprofiles; $c++) {
-       $selected{'PROFILE'}{$c} = ''; 
+       $selected{'PROFILE'}{$c} = '';
 }
 $selected{'PROFILE'}{$pppsettings{'PROFILE'}} = "selected='selected'";
 my $dialButtonDisabled = "disabled='disabled'";
@@ -173,9 +173,9 @@ print <<END;
 <!-- Table of networks -->
 <table class='tbl' style='width:80%;'>
   <tr>
-        <th style='background-color:$color{'color20'};'>$Lang::tr{'network'}</th>
-        <th style='background-color:$color{'color20'};'>$Lang::tr{'ip address'}</th>
-        <th style='background-color:$color{'color20'};'>$Lang::tr{'status'}</th>
+        <th>$Lang::tr{'network'}</th>
+        <th>$Lang::tr{'ip address'}</th>
+        <th>$Lang::tr{'status'}</th>
   </tr>
   <tr>
         <td style='width:25%; text-align:center; background-color:$Header::colourred;'><a href='/cgi-bin/pppsetup.cgi' style='color:white;'><b>$Lang::tr{'internet'}</b></a><br/></td>
@@ -200,24 +200,46 @@ END
 END
        }
 
-       my $dns_servers;
-       if ( -e "${General::swroot}/red/dns" ) {
-               open (TMP, "<${General::swroot}/red/dns");
-               $dns_servers = <TMP>;
-               chomp($dns_servers);
-               close TMP;
+       if (&General::RedIsWireless()) {
+               my $iface = $netsettings{"RED_DEV"} || "red0";
+
+               my $essid        = &Network::wifi_get_essid($iface);
+               my $frequency    = &Network::wifi_get_frequency($iface);
+               my $access_point = &Network::wifi_get_access_point($iface);
+               my $bit_rate     = &Network::wifi_get_bit_rate($iface);
+               my $link_quality = &Network::wifi_get_link_quality($iface);
+               my $signal_level = &Network::wifi_get_signal_level($iface);
+
+               print <<END;
+                       <tr>
+                               <td>
+                                       <strong>$Lang::tr{'wireless network'}:</strong>
+                               </td>
+                               <td style="text-align: center">
+                                       $essid
+                               </td>
+                               <td style="text-align: center">
+                                       $access_point @ $frequency
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>
+                                       <strong>
+                                               $Lang::tr{'uplink bit rate'}:
+                                       </strong>
+                               </td>
+                               <td style="text-align: center">
+                                       $bit_rate
+                               </td>
+                               <td style="text-align: center">
+                                       $link_quality% @ $signal_level
+                               </td>
+                       </tr>
+END
        }
+
        print <<END;
-               <tr>
-                       <td>
-                               <b>$Lang::tr{'dns servers'}:</b>
-                       </td>
-                       <td style='text-align:center;'>
-                               $dns_servers
-                       </td>
-                       <td></td>
-               </tr>
-       </table>
+               </table>
 END
 
 #Dial profiles
@@ -326,13 +348,12 @@ END
        }
 #check if IPSEC is running
 if ( $vpnsettings{'ENABLED'} eq 'on' || $vpnsettings{'ENABLED_BLUE'} eq 'on' ) {
-       my $ipsecip = $vpnsettings{'VPN_IP'};
 print<<END;
                <tr>
                        <td style='width:25%; text-align:center; background-color:$Header::colourvpn;'>
                                <a href='/cgi-bin/vpnmain.cgi' style='color:white'><b>$Lang::tr{'ipsec'}</b></a>
                        </td>
-                       <td style='width:30%; text-align:center;'>$ipsecip</td>
+                       <td style='width:30%; text-align:center;'></td>
                        <td style='width:45%; text-align:center; color:$Header::colourgreen;'>Online</td>
                </tr>
 END
@@ -403,9 +424,16 @@ END
                foreach my $key (sort { uc($vpnconfig{$a}[1]) cmp uc($vpnconfig{$b}[1]) } keys %vpnconfig) {
                        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";
+
+                               my @n = ();
+
+                               my @networks = split(/\|/, $vpnconfig{$key}[11]);
+                               foreach my $network (@networks) {
+                                       my ($vpnip, $vpnsub) = split("/", $network);
+                                       $vpnsub = &Network::convert_netmask2prefix($vpnsub) || $vpnsub;
+                                       push(@n, "$vpnip/$vpnsub");
+                               }
+
                                if ($count % 2){
                                        $col = $color{'color22'};
                                }else{
@@ -413,10 +441,14 @@ END
                                }
                                print "<tr>";
                                print "<td style='text-align:left; color:white; background-color:$Header::colourvpn;'>$vpnconfig{$key}[1]</td>";
-                               print "<td style='text-align:center; background-color:$col'>$vpnip</td>";
+                               print "<td style='text-align:center; background-color:$col'>" . join("<br>", @n) . "</td>";
 
                                my $activecolor = $Header::colourred;
                                my $activestatus = $Lang::tr{'capsclosed'};
+                               if ($vpnconfig{$key}[33] eq "add") {
+                                       $activecolor = ${Header::colourorange};
+                                       $activestatus = $Lang::tr{'vpn wait'};
+                               }
                                if ($vpnconfig{$key}[0] eq 'off') {
                                        $activecolor = $Header::colourblue;
                                        $activestatus = $Lang::tr{'capsclosed'};
@@ -425,6 +457,10 @@ END
                                                if (($line =~ /\"$vpnconfig{$key}[1]\".*IPsec SA established/) || ($line =~/$vpnconfig{$key}[1]\{.*INSTALLED/ )){
                                                        $activecolor = $Header::colourgreen;
                                                        $activestatus = $Lang::tr{'capsopen'};
+                                                       last;
+                                               } elsif ($line =~ /$vpnconfig{$key}[1]\[.*CONNECTING/) {
+                                                       $activecolor = $Header::colourorange;
+                                                       $activestatus = $Lang::tr{'vpn connecting'};
                                                } elsif ($line =~ /$vpnconfig{$key}[1]\{.*ROUTED/) {
                                                        $activecolor = $Header::colourorange;
                                                        $activestatus = $Lang::tr{'vpn on-demand'};
@@ -500,16 +536,17 @@ END
 &Header::closebox();
 }
 
-my $dnssec_status = &General::dnssec_status();
-if ($dnssec_status eq "off") {
-       $warnmessage .= "<li>$Lang::tr{'dnssec disabled warning'}</li>";
-}
-
 # Fireinfo
 if ( ! -e "/var/ipfire/main/send_profile") {
        $warnmessage .= "<li><a style='color: white;' href='fireinfo.cgi'>$Lang::tr{'fireinfo please enable'}</a></li>";
 }
 
+# EOL architecture
+my ($sysname, $nodename, $release, $version, $machine) = &POSIX::uname();
+if ($machine =~ m/^arm/) {
+       $warnmessage .= "<li><a href='https://wiki.ipfire.org/hardware/requirements' style='color:white;'>$Lang::tr{'eol architecture warning'}</a></li>";
+}
+
 # Memory usage warning
 my @free = `/usr/bin/free`;
 $free[1] =~ m/(\d+)/;
@@ -527,6 +564,7 @@ my $temp2=();
 my @df = `/bin/df -B M -P -x rootfs`;
 foreach my $line (@df) {
        next if $line =~ m/^Filesystem/;
+       next if $line =~ m/^efivarfs/;
        if ($line =~ m/root/ ) {
                $line =~ m/^.* (\d+)M.*$/;
                @temp = split(/ +/,$line);
@@ -535,7 +573,7 @@ foreach my $line (@df) {
                        # and root size should not vary during time
                        $warnmessage .= "<li>$Lang::tr{'filesystem full'}: $temp[0] <b>$Lang::tr{'free'}=$1M</b> !</li>";
                }
-               
+
        } else {
                # $line =~ m/^.* (\d+)m.*$/;
                $line =~ m/^.* (\d+)\%.*$/;
@@ -558,13 +596,6 @@ foreach my $file (@files) {
        }
 }
 
-# Reiser4 warning
-my @files = `mount | grep " reiser4 (" 2>/dev/null`;
-foreach my $disk (@files) {
-       chomp ($disk);
-       $warnmessage .= "<li>$disk - $Lang::tr{'deprecated fs warn'}</li>";
-}
-
 if ($warnmessage) {
        &Header::openbox('100%','center', );
        print "<table class='tbl' style='width:80%;'>";
@@ -574,13 +605,24 @@ if ($warnmessage) {
        &Header::closebox();
 }
 
-&Pakfire::dblist("upgrade", "notice");
+my %coredb = &Pakfire::coredbinfo();
+if (defined $coredb{'AvailableRelease'}) {
+       print "<br /><br /><br /><a href='pakfire.cgi'>$Lang::tr{'core notice 1'} $coredb{'Release'} $Lang::tr{'core notice 2'} $coredb{'AvailableRelease'} $Lang::tr{'core notice 3'}</a>";
+}
+
 if ( -e "/var/run/need_reboot" ) {
        print "<div style='text-align:center; color:red;'>";
        print "<br/><br/>$Lang::tr{'needreboot'}!";
        print "</div>";
 }
 
+if ( `/bin/grep -c "reiserfs" /proc/self/mounts`  > 0 ) {
+        print "<div style='text-align:center; color:blue;'>";
+        print "<br/><br/>$Lang::tr{'reiserfs warning1'}";
+        print "<br/>$Lang::tr{'reiserfs warning2'}";
+        print "</div>";
+}
+
 &Header::closebigbox();
 &Header::closepage();