Forward Firewall: added "default-rules-table" at the end of forward ruletable
authorAlexander Marx <amarx@ipfire.org>
Thu, 4 Jul 2013 10:19:50 +0000 (12:19 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Aug 2013 12:15:31 +0000 (14:15 +0200)
config/forwardfw/firewall-policy
config/forwardfw/rules.pl
html/cgi-bin/forwardfw.cgi

index 459c1a554e09519fdba98fca3cbe792f69a871bf..e142f2d3f44fc998aeca9eb50fb627b382f2ab81 100755 (executable)
@@ -30,8 +30,7 @@ else
        if [  "$BLUE_DEV" ] && [ "$IFACE" ]; then
                /sbin/iptables -A POLICYFWD -i blue0 ! -o $IFACE -j DROP 
        fi
-       /sbin/iptables -A POLICYFWD -s "$ORANGE_NETADDRESS"/"$ORANGE_NETMASK" -d "$BLUE_NETADDRESS"/"$BLUE_NETMASK" -j DROP
-       /sbin/iptables -A POLICYFWD -s "$ORANGE_NETADDRESS"/"$ORANGE_NETMASK" -d "$GREEN_NETADDRESS"/"$GREEN_NETMASK" -j DROP
+       /sbin/iptables -A POLICYFWD -i orange0 ! -o $IFACE -j DROP
        /sbin/iptables -A POLICYFWD -j ACCEPT 
        /sbin/iptables -A POLICYFWD -m comment --comment "DROP_FORWARD" -j DROP
 fi
index d62cca0d77dcb6f47a1d32206f3b5f0b54886a12..82b5dd61e5d3ad0249adcfd0dbc9ad9b9b0c7b2b 100755 (executable)
@@ -140,9 +140,6 @@ sub preparerules
        if (! -z  "${General::swroot}/forward/outgoing"){
                &buildrules(\%configoutgoingfw);
        }
-       if (! -z  "${General::swroot}/forward/nat"){
-               &buildrules(\%confignatfw);
-       }
 }
 sub buildrules
 {
index 57e187581e817e6e2f322403beafd4d6380c551a..692580c71e27abadc6c3c5e14f3688450f46ae9f 100755 (executable)
@@ -74,7 +74,7 @@ my %aliases=();
 my %optionsfw=();
 my %ifaces=();
 
-my $VERSION='0.9.9.9';
+my $VERSION='0.9.9.10';
 my $color;
 my $confignet          = "${General::swroot}/fwhosts/customnetworks";
 my $confighost         = "${General::swroot}/fwhosts/customhosts";
@@ -2372,6 +2372,8 @@ END
                        }
                        print"<tr bgcolor='FFFFFF'><td colspan='13' height='1'></td></tr>";
                }
+               print"</table>";
+               print "<table width='100%'rules='cols' border='1'>";
                my $col;
                if ($config eq '/var/ipfire/forward/config'){
                        my $pol='fwdfw '.$fwdfwsettings{'POLICY'};
@@ -2380,7 +2382,7 @@ END
                        }else{
                                $col="bgcolor='green'";
                        }
-                       print"<tr><td colspan='13' $col align='center'><font color='#FFFFFF'>$Lang::tr{'fwdfw final_rule'} $Lang::tr{$pol}</font></td></tr>";
+                       &show_default_rules($col,$pol);
                }elsif ($config eq '/var/ipfire/forward/outgoing'){
                        my $pol='fwdfw '.$fwdfwsettings{'POLICY1'};
                        if ($fwdfwsettings{'POLICY1'} eq 'MODE1'){
@@ -2388,9 +2390,9 @@ END
                        }else{
                                $col="bgcolor='green'";
                        }
-                       print"<tr><td colspan='13' $col align='center'><font color='#FFFFFF'>$Lang::tr{'fwdfw final_rule'} $Lang::tr{$pol}</font></td></tr>";
+                       print"<tr><td $col width='20%'><font color='#FFFFFF'>$Lang::tr{'fwdfw final_rule'}</td><td $col><font color='#FFFFFF'>$Lang::tr{$pol}</font></td></tr>";
                }else{
-                       print"<tr><td colspan='13' bgcolor='darkred' align='center'><font color='#FFFFFF'>$Lang::tr{'fwdfw final_rule'} $Lang::tr{'fwdfw MODE1'}</font></td></tr>";
+                       print"<tr><td bgcolor='darkred' width='20%'><font color='#FFFFFF'>$Lang::tr{'fwdfw final_rule'}</td><td bgcolor='darkred'><font color='#FFFFFF'>$Lang::tr{'fwdfw MODE1'}</font></td></tr>";
                }
                print"</table>";
                print "<hr>";
@@ -2408,7 +2410,7 @@ END
                                }else{
                                        $col="bgcolor='green'";
                                }
-                               print"<tr><td colspan='13' $col align='center'><font color='#FFFFFF'>$Lang::tr{'fwdfw final_rule'} $Lang::tr{$pol}</font></td></tr>";
+                               &show_defaultrules($col,$pol);
                        }elsif ($config eq '/var/ipfire/forward/outgoing'){
                                my $pol='fwdfw '.$fwdfwsettings{'POLICY1'};
                                if ($fwdfwsettings{'POLICY1'} eq 'MODE1'){
@@ -2426,3 +2428,21 @@ END
 }
 &Header::closebigbox();
 &Header::closepage();
+
+sub show_defaultrules
+{
+       my $col=shift;
+       my $pol=shift;
+       #STANDARD RULES (From WIKI)
+                       print"</table>";
+                       print "<table width='100%'rules='cols' border='1'>";
+                       if ($col eq "bgcolor='green'"){
+                               my $blue   = ", <font color=$Header::colourblue>    $Lang::tr{'blue'}</font> ($Lang::tr{'fwdfw pol block'})" if $ifaces{'BLUE_DEV'};
+                               my $orange = ", <font color=$Header::colourorange>  $Lang::tr{'orange'}</font> ($Lang::tr{'fwdfw pol block'})" if $ifaces{'ORANGE_DEV'};
+                               print"<tr><td align='center' width='20%'><font color='#000000'>$Lang::tr{'orange'}</td><td><font color=$Header::colourgreen>  $Lang::tr{'green'}</font> ($Lang::tr{'fwdfw pol block'}), <font color=$Header::colourred>  $Lang::tr{'red'}</font> ($Lang::tr{'fwdfw pol allow'})$blue</td></tr>";
+                               print"<tr><td align='center'><font color='#000000'>$Lang::tr{'blue'}</td><td><font color=$Header::colourgreen>  $Lang::tr{'green'}</font> ($Lang::tr{'fwdfw pol block'}), <font color=$Header::colourred>  $Lang::tr{'red'}</font> ($Lang::tr{'fwdfw pol allow'})$orange</td></tr>" if $ifaces{'BLUE_DEV'};
+                               print"<tr><td $col align='center'><font color='#FFFFFF'>$Lang::tr{'fwdfw final_rule'} </font></td><td $col><font color='#FFFFFF'>$Lang::tr{$pol}</font></td></tr>";
+                       }elsif($col eq "bgcolor='darkred'"){
+                               print"<tr><td $col width='20%'><font color='#FFFFFF'>$Lang::tr{'fwdfw final_rule'}</td><td $col><font color='#FFFFFF'>$Lang::tr{$pol}</font></td></tr>";
+                       }
+}