- | $Lang::tr{'fwdfw sourceip'} |
-
|
- | $Lang::tr{'fwhost stdnet'} | |
+
|
END
-
-# | $Lang::tr{'fwhost ipsec host'} |
-#END
-# foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
-# if ($ipsecconf{$key}[3] eq 'host'){
-# print "$ipsecconf{$key}[1]";
-# }
-# }
+ &gen_dd_block('src','grp1');
print<
|
+ |
END
&Header::closebox();
@@ -1217,118 +1581,44 @@ END
&Header::openbox('100%', 'left', $Lang::tr{'fwdfw target'});
print<
- | $Lang::tr{'fwdfw targetip'} | | IPFire ($Lang::tr{'external access'}) |
+ | $Lang::tr{'fwdfw targetip'} | | Firewall |
END
- print "Default IP";
-
- foreach my $alias (sort keys %aliases)
- {
- print "$alias";
- }
+ print"";
+ print "$Lang::tr{'all'}";
+ print "$Lang::tr{'green'} ($ifaces{'GREEN_ADDRESS'})" if $ifaces{'GREEN_ADDRESS'};
+ print "$Lang::tr{'orange'} ($ifaces{'ORANGE_ADDRESS'})" if $ifaces{'ORANGE_ADDRESS'};
+ print "$Lang::tr{'blue'} ($ifaces{'BLUE_ADDRESS'})" if $ifaces{'BLUE_ADDRESS'};
+ print "$Lang::tr{'red1'} ($ifaces{'RED_ADDRESS'})" if $ifaces{'RED_ADDRESS'};
- print< |
-
|
- | $Lang::tr{'fwhost stdnet'} |
-END
- foreach my $network (sort keys %defaultNetworks)
- {
- print "$network";
- }
- print< | | $Lang::tr{'fwhost ccdnet'} |
-END
- &fillselect(\%ccdnet,$fwdfwsettings{$fwdfwsettings{'grp2'}});
- print< |
- | $Lang::tr{'fwhost cust net'} |
-END
- &fillselect(\%customnetwork,$fwdfwsettings{$fwdfwsettings{'grp2'}});
- print< | | $Lang::tr{'fwhost ccdhost'} |
-END
- foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost)
- {
- if ($ccdhost{$key}[33] ne ''){
- print "$ccdhost{$key}[1]";
- }
- }
- print< |
- | $Lang::tr{'fwhost cust addr'} |
-END
- &fillselect(\%customhost,$fwdfwsettings{$fwdfwsettings{'grp2'}});
- print< | | $Lang::tr{'fwhost ovpn_n2n'} |
-END
- foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost) {
- if($ccdhost{$key}[3] eq 'net'){
- print "$ccdhost{$key}[1]";
- }
- }
- print< |
- | $Lang::tr{'fwhost cust grp'} |
-END
- $helper='';
- foreach my $key (sort { uc($customgrp{$a}[0]) cmp uc($customgrp{$b}[0]) } keys %customgrp) {
- if($helper ne $customgrp{$key}[0]){
- print"$customgrp{$key}[0]";
- }
- $helper=$customgrp{$key}[0];
- }
- print< |
- | $Lang::tr{'fwhost ipsec net'} |
-END
- foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
- if ($ipsecconf{$key}[3] eq 'net'){
- print"$ipsecconf{$key}[1]";
+ if (! -z "${General::swroot}/ethernet/aliases"){
+ foreach my $alias (sort keys %aliases)
+ {
+ print "$alias";
}
}
print< |
+ |
+
|
END
-# | $Lang::tr{'fwhost ipsec host'} |
-#END
-# foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
-# if ($ipsecconf{$key}[3] eq 'host'){
-# print"$ipsecconf{$key}[1]";
-# }
-# }
+ &gen_dd_block('tgt','grp2');
print<
- $Lang::tr{'fwhost attention'}:
- $Lang::tr{'fwhost macwarn'}
-
+
-
-END
+ print< |
+
+
+END
+ &Header::closebox;
+ #---SNAT / DNAT ------------------------------------------------
+ &Header::openbox('100%', 'left', 'NAT');
+ print<
+ | $Lang::tr{'fwdfw use nat'} | |
+ | | $Lang::tr{'fwdfw dnat'} |
+END
+ print"IPFire: | ";
+ print "$Lang::tr{'all'}";
+ print "Default IP";
+ foreach my $alias (sort keys %aliases)
+ {
+ print "$alias";
+ }
+ print" |
";
+ $fwdfwsettings{'dnatport'}=~ tr/|/,/;
+ print" | Port: | |
";
+ print"
|
";
+ #SNAT
+ print" | | $Lang::tr{'fwdfw snat'} | ";
+ print"IPFire: | ";
+ print "Default IP";
+ foreach my $alias (sort keys %aliases)
+ {
+ print "$alias";
+ }
+ foreach my $network (sort keys %defaultNetworks)
+ {
+ next if($defaultNetworks{$network}{'NAME'} eq "RED");
+ next if($defaultNetworks{$network}{'NAME'} eq "IPFire");
+ next if($defaultNetworks{$network}{'NAME'} eq "ALL");
+ next if($defaultNetworks{$network}{'NAME'} =~ /OpenVPN/i);
+ print "$network";
+ }
+ print"";
+ print" ";
+ &Header::closebox();
#---Activate/logging/remark-------------------------------------
&Header::openbox('100%', 'left', $Lang::tr{'fwdfw additional'});
print<
- $Lang::tr{'remark'}: | |
+ $Lang::tr{'fwdfw rule action'} |
END
+ foreach ("ACCEPT","DROP","REJECT")
+ {
+ if($fwdfwsettings{'updatefwrule'} eq 'on'){
+ print"$Lang::tr{'fwdfw '.$_}";
+ }else{
+ if($fwdfwsettings{'POLICY'} eq 'MODE2'){
+ $fwdfwsettings{'RULE_ACTION'} = 'DROP';
+ }
+ if ($_ eq $fwdfwsettings{'RULE_ACTION'})
+ {
+ print"$Lang::tr{'fwdfw '.$_}";
+ }else{
+ print"$Lang::tr{'fwdfw '.$_}";
+ }
+ }
+ }
+ print" | ";
+ print"$Lang::tr{'remark'}: | | ";
+ #print"$Lang::tr{'remark'}: | | ";
if($fwdfwsettings{'updatefwrule'} eq 'on' || $fwdfwsettings{'copyfwrule'} eq 'on'){
print "$Lang::tr{'fwdfw rulepos'}: | ";
for (my $count =1; $count <= $sum; $count++){
@@ -1390,7 +1741,7 @@ END
+
END
&Header::closebox();
#---ADD TIMEFRAME-----------------------------------------------
@@ -1440,9 +1791,8 @@ END
}
print< |
-
+
END
- &Header::closebox();
#---ACTION------------------------------------------------------
if($fwdfwsettings{'updatefwrule'} ne 'on'){
print<
+
+
+
|
END
}
&Header::closebox();
}
+sub pos_up
+{
+ my %uphash=();
+ my %tmp=();
+ &General::readhasharray($fwdfwsettings{'config'}, \%uphash);
+ foreach my $key (sort keys %uphash){
+ if ($key eq $fwdfwsettings{'key'}) {
+ my $last = $key -1;
+ if (exists $uphash{$last}){
+ #save rule last
+ foreach my $y (0 .. $#{$uphash{$last}}) {
+ $tmp{0}[$y] = $uphash{$last}[$y];
+ }
+ #copy active rule to last
+ foreach my $i (0 .. $#{$uphash{$last}}) {
+ $uphash{$last}[$i] = $uphash{$key}[$i];
+ }
+ #copy saved rule to actual position
+ foreach my $x (0 .. $#{$tmp{0}}) {
+ $uphash{$key}[$x] = $tmp{0}[$x];
+ }
+ }
+ }
+ }
+ &General::writehasharray($fwdfwsettings{'config'}, \%uphash);
+ &rules;
+}
+sub pos_down
+{
+ my %downhash=();
+ my %tmp=();
+ &General::readhasharray($fwdfwsettings{'config'}, \%downhash);
+ foreach my $key (sort keys %downhash){
+ if ($key eq $fwdfwsettings{'key'}) {
+ my $next = $key + 1;
+ if (exists $downhash{$next}){
+ #save rule next
+ foreach my $y (0 .. $#{$downhash{$next}}) {
+ $tmp{0}[$y] = $downhash{$next}[$y];
+ }
+ #copy active rule to next
+ foreach my $i (0 .. $#{$downhash{$next}}) {
+ $downhash{$next}[$i] = $downhash{$key}[$i];
+ }
+ #copy saved rule to actual position
+ foreach my $x (0 .. $#{$tmp{0}}) {
+ $downhash{$key}[$x] = $tmp{0}[$x];
+ }
+ }
+ }
+ }
+ &General::writehasharray($fwdfwsettings{'config'}, \%downhash);
+ &rules;
+}
+sub rules
+{
+ if (!-f "${General::swroot}/forward/reread"){
+ system("touch ${General::swroot}/forward/reread");
+ system("touch ${General::swroot}/fwhosts/reread");
+ }
+}
+sub reread_rules
+{
+ system("/usr/local/bin/forwardfwctrl");
+ if ( -f "${General::swroot}/forward/reread"){
+ system("rm ${General::swroot}/forward/reread");
+ system("rm ${General::swroot}/fwhosts/reread");
+ }
+}
sub saverule
{
my $hash=shift;
my $config=shift;
&General::readhasharray("$config", $hash);
if (!$errormessage){
+ ################################################################
+ #check if we change an INPUT rule to a OUTGOING
+ if($fwdfwsettings{'oldruletype'} eq 'INPUTFW' && $fwdfwsettings{'chain'} eq 'OUTGOINGFW' ){
+ &changerule($configinput);
+ #print"1";
+ }
+ #check if we change an INPUT rule to a FORWARD
+ elsif($fwdfwsettings{'oldruletype'} eq 'INPUTFW' && $fwdfwsettings{'chain'} eq 'FORWARDFW' ){
+ &changerule($configinput);
+ #print"2";
+ }
+ ################################################################
+ #check if we change an OUTGOING rule to an INPUT
+ elsif($fwdfwsettings{'oldruletype'} eq 'OUTGOINGFW' && $fwdfwsettings{'chain'} eq 'INPUTFW' ){
+ &changerule($configoutgoing);
+ #print"3";
+ }
+ #check if we change an OUTGOING rule to a FORWARD
+ elsif($fwdfwsettings{'oldruletype'} eq 'OUTGOINGFW' && $fwdfwsettings{'chain'} eq 'FORWARDFW' ){
+ &changerule($configoutgoing);
+ #print"4";
+ }
+ ################################################################
+ #check if we change a FORWARD rule to an INPUT
+ elsif($fwdfwsettings{'oldruletype'} eq 'FORWARDFW' && $fwdfwsettings{'chain'} eq 'INPUTFW'){
+ &changerule($configfwdfw);
+ #print"5";
+ }
+ #check if we change a FORWARD rule to an OUTGOING
+ elsif($fwdfwsettings{'oldruletype'} eq 'FORWARDFW' && $fwdfwsettings{'chain'} eq 'OUTGOINGFW'){
+ &changerule($configfwdfw);
+ #print"6";
+ }
if ($fwdfwsettings{'updatefwrule'} ne 'on'){
my $key = &General::findhasharraykey ($hash);
$$hash{$key}[0] = $fwdfwsettings{'RULE_ACTION'};
@@ -1509,6 +1964,10 @@ sub saverule
$$hash{$key}[25] = $fwdfwsettings{'TIME_SUN'};
$$hash{$key}[26] = $fwdfwsettings{'TIME_FROM'};
$$hash{$key}[27] = $fwdfwsettings{'TIME_TO'};
+ $$hash{$key}[28] = $fwdfwsettings{'USE_NAT'};
+ $$hash{$key}[29] = $fwdfwsettings{$fwdfwsettings{'nat'}};
+ $$hash{$key}[30] = $fwdfwsettings{'dnatport'};
+ $$hash{$key}[31] = $fwdfwsettings{'nat'};
&General::writehasharray("$config", $hash);
}else{
foreach my $key (sort {$a <=> $b} keys %$hash){
@@ -1541,12 +2000,16 @@ sub saverule
$$hash{$key}[25] = $fwdfwsettings{'TIME_SUN'};
$$hash{$key}[26] = $fwdfwsettings{'TIME_FROM'};
$$hash{$key}[27] = $fwdfwsettings{'TIME_TO'};
+ $$hash{$key}[28] = $fwdfwsettings{'USE_NAT'};
+ $$hash{$key}[29] = $fwdfwsettings{$fwdfwsettings{'nat'}};
+ $$hash{$key}[30] = $fwdfwsettings{'dnatport'};
+ $$hash{$key}[31] = $fwdfwsettings{'nat'};
last;
}
}
}
&General::writehasharray("$config", $hash);
- if($fwdfwsettings{'oldrulenumber'} gt $fwdfwsettings{'rulepos'}){
+ if($fwdfwsettings{'oldrulenumber'} > $fwdfwsettings{'rulepos'}){
my %tmp=();
my $val=$fwdfwsettings{'oldrulenumber'}-$fwdfwsettings{'rulepos'};
for (my $z=0;$z<$val;$z++){
@@ -1573,7 +2036,7 @@ sub saverule
}
&General::writehasharray("$config", $hash);
&rules;
- }elsif($fwdfwsettings{'rulepos'} gt $fwdfwsettings{'oldrulenumber'}){
+ }elsif($fwdfwsettings{'rulepos'} > $fwdfwsettings{'oldrulenumber'}){
my %tmp=();
my $val=$fwdfwsettings{'rulepos'}-$fwdfwsettings{'oldrulenumber'};
for (my $z=0;$z<$val;$z++){
@@ -1603,35 +2066,6 @@ sub saverule
}
}
}
-sub error
-{
- if ($errormessage) {
- &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
- print "$errormessage\n";
- print " \n";
- &Header::closebox();
- print"
";
- }
-}
-sub hint
-{
- if ($hint) {
- &Header::openbox('100%', 'left', $Lang::tr{'fwhost hint'});
- print "$hint\n";
- print " \n";
- &Header::closebox();
- print"
";
- }
-}
-sub get_name
-{
- my $val=shift;
- &General::setup_default_networks(\%defaultNetworks);
- foreach my $network (sort keys %defaultNetworks)
- {
- return "$network" if ($val eq $defaultNetworks{$network}{'NAME'});
- }
-}
sub validremark
{
# Checks a hostname against RFC1035
@@ -1642,92 +2076,22 @@ sub validremark
if (length ($remark) < 1 || length ($remark) > 255) {
return 0;}
# Only valid characters are a-z, A-Z, 0-9 and -
- if ($remark !~ /^[a-zäöüA-ZÃÃÃ0-9-.:_\/\s]*$/) {
+ if ($remark !~ /^[a-zäöüA-ZÃÃÃ0-9-.:;\|_()\/\s]*$/) {
return 0;}
# First character can only be a letter or a digit
if (substr ($remark, 0, 1) !~ /^[a-zäöüA-ZÃÃÃ0-9]*$/) {
return 0;}
# Last character can only be a letter or a digit
- if (substr ($remark, -1, 1) !~ /^[a-zöäüA-ZÃÃÃ0-9.]*$/) {
+ if (substr ($remark, -1, 1) !~ /^[a-zöäüA-ZÃÃÃ0-9.:;_)]*$/) {
return 0;}
return 1;
}
-sub getsrcport
-{
- my %hash=%{(shift)};
- my $key=shift;
- if($hash{$key}[7] eq 'ON' && $hash{$key}[8] ne '' && $hash{$key}[10]){
- $hash{$key}[10]=~ s/\|/,/g;
- print": $hash{$key}[10]";
- }elsif($hash{$key}[7] eq 'ON' && $hash{$key}[8] eq 'ICMP'){
- print":
$hash{$key}[9] ";
- }
-}
-sub gettgtport
-{
- my %hash=%{(shift)};
- my $key=shift;
- my $service;
- my $prot;
- if($hash{$key}[11] eq 'ON' && $hash{$key}[12] ne 'ICMP'){
- if($hash{$key}[14] eq 'cust_srv'){
- &General::readhasharray("$configsrv", \%customservice);
- foreach my $i (sort keys %customservice){
- if($customservice{$i}[0] eq $hash{$key}[15]){
- $service = $customservice{$i}[0];
- }
- }
- }elsif($hash{$key}[14] eq 'cust_srvgrp'){
- $service=$hash{$key}[15];
- }elsif($hash{$key}[14] eq 'TGT_PORT'){
- $hash{$key}[15]=~ s/\|/,/g;
- $service=$hash{$key}[15];
- }
- if($service){
- print": $service";
- }
- }elsif($hash{$key}[11] eq 'ON' && $hash{$key}[12] eq 'ICMP'){
- print":
$hash{$key}[13]";
- }
-}
-sub get_serviceports
-{
- my $type=shift;
- my $name=shift;
- &General::readhasharray("$configsrv", \%customservice);
- &General::readhasharray("$configsrvgrp", \%customservicegrp);
- my $protocols;
- my $tcp;
- my $udp;
- if($type eq 'service'){
- foreach my $key (sort { uc($customservice{$a}[0]) cmp uc($customservice{$b}[0]) } keys %customservice){
- if ($customservice{$key}[0] eq $name){
- $protocols=$customservice{$key}[2];
- }
- }
- }elsif($type eq 'group'){
- foreach my $key (sort { uc($customservicegrp{$a}[0]) cmp uc($customservicegrp{$b}[0]) } keys %customservicegrp){
- if ($customservicegrp{$key}[0] eq $name){
- foreach my $key1 (sort { uc($customservice{$a}[0]) cmp uc($customservice{$b}[0]) } keys %customservice){
- if ($customservice{$key1}[0] eq $customservicegrp{$key}[2]){
- if($customservice{$key1}[2] eq 'TCP'){$tcp='TCP';}else{$udp='UDP';}
- }
- }
- }
- }
- }
- if($tcp && $udp){$protocols="TCP,UDP";
- }elsif($tcp){$protocols.="TCP";
- }elsif($udp){$protocols.="UDP";}
- return $protocols;
-}
sub viewtablerule
{
-
- &viewtablenew(\%configfwdfw,$configfwdfw,$Lang::tr{'fwdfw rules'},"Forward" );
- &viewtablenew(\%configfwdfw,$configfwdfw,'',"DMZ" );
- &viewtablenew(\%configfwdfw,$configfwdfw,'',"WLAN" );
- &viewtablenew(\%configinputfw,$configinput,"",$Lang::tr{'external access'} );
+ &General::readhash("/var/ipfire/ethernet/settings", \%netsettings);
+ &viewtablenew(\%configfwdfw,$configfwdfw,"","Forward" );
+ &viewtablenew(\%configinputfw,$configinput,"",$Lang::tr{'fwdfw xt access'} );
+ &viewtablenew(\%configoutgoingfw,$configoutgoing,"","Outgoing" );
}
sub viewtablenew
{
@@ -1736,24 +2100,12 @@ sub viewtablenew
my $title=shift;
my $title1=shift;
my $go='';
+ &General::get_aliases(\%aliases);
+ &General::readhasharray("$confighost", \%customhost);
&General::readhasharray("$config", $hash);
- #check if there are DMZ entries
- if ($title1 eq 'DMZ'){
- foreach my $key (keys %$hash){
- if ($$hash{$key}[4] eq 'ORANGE'){$go='on';last}
- }
- }elsif($title1 eq 'WLAN'){
- foreach my $key (keys %$hash){
- if ($$hash{$key}[4] eq 'BLUE'){$go='on';last}
- }
- }elsif($title1 eq 'Forward'){
- foreach my $key (keys %$hash){
- if (($$hash{$key}[4] ne 'ORANGE' && $$hash{$key}[4] ne 'BLUE')){$go='on';last}
- }
- }elsif( ! -z $config){
- $go='on';
- }
- if($go ne ''){
+ &General::readhasharray("$configccdnet", \%ccdnet);
+ &General::readhasharray("$configccdhost", \%ccdhost);
+ if( ! -z $config){
&Header::openbox('100%', 'left',$title);
my $count=0;
my ($gif,$log);
@@ -1763,13 +2115,10 @@ sub viewtablenew
my @tmpsrc=();
my $coloryellow='';
print"$title1
";
- print"";
- print"# | | $Lang::tr{'fwdfw source'} | Log | $Lang::tr{'fwdfw target'} | $Lang::tr{'protocol'} | $Lang::tr{'remark'} | $Lang::tr{'fwdfw action'} |
";
+ print"";
+ print"# | | | $Lang::tr{'fwdfw source'} | Log | $Lang::tr{'fwdfw target'} | $Lang::tr{'fwdfw action'} |
";
foreach my $key (sort {$a <=> $b} keys %$hash){
- #check if we have a FORWARDFW OR DMZ RULE
- if ($title1 eq 'DMZ' && ($$hash{$key}[4] ne 'ORANGE')){next;}
- if ($title1 eq 'WLAN' && ($$hash{$key}[4] ne 'BLUE')){next;}
- if ($title1 eq 'Forward' && ($$hash{$key}[4] eq 'ORANGE' || $$hash{$key}[4] eq 'BLUE')){next;}
+ $tdcolor='';
@tmpsrc=();
#check if vpn hosts/nets have been deleted
if($$hash{$key}[3] =~ /ipsec/i || $$hash{$key}[3] =~ /ovpn/i){
@@ -1804,8 +2153,6 @@ sub viewtablenew
$$hash{$key}[2]='';
}
}
- $$hash{$key}[3]='';
- $$hash{$key}[5]='';
}
$$hash{'ACTIVE'}=$$hash{$key}[2];
$count++;
@@ -1814,15 +2161,18 @@ sub viewtablenew
$coloryellow='';
}elsif($coloryellow eq ''){
if ($count % 2){
- print"";
+ $color="$color{'color22'}";
}
else{
- print"
";
+ $color="$color{'color20'}";
}
}
+ print"
";
+ #KEY
print<$key
+ $key   |
END
+ #RULETYPE (A,R,D)
if ($$hash{$key}[0] eq 'ACCEPT'){
$ruletype='A';
$tooltip='ACCEPT';
@@ -1836,56 +2186,108 @@ END
$tooltip='REJECT';
$rulecolor=$color{'color16'};
}
- print"$ruletype | ";
- print"";
+ print" | $ruletype | ";
+ #Get Protocol
+ my $prot;
+ if ($$hash{$key}[8] && $$hash{$key}[7] eq 'ON'){#source prot if manual
+ push (@protocols,$$hash{$key}[8]);
+ }elsif ($$hash{$key}[12]){ #target prot if manual
+ push (@protocols,$$hash{$key}[12]);
+ }elsif($$hash{$key}[14] eq 'cust_srv'){
+ &get_serviceports("service",$$hash{$key}[15]);
+ }elsif($$hash{$key}[14] eq 'cust_srvgrp'){
+ &get_serviceports("group",$$hash{$key}[15]);
+ }else{
+ push (@protocols,$Lang::tr{'all'});
+ }
+ my $protz=join(",",@protocols);
+ print"$protz | ";
+ @protocols=();
+ #SOURCE
+ my $ipfireiface;
+ &getcolor($$hash{$key}[3],$$hash{$key}[4],\%customhost);
+ print"";
+ if ($$hash{$key}[3] eq 'ipfire_src'){
+ $ipfireiface='Interface ';
+ }
if ($$hash{$key}[3] eq 'std_net_src'){
print &get_name($$hash{$key}[4]);
+ }elsif ($$hash{$key}[3] eq 'src_addr'){
+ my ($split1,$split2) = split("/",$$hash{$key}[4]);
+ if ($split2 eq '32'){
+ print $split1;
+ }else{
+ print $$hash{$key}[4];
+ }
+ }elsif ($$hash{$key}[4] eq 'RED1'){
+ print "$ipfireiface $Lang::tr{'fwdfw red'}";
}else{
- print $$hash{$key}[4];
+ print "ipfireiface $$hash{$key}[4]";
}
+ $tdcolor='';
+ #SOURCEPORT
&getsrcport(\%$hash,$key);
+ #Is this a SNAT rule?
+ if ($$hash{$key}[31] eq 'snat' && $$hash{$key}[28] eq 'ON'){
+ print" ->$$hash{$key}[29]";
+ if ($$hash{$key}[30] ne ''){
+ print": $$hash{$key}[30]";
+ }
+ }
if ($$hash{$key}[17] eq 'ON'){
$log="/images/on.gif";
}else{
$log="/images/off.gif";
}
+ #LOGGING
print<
END
+ #TARGET
+ &getcolor($$hash{$key}[5],$$hash{$key}[6],\%customhost);
print<
+
END
- if ($$hash{$key}[5] eq 'std_net_tgt'){
- print &get_name($$hash{$key}[6]);
+ #Is this a DNAT rule?
+ if ($$hash{$key}[31] eq 'dnat' && $$hash{$key}[28] eq 'ON'){
+ print "Firewall ($$hash{$key}[29])";
+ if($$hash{$key}[30] ne ''){
+ $$hash{$key}[30]=~ tr/|/,/;
+ print": $$hash{$key}[30]";
+ }
+ print" ->";
+ }
+ if ($$hash{$key}[5] eq 'ipfire'){
+ $ipfireiface='Interface';
+ }
+ if ($$hash{$key}[5] eq 'std_net_tgt' || $$hash{$key}[5] eq 'ipfire' && $$hash{$key}[6] eq 'RED' || $$hash{$key}[6] eq 'RED1' || $$hash{$key}[6] eq 'GREEN' || $$hash{$key}[6] eq 'ORANGE' || $$hash{$key}[6] eq 'BLUE' ){
+ if ($$hash{$key}[6] eq 'RED1')
+ {
+ print "$ipfireiface $Lang::tr{'red1'}";
+ }else{
+ print &get_name($$hash{$key}[6]);
+ }
+ }elsif ($$hash{$key}[5] eq 'tgt_addr'){
+ my ($split1,$split2) = split("/",$$hash{$key}[6]);
+ if ($split2 eq '32'){
+ print $split1;
+ }else{
+ print $$hash{$key}[6];
+ }
}else{
- print $$hash{$key}[6];
+ print "$ipfireiface $$hash{$key}[6]";
}
+ $tdcolor='';
+ #TARGETPORT
&gettgtport(\%$hash,$key);
- ################################################################################
print" | ";
- #Get Protocol
- my $prot;
- if ($$hash{$key}[12]){ #target prot if manual
- $prot=$$hash{$key}[12];
- }elsif($$hash{$key}[8]){ #source prot if manual
- $prot=$$hash{$key}[8];
- }elsif($$hash{$key}[14] eq 'cust_srv'){
- $prot=&get_serviceports("service",$$hash{$key}[15]);
- }elsif($$hash{$key}[14] eq 'cust_srvgrp'){
- $prot=&get_serviceports("group",$$hash{$key}[15]);
- }else{
- $prot=$Lang::tr{'all'};
- }
- print"$prot | ";
-
- print"$$hash{$key}[16] | ";
-
+ #RULE ACTIVE
if($$hash{$key}[2] eq 'ON'){
$gif="/images/on.gif"
@@ -1894,25 +2296,25 @@ END
}
print<
-
+ |
|
|
END
}else{
- print" | ";
+ print" | ";
+ }
+ #REMARK
+ if ($optionsfw{'SHOWREMARK'} eq 'on' && $$hash{$key}[16] ne ''){
+ print"";
+ print"  | |   $$hash{$key}[16] |
";
}
- #if timeframe set, print new line in table
if ($$hash{$key}[18] eq 'ON'){
- my @days=();
- if($$hash{$key}[19] ne ''){push (@days,$Lang::tr{'fwdfw wd_mon'});}
- if($$hash{$key}[20] ne ''){push (@days,$Lang::tr{'fwdfw wd_tue'});}
- if($$hash{$key}[21] ne ''){push (@days,$Lang::tr{'fwdfw wd_wed'});}
- if($$hash{$key}[22] ne ''){push (@days,$Lang::tr{'fwdfw wd_thu'});}
- if($$hash{$key}[23] ne ''){push (@days,$Lang::tr{'fwdfw wd_fri'});}
- if($$hash{$key}[24] ne ''){push (@days,$Lang::tr{'fwdfw wd_sat'});}
- if($$hash{$key}[25] ne ''){push (@days,$Lang::tr{'fwdfw wd_sun'});}
- my $weekdays=join(",",@days);
- if (@days){
- print"$Lang::tr{'fwdfw time'} ";
- print"$weekdays";
- print "  $Lang::tr{'fwdfw from'} $$hash{$key}[26]   $Lang::tr{'fwdfw till'} $$hash{$key}[27] | |
";
+ #TIMEFRAME
+ if ($$hash{$key}[18] eq 'ON'){
+ my @days=();
+ if($$hash{$key}[19] ne ''){push (@days,$Lang::tr{'fwdfw wd_mon'});}
+ if($$hash{$key}[20] ne ''){push (@days,$Lang::tr{'fwdfw wd_tue'});}
+ if($$hash{$key}[21] ne ''){push (@days,$Lang::tr{'fwdfw wd_wed'});}
+ if($$hash{$key}[22] ne ''){push (@days,$Lang::tr{'fwdfw wd_thu'});}
+ if($$hash{$key}[23] ne ''){push (@days,$Lang::tr{'fwdfw wd_fri'});}
+ if($$hash{$key}[24] ne ''){push (@days,$Lang::tr{'fwdfw wd_sat'});}
+ if($$hash{$key}[25] ne ''){push (@days,$Lang::tr{'fwdfw wd_sun'});}
+ my $weekdays=join(",",@days);
+ if (@days){
+ print"";
+ print"  | |   $weekdays   $$hash{$key}[26] - $$hash{$key}[27] |
";
+ }
}
}
+ print" |
";
}
- print"
";
- &Header::closebox();
- }
-}
-sub p2pblock
-{
- my $gif;
- open( FILE, "< $p2pfile" ) or die "Unable to read $p2pfile";
- @p2ps = ;
- close FILE;
- &Header::openbox('100%', 'center', 'P2P-Block');
- print <
- $Lang::tr{'protocol'} | $Lang::tr{'status'} |
-END
- foreach my $p2pentry (sort @p2ps)
- {
- my @p2pline = split( /\;/, $p2pentry );
- if($p2pline[2] eq 'on'){
- $gif="/images/on.gif"
+ my $col;
+ if ($config eq '/var/ipfire/forward/config'){
+ my $pol='fwdfw '.$fwdfwsettings{'POLICY'};
+ if ($fwdfwsettings{'POLICY'} eq 'MODE1'){
+ $col="bgcolor='darkred'";
+ }else{
+ $col="bgcolor='green'";
+ }
+ print"$Lang::tr{'fwdfw final_rule'} $Lang::tr{$pol} |
";
+ }elsif ($config eq '/var/ipfire/forward/outgoing'){
+ my $pol='fwdfw '.$fwdfwsettings{'POLICY1'};
+ if ($fwdfwsettings{'POLICY1'} eq 'MODE1'){
+ $col="bgcolor='darkred'";
+ }else{
+ $col="bgcolor='green'";
+ }
+ print"$Lang::tr{'fwdfw final_rule'} $Lang::tr{$pol} |
";
}else{
- $gif="/images/off.gif"
+ print"$Lang::tr{'fwdfw final_rule'} $Lang::tr{'fwdfw MODE1'} |
";
}
- print <
-
- $p2pline[0]: | |
-END
- }
- print" | $Lang::tr{'outgoing firewall p2p allow'} |
";
- print" | $Lang::tr{'outgoing firewall p2p deny'} |
";
- &Header::closebox();
-}
-sub fillselect
-{
- my %hash=%{(shift)};
- my $val=shift;
- my $key;
- foreach my $key (sort { uc($hash{$a}[0]) cmp uc($hash{$b}[0]) } keys %hash){
- if($hash{$key}[0] eq $val){
- print"$hash{$key}[0]";
- }else{
- print"$hash{$key}[0]";
+ print"";
+ print "
";
+ print "
";
+ &Header::closebox();
+ }else{
+ if ($optionsfw{'SHOWTABLES'} eq 'on'){
+ print "$title1
";
+ print"$Lang::tr{'fwhost empty'} |
";
+ my $col;
+ if ($config eq '/var/ipfire/forward/config'){
+ my $pol='fwdfw '.$fwdfwsettings{'POLICY'};
+ if ($fwdfwsettings{'POLICY'} eq 'MODE1'){
+ $col="bgcolor='darkred'";
+ }else{
+ $col="bgcolor='green'";
+ }
+ print"$Lang::tr{'fwdfw final_rule'} $Lang::tr{$pol} |
";
+ }elsif ($config eq '/var/ipfire/forward/outgoing'){
+ my $pol='fwdfw '.$fwdfwsettings{'POLICY1'};
+ if ($fwdfwsettings{'POLICY1'} eq 'MODE1'){
+ $col="bgcolor='darkred'";
+ }else{
+ $col="bgcolor='green'";
+ }
+ print"$Lang::tr{'fwdfw final_rule'} $Lang::tr{$pol} |
";
+ }else{
+ print"$Lang::tr{'fwdfw final_rule'} $Lang::tr{'fwdfw MODE1'} |
";
+ }
+ print"
";
}
}
}
-sub rules
-{
- if (!-f "${General::swroot}/forward/reread"){
- system("touch ${General::swroot}/forward/reread");
- }
-}
-sub reread_rules
-{
- system("/usr/local/bin/forwardfwctrl");
- if ( -f "${General::swroot}/forward/reread"){
- system("rm ${General::swroot}/forward/reread");
- }
-}
&Header::closebigbox();
&Header::closepage();