- | $Lang::tr{'fwdfw sourceip'} |
-
|
- | $Lang::tr{'fwhost stdnet'} | | | $Lang::tr{'fwhost ccdnet'} | |
- | $Lang::tr{'fwhost cust net'} | | | $Lang::tr{'fwhost ccdhost'} | |
- | $Lang::tr{'fwhost cust addr'} | | | $Lang::tr{'fwhost ovpn_n2n'} | |
+
|
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();
-
- #---TARGET------------------------------------------------------
- &Header::openbox('100%', 'left', $Lang::tr{'fwdfw target'});
- print<
- | $Lang::tr{'fwdfw targetip'} | | IPFire ($Lang::tr{'external access'}) |
-END
- print "Default IP";
-
- foreach my $alias (sort keys %aliases)
- {
- print "$alias";
- }
-
- 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]";
+ }else{
+ print"$_";
}
}
+ $fwdfwsettings{'SRC_PORT'}=~ s/\|/,/g;
print< |
- | $Lang::tr{'fwhost cust addr'} |
-END
- &fillselect(\%customhost,$fwdfwsettings{$fwdfwsettings{'grp2'}});
- print< | | $Lang::tr{'fwhost ovpn_n2n'} |
+ | |
+ | | | | $Lang::tr{'fwhost icmptype'} |
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]";
+ &General::readhasharray("${General::swroot}/fwhosts/icmp-types", \%icmptypes);
+ print"All ICMP-Types";
+ foreach my $key (sort { ncmp($icmptypes{$a}[0],$icmptypes{$b}[0]) } keys %icmptypes){
+ if($fwdfwsettings{'ICMP_TYPES'} eq "$icmptypes{$key}[0]"){
+ print"$icmptypes{$key}[0] ($icmptypes{$key}[1])";
+ }else{
+ print"$icmptypes{$key}[0] ($icmptypes{$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];
- }
+ &Header::closebox();
+
+ #---TARGET------------------------------------------------------
+ &Header::openbox('100%', 'left', $Lang::tr{'fwdfw target'});
print< |
- | $Lang::tr{'fwhost ipsec net'} |
+
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
+ &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++){
@@ -1368,13 +1733,15 @@ END
print">$count";
}
print" | ";
+ }else{
+ print "$Lang::tr{'fwdfw rulepos'}: | | ";
}
print<
+
END
&Header::closebox();
#---ADD TIMEFRAME-----------------------------------------------
@@ -1424,16 +1791,16 @@ END
}
print< |
-
+
END
- &Header::closebox();
#---ACTION------------------------------------------------------
if($fwdfwsettings{'updatefwrule'} ne 'on'){
print<
- |
+
+
END
}else{
@@ -1450,18 +1817,123 @@ END
+
+
+
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'};
@@ -1492,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){
@@ -1524,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++){
@@ -1556,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++){
@@ -1586,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
@@ -1625,67 +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] eq 'TCP' || $hash{$key}[8] eq 'UDP')){
- $hash{$key}[10]=~ s/\|/,/g;
- print" : ($hash{$key}[8]) $hash{$key}[10]";
- }elsif($hash{$key}[7] eq 'ON' && $hash{$key}[8] eq 'ICMP'){
- print" : ($hash{$key}[8]) $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]){
- $prot = $hash{$key}[12];
- $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];
- $prot=$hash{$key}[12];
- }
- }elsif($hash{$key}[11] eq 'ON' && $hash{$key}[12] eq 'ICMP'){
- print" : ($hash{$key}[12]) $hash{$key}[13]";
- }
-
- if ($prot ne '' || $service ne ''){
- print" :";
- if ($prot ne ''){
- print"($prot) ";
- }
- print" $service";
- }
-}
sub viewtablerule
{
- &viewtablenew(\%configfwdfw,$configfwdfw,$Lang::tr{'fwdfw rules'},"Forward" );
- &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
{
@@ -1693,8 +2099,13 @@ sub viewtablenew
my $config=shift;
my $title=shift;
my $title1=shift;
-
- if ( ! -z "$config"){
+ my $go='';
+ &General::get_aliases(\%aliases);
+ &General::readhasharray("$confighost", \%customhost);
+ &General::readhasharray("$config", $hash);
+ &General::readhasharray("$configccdnet", \%ccdnet);
+ &General::readhasharray("$configccdhost", \%ccdhost);
+ if( ! -z $config){
&Header::openbox('100%', 'left',$title);
my $count=0;
my ($gif,$log);
@@ -1703,11 +2114,11 @@ sub viewtablenew
my $tooltip;
my @tmpsrc=();
my $coloryellow='';
- &General::readhasharray("$config", $hash);
print"$title1 ";
- print"";
- print"# | | $Lang::tr{'fwdfw source'} | Log | $Lang::tr{'fwdfw target'} | $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){
+ $tdcolor='';
@tmpsrc=();
#check if vpn hosts/nets have been deleted
if($$hash{$key}[3] =~ /ipsec/i || $$hash{$key}[3] =~ /ovpn/i){
@@ -1742,8 +2153,6 @@ sub viewtablenew
$$hash{$key}[2]='';
}
}
- $$hash{$key}[3]='';
- $$hash{$key}[5]='';
}
$$hash{'ACTIVE'}=$$hash{$key}[2];
$count++;
@@ -1752,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';
@@ -1774,41 +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" | $$hash{$key}[16] | ";
-
+ print" | ";
+ #RULE ACTIVE
if($$hash{$key}[2] eq 'ON'){
$gif="/images/on.gif"
@@ -1817,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 deny'} | | ";
- print" | $Lang::tr{'outgoing firewall p2p allow'} | | ";
- &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");
- system("rm ${General::swroot}/forward/reread");
-}
&Header::closebigbox();
&Header::closepage();
| |