]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/forwardfw.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 # Hi folks! I hope this code is useful for all. I needed something to handle #
23 # my VPN Connections in a comfortable way. As a prerequisite i needed #
24 # something that makes sure the vpn roadwarrior are able to have a fixed #
25 # ip-address. So i developed the ccd extension for the vpn server. #
27 # Now that the ccd extension is ready i am able to develop the main request. #
28 # Any feedback is appreciated. #
31 ###############################################################################
34 no warnings
'uninitialized';
35 # enable only the following on debugging purpose
37 #use CGI::Carp 'fatalsToBrowser';
39 require '/var/ipfire/general-functions.pl';
40 require "${General::swroot}/lang.pl";
41 require "${General::swroot}/header.pl";
42 require "${General::swroot}/forward/bin/firewall-lib.pl";
44 unless (-d
"${General::swroot}/forward") { system("mkdir ${General::swroot}/forward"); }
45 unless (-e
"${General::swroot}/forward/settings") { system("touch ${General::swroot}/forward/settings"); }
46 unless (-e
"${General::swroot}/forward/config") { system("touch ${General::swroot}/forward/config"); }
47 unless (-e
"${General::swroot}/forward/input") { system("touch ${General::swroot}/forward/input"); }
48 unless (-e
"${General::swroot}/forward/outgoing") { system("touch ${General::swroot}/forward/outgoing"); }
52 my %defaultNetworks=();
56 my %customnetworks=();
58 my %customservicegrp=();
64 my %configoutgoingfw=();
76 my $confignet = "${General::swroot}/fwhosts/customnetworks";
77 my $confighost = "${General::swroot}/fwhosts/customhosts";
78 my $configgrp = "${General::swroot}/fwhosts/customgroups";
79 my $configsrv = "${General::swroot}/fwhosts/customservices";
80 my $configsrvgrp = "${General::swroot}/fwhosts/customservicegrp";
81 my $configccdnet = "${General::swroot}/ovpn/ccd.conf";
82 my $configccdhost = "${General::swroot}/ovpn/ovpnconfig";
83 my $configipsec = "${General::swroot}/vpn/config";
84 my $configipsecrw = "${General::swroot}/vpn/settings";
85 my $configfwdfw = "${General::swroot}/forward/config";
86 my $configinput = "${General::swroot}/forward/input";
87 my $configoutgoing = "${General::swroot}/forward/outgoing";
88 my $configovpn = "${General::swroot}/ovpn/settings";
89 my $p2pfile = "${General::swroot}/forward/p2protocols";
92 my $ipgrp="${General::swroot}/outgoing/groups";
95 &General
::readhash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
96 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
97 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
99 &Header
::showhttpheaders
();
100 &Header
::getcgihash
(\
%fwdfwsettings);
101 &Header
::openpage
($Lang::tr
{'fwdfw menu'}, 1, '');
102 &Header
::openbigbox
('100%', 'center',$errormessage);
105 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'save'})
107 my $MODE = $fwdfwsettings{'POLICY'};
109 $fwdfwsettings{'POLICY'} = "$MODE";
110 &General
::writehash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
113 if ($fwdfwsettings{'ACTION'} eq 'saverule')
115 &General
::readhasharray
("$configfwdfw", \
%configfwdfw);
116 &General
::readhasharray
("$configinput", \
%configinputfw);
117 &General
::readhasharray
("$configinput", \
%configoutgoingfw);
118 $errormessage=&checksource
;
119 if(!$errormessage){&checktarget
;}
120 if(!$errormessage){&checkrule
;}
121 #check if we try to break rules
122 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} eq 'IPFire' && $fwdfwsettings{'grp2'} eq 'ipfire'){
123 $errormessage.=$Lang::tr
{'fwdfw err same'};
126 if($fwdfwsettings{'grp2'} eq 'ipfire'){
127 $fwdfwsettings{'config'}=$configinput;
128 $fwdfwsettings{'chain'} = 'INPUTFW';
129 my $maxkey=&General
::findhasharraykey
(\
%configinputfw);
130 #check if we have an identical rule already
131 if($fwdfwsettings{'oldrulenumber'} eq $fwdfwsettings{'rulepos'}){
132 foreach my $key (sort keys %configinputfw){
133 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
134 eq "$configinputfw{$key}[0],$configinputfw{$key}[2],$configinputfw{$key}[3],$configinputfw{$key}[4],$configinputfw{$key}[5],$configinputfw{$key}[6],$configinputfw{$key}[7],$configinputfw{$key}[8],$configinputfw{$key}[9],$configinputfw{$key}[10],$configinputfw{$key}[11],$configinputfw{$key}[12],$configinputfw{$key}[13],$configinputfw{$key}[14],$configinputfw{$key}[15],$configinputfw{$key}[17],$configinputfw{$key}[18],$configinputfw{$key}[19],$configinputfw{$key}[20],$configinputfw{$key}[21],$configinputfw{$key}[22],$configinputfw{$key}[23],$configinputfw{$key}[24],$configinputfw{$key}[25],$configinputfw{$key}[26],$configinputfw{$key}[27]"){
135 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
136 if ($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && &validremark
($fwdfwsettings{'ruleremark'})){
138 }elsif($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && !&validremark
($fwdfwsettings{'ruleremark'})){
139 $errormessage=$Lang::tr
{'fwdfw err remark'}."<br>";
141 if ($fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'}){
142 $fwdfwsettings{'nosave'} = 'on';
147 #check Rulepos on new Rule
148 if($fwdfwsettings{'rulepos'} > 0 && !$fwdfwsettings{'oldrulenumber'}){
149 $fwdfwsettings{'oldrulenumber'}=$maxkey;
150 foreach my $key (sort keys %configinputfw){
151 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
152 eq "$configinputfw{$key}[0],$configinputfw{$key}[2],$configinputfw{$key}[3],$configinputfw{$key}[4],$configinputfw{$key}[5],$configinputfw{$key}[6],$configinputfw{$key}[7],$configinputfw{$key}[8],$configinputfw{$key}[9],$configinputfw{$key}[10],$configinputfw{$key}[11],$configinputfw{$key}[12],$configinputfw{$key}[13],$configinputfw{$key}[14],$configinputfw{$key}[15],$configinputfw{$key}[17],$configinputfw{$key}[18],$configinputfw{$key}[19],$configinputfw{$key}[20],$configinputfw{$key}[21],$configinputfw{$key}[22],$configinputfw{$key}[23],$configinputfw{$key}[24],$configinputfw{$key}[25],$configinputfw{$key}[26],$configinputfw{$key}[27]"){
153 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
157 #check if we just close a rule
158 if( $fwdfwsettings{'oldgrp1a'} eq $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} ) {
159 if($fwdfwsettings{'nosave'} eq 'on' && $fwdfwsettings{'updatefwrule'} eq 'on'){
161 $fwdfwsettings{'nosave2'} = 'on';
164 &checkcounter
($fwdfwsettings{'oldgrp1a'},$fwdfwsettings{'oldgrp1b'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
165 if ($fwdfwsettings{'nobase'} ne 'on'){
166 &checkcounter
($fwdfwsettings{'oldgrp2a'},$fwdfwsettings{'oldgrp2b'},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}});
168 if($fwdfwsettings{'oldusesrv'} eq '' && $fwdfwsettings{'USESRV'} eq 'ON'){
169 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
170 }elsif ($fwdfwsettings{'USESRV'} eq '' && $fwdfwsettings{'oldusesrv'} eq 'ON') {
171 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},0,0);
172 }elsif ($fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldgrp3b'} ne $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'updatefwrule'} eq 'on'){
173 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
175 if($fwdfwsettings{'nosave2'} ne 'on'){
176 &saverule
(\
%configinputfw,$configinput);
178 #print "Source: $fwdfwsettings{'grp1'} -> $fwdfwsettings{$fwdfwsettings{'grp1'}}<br>";
179 #print "Sourceport: $fwdfwsettings{'USE_SRC_PORT'}, $fwdfwsettings{'PROT'}, $fwdfwsettings{'ICMP_TYPES'}, $fwdfwsettings{'SRC_PORT'}<br>";
180 #print "Target: $fwdfwsettings{'grp2'} -> $fwdfwsettings{$fwdfwsettings{'grp2'}}<br>";
181 #print "Dienst: $fwdfwsettings{'USESRV'}, $fwdfwsettings{'grp3'} -> $fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
182 #print "BEMERKUNG: $fwdfwsettings{'ruleremark'}<br>";
183 #print " Regel AKTIV: $fwdfwsettings{'ACTIVE'}<br>";
184 #print " Regel LOG: $fwdfwsettings{'LOG'}<br>";
185 #print " ZEITRAHMEN: $fwdfwsettings{'TIME'}<br>";
186 #print " MO: $fwdfwsettings{'TIME_MON'}<br>";
187 #print " DI: $fwdfwsettings{'TIME_TUE'}<br>";
188 #print " MI: $fwdfwsettings{'TIME_WED'}<br>";
189 #print " DO: $fwdfwsettings{'TIME_THU'}<br>";
190 #print " FR: $fwdfwsettings{'TIME_FRI'}<br>";
191 #print " SA: $fwdfwsettings{'TIME_SAT'}<br>";
192 #print " SO: $fwdfwsettings{'TIME_SUN'}<br>";
193 #print " VON: $fwdfwsettings{'TIME_FROM'} bis $fwdfwsettings{'TIME_TO'}<br>";
195 #print"ALT: $fwdfwsettings{'oldgrp1a'} $fwdfwsettings{'oldgrp1b'} NEU: $fwdfwsettings{'grp1'} $fwdfwsettings{$fwdfwsettings{'grp1'}}<br>";
196 #print"ALT: $fwdfwsettings{'oldgrp2a'} $fwdfwsettings{'oldgrp2b'} NEU: $fwdfwsettings{'grp2'} $fwdfwsettings{$fwdfwsettings{'grp2'}}<br>";
197 #print"ALT: $fwdfwsettings{'oldgrp3a'} $fwdfwsettings{'oldgrp3b'} NEU: $fwdfwsettings{'grp3'} $fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
198 #print"DIENSTE Checkalt:$fwdfwsettings{'oldusesrv'} DIENSTE Checkneu:$fwdfwsettings{'USESRV'} DIENST ALT:$fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'} DIENST NEU:$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
199 }elsif($fwdfwsettings{$fwdfwsettings{'grp1'}} eq 'IPFire'){
201 $fwdfwsettings{'config'}=$configoutgoing;
202 $fwdfwsettings{'chain'} = 'OUTGOINGFW';
203 my $maxkey=&General
::findhasharraykey
(\
%configoutgoingfw);
204 if($fwdfwsettings{'oldrulenumber'} eq $fwdfwsettings{'rulepos'}){
205 foreach my $key (sort keys %configoutgoingfw){
206 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
207 eq "$configoutgoingfw{$key}[0],$configoutgoingfw{$key}[2],$configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],$configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],$configoutgoingfw{$key}[7],$configoutgoingfw{$key}[8],$configoutgoingfw{$key}[9],$configoutgoingfw{$key}[10],$configoutgoingfw{$key}[11],$configoutgoingfw{$key}[12],$configoutgoingfw{$key}[13],$configoutgoingfw{$key}[14],$configoutgoingfw{$key}[15],$configoutgoingfw{$key}[17],$configoutgoingfw{$key}[18],$configoutgoingfw{$key}[19],$configoutgoingfw{$key}[20],$configoutgoingfw{$key}[21],$configoutgoingfw{$key}[22],$configoutgoingfw{$key}[23],$configoutgoingfw{$key}[24],$configoutgoingfw{$key}[25],$configoutgoingfw{$key}[26],$configoutgoingfw{$key}[27]"){
208 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
209 if ($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && &validremark
($fwdfwsettings{'ruleremark'})){
211 }elsif($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && !&validremark
($fwdfwsettings{'ruleremark'})){
212 $errormessage=$Lang::tr
{'fwdfw err remark'}."<br>";
214 if ($fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'}){
215 $fwdfwsettings{'nosave'} = 'on';
220 #check Rulepos on new Rule
221 if($fwdfwsettings{'rulepos'} > 0 && !$fwdfwsettings{'oldrulenumber'}){
222 $fwdfwsettings{'oldrulenumber'}=$maxkey;
223 foreach my $key (sort keys %configoutgoingfw){
224 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
225 eq "$configoutgoingfw{$key}[0],$configoutgoingfw{$key}[2],$configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],$configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],$configoutgoingfw{$key}[7],$configoutgoingfw{$key}[8],$configoutgoingfw{$key}[9],$configoutgoingfw{$key}[10],$configoutgoingfw{$key}[11],$configoutgoingfw{$key}[12],$configoutgoingfw{$key}[13],$configoutgoingfw{$key}[14],$configoutgoingfw{$key}[15],$configoutgoingfw{$key}[17],$configoutgoingfw{$key}[18],$configoutgoingfw{$key}[19],$configoutgoingfw{$key}[20],$configoutgoingfw{$key}[21],$configoutgoingfw{$key}[22],$configoutgoingfw{$key}[23],$configoutgoingfw{$key}[24],$configoutgoingfw{$key}[25],$configoutgoingfw{$key}[26],$configoutgoingfw{$key}[27]"){
226 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
230 #check if we just close a rule
231 if( $fwdfwsettings{'oldgrp1a'} eq $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} ) {
232 if($fwdfwsettings{'nosave'} eq 'on' && $fwdfwsettings{'updatefwrule'} eq 'on'){
233 $fwdfwsettings{'nosave2'} = 'on';
238 &checkcounter
($fwdfwsettings{'oldgrp1a'},$fwdfwsettings{'oldgrp1b'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
239 &checkcounter
($fwdfwsettings{'oldgrp2a'},$fwdfwsettings{'oldgrp2b'},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}});
240 if($fwdfwsettings{'oldusesrv'} eq '' && $fwdfwsettings{'USESRV'} eq 'ON'){
241 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
242 }elsif ($fwdfwsettings{'USESRV'} eq '' && $fwdfwsettings{'oldusesrv'} eq 'ON') {
243 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},0,0);
244 }elsif ($fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldgrp3b'} ne $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'updatefwrule'} eq 'on'){
245 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
247 if ($fwdfwsettings{'nobase'} eq 'on'){
248 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
250 if ($fwdfwsettings{'nosave2'} ne 'on'){
251 &saverule
(\
%configoutgoingfw,$configoutgoing);
255 $fwdfwsettings{'config'}=$configfwdfw;
256 $fwdfwsettings{'chain'} = 'FORWARDFW';
257 my $maxkey=&General
::findhasharraykey
(\
%configfwdfw);
258 if($fwdfwsettings{'oldrulenumber'} eq $fwdfwsettings{'rulepos'}){
259 #check if we have an identical rule already
260 foreach my $key (sort keys %configfwdfw){
261 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
262 eq "$configfwdfw{$key}[0],$configfwdfw{$key}[2],$configfwdfw{$key}[3],$configfwdfw{$key}[4],$configfwdfw{$key}[5],$configfwdfw{$key}[6],$configfwdfw{$key}[7],$configfwdfw{$key}[8],$configfwdfw{$key}[9],$configfwdfw{$key}[10],$configfwdfw{$key}[11],$configfwdfw{$key}[12],$configfwdfw{$key}[13],$configfwdfw{$key}[14],$configfwdfw{$key}[15],$configfwdfw{$key}[17],$configfwdfw{$key}[18],$configfwdfw{$key}[19],$configfwdfw{$key}[20],$configfwdfw{$key}[21],$configfwdfw{$key}[22],$configfwdfw{$key}[23],$configfwdfw{$key}[24],$configfwdfw{$key}[25],$configfwdfw{$key}[26],$configfwdfw{$key}[27]"){
263 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
264 if ($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && &validremark
($fwdfwsettings{'ruleremark'})){
266 }elsif($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && !&validremark
($fwdfwsettings{'ruleremark'})){
267 $errormessage=$Lang::tr
{'fwdfw err remark'}."<br>";
269 if ($fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'}){
270 $fwdfwsettings{'nosave'} = 'on';
275 #check Rulepos on new Rule
276 if($fwdfwsettings{'rulepos'} > 0 && !$fwdfwsettings{'oldrulenumber'}){
277 $fwdfwsettings{'oldrulenumber'}=$maxkey;
278 foreach my $key (sort keys %configfwdfw){
279 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
280 eq "$configfwdfw{$key}[0],$configfwdfw{$key}[2],$configfwdfw{$key}[3],$configfwdfw{$key}[4],$configfwdfw{$key}[5],$configfwdfw{$key}[6],$configfwdfw{$key}[7],$configfwdfw{$key}[8],$configfwdfw{$key}[9],$configfwdfw{$key}[10],$configfwdfw{$key}[11],$configfwdfw{$key}[12],$configfwdfw{$key}[13],$configfwdfw{$key}[14],$configfwdfw{$key}[15],$configfwdfw{$key}[17],$configfwdfw{$key}[18],$configfwdfw{$key}[19],$configfwdfw{$key}[20],$configfwdfw{$key}[21],$configfwdfw{$key}[22],$configfwdfw{$key}[23],$configfwdfw{$key}[24],$configfwdfw{$key}[25],$configfwdfw{$key}[26],$configfwdfw{$key}[27]"){
281 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
285 #check if we just close a rule
286 if( $fwdfwsettings{'oldgrp1a'} eq $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} ) {
287 if($fwdfwsettings{'nosave'} eq 'on' && $fwdfwsettings{'updatefwrule'} eq 'on'){
288 $fwdfwsettings{'nosave2'} = 'on';
293 &checkcounter
($fwdfwsettings{'oldgrp1a'},$fwdfwsettings{'oldgrp1b'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
294 &checkcounter
($fwdfwsettings{'oldgrp2a'},$fwdfwsettings{'oldgrp2b'},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}});
295 if($fwdfwsettings{'oldusesrv'} eq '' && $fwdfwsettings{'USESRV'} eq 'ON'){
296 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
297 }elsif ($fwdfwsettings{'USESRV'} eq '' && $fwdfwsettings{'oldusesrv'} eq 'ON') {
298 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},0,0);
299 }elsif ($fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldgrp3b'} ne $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'updatefwrule'} eq 'on'){
300 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
302 if ($fwdfwsettings{'nobase'} eq 'on'){
303 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
305 if ($fwdfwsettings{'nosave2'} ne 'on'){
306 &saverule
(\
%configfwdfw,$configfwdfw);
308 #print "Source: $fwdfwsettings{'grp1'} -> $fwdfwsettings{$fwdfwsettings{'grp1'}}<br>";
309 #print "Sourceport: $fwdfwsettings{'USE_SRC_PORT'}, $fwdfwsettings{'PROT'}, $fwdfwsettings{'ICMP_TYPES'}, $fwdfwsettings{'SRC_PORT'}<br>";
310 #print "Target: $fwdfwsettings{'grp2'} -> $fwdfwsettings{$fwdfwsettings{'grp2'}}<br>";
311 #print "Dienst: $fwdfwsettings{'USESRV'}, $fwdfwsettings{'grp3'} -> $fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
312 #print "BEMERKUNG: $fwdfwsettings{'ruleremark'}<br>";
313 #print " Regel AKTIV: $fwdfwsettings{'ACTIVE'}<br>";
314 #print " Regel LOG: $fwdfwsettings{'LOG'}<br>";
315 #print " ZEITRAHMEN: $fwdfwsettings{'TIME'}<br>";
316 #print " MO: $fwdfwsettings{'TIME_MON'}<br>";
317 #print " DI: $fwdfwsettings{'TIME_TUE'}<br>";
318 #print " MI: $fwdfwsettings{'TIME_WED'}<br>";
319 #print " DO: $fwdfwsettings{'TIME_THU'}<br>";
320 #print " FR: $fwdfwsettings{'TIME_FRI'}<br>";
321 #print " SA: $fwdfwsettings{'TIME_SAT'}<br>";
322 #print " SO: $fwdfwsettings{'TIME_SUN'}<br>";
323 #print " VON: $fwdfwsettings{'TIME_FROM'} bis $fwdfwsettings{'TIME_TO'}<br>";
325 #print"ALT: $fwdfwsettings{'oldgrp1a'} $fwdfwsettings{'oldgrp1b'} NEU: $fwdfwsettings{'grp1'} $fwdfwsettings{$fwdfwsettings{'grp1'}}<br>";
326 #print"ALT: $fwdfwsettings{'oldgrp2a'} $fwdfwsettings{'oldgrp2b'} NEU: $fwdfwsettings{'grp2'} $fwdfwsettings{$fwdfwsettings{'grp2'}}<br>";
327 #print"ALT: $fwdfwsettings{'oldgrp3a'} $fwdfwsettings{'oldgrp3b'} NEU: $fwdfwsettings{'grp3'} $fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
328 #print"DIENSTE Checkalt:$fwdfwsettings{'oldusesrv'} DIENSTE Checkneu:$fwdfwsettings{'USESRV'} DIENST ALT:$fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'} DIENST NEU:$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
333 if($fwdfwsettings{'nosave2'} ne 'on'){
339 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'reset'})
341 &General
::readhasharray
("$configfwdfw", \
%configfwdfw);
342 foreach my $key (sort keys %configfwdfw){
343 &checkcounter
($configfwdfw{$key}[3],$configfwdfw{$key}[4],,);
344 &checkcounter
($configfwdfw{$key}[5],$configfwdfw{$key}[6],,);
345 &checkcounter
($configfwdfw{$key}[14],$configfwdfw{$key}[15],,);
347 &General
::readhasharray
("$configinput", \
%configinputfw);
348 foreach my $key (sort keys %configinputfw){
349 &checkcounter
($configinputfw{$key}[3],$configinputfw{$key}[4],,);
350 &checkcounter
($configinputfw{$key}[5],$configinputfw{$key}[6],,);
351 &checkcounter
($configinputfw{$key}[14],$configinputfw{$key}[15],,);
354 system("rm ${General::swroot}/forward/config");
355 system("rm ${General::swroot}/forward/input");
356 &General
::writehash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
357 unless (-e
"${General::swroot}/forward/config") { system("touch ${General::swroot}/forward/config"); }
358 unless (-e
"${General::swroot}/forward/input") { system("touch ${General::swroot}/forward/input"); }
360 $fwdfwsettings{'POLICY'}='MODE2';
361 &General
::writehash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
365 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'fwdfw newrule'})
369 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'fwdfw toggle'})
372 &General
::readhasharray
($fwdfwsettings{'config'}, \
%togglehash);
373 foreach my $key (sort keys %togglehash){
374 if ($key eq $fwdfwsettings{'key'}){
375 if ($togglehash{$key}[2] eq 'ON'){$togglehash{$key}[2]='';}else{$togglehash{$key}[2]='ON';}
378 &General
::writehasharray
($fwdfwsettings{'config'}, \
%togglehash);
382 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'fwdfw togglelog'})
385 &General
::readhasharray
($fwdfwsettings{'config'}, \
%togglehash);
386 foreach my $key (sort keys %togglehash){
387 if ($key eq $fwdfwsettings{'key'}){
388 if ($togglehash{$key}[17] eq 'ON'){$togglehash{$key}[17]='';}else{$togglehash{$key}[17]='ON';}
391 &General
::writehasharray
($fwdfwsettings{'config'}, \
%togglehash);
395 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'fwdfw reread'})
400 if ($fwdfwsettings{'ACTION'} eq 'editrule')
402 $fwdfwsettings{'updatefwrule'}='on';
405 if ($fwdfwsettings{'ACTION'} eq 'deleterule')
409 if ($fwdfwsettings{'ACTION'} eq 'moveup')
414 if ($fwdfwsettings{'ACTION'} eq 'movedown')
419 if ($fwdfwsettings{'ACTION'} eq 'copyrule')
421 $fwdfwsettings{'copyfwrule'}='on';
422 #$fwdfwsettings{'updatefwrule'}='on';
425 if ($fwdfwsettings{'ACTION'} eq 'togglep2p')
427 #$errormessage="Toggle $fwdfwsettings{'P2PROT'}<br>";
428 open( FILE
, "< $p2pfile" ) or die "Unable to read $p2pfile";
431 open( FILE
, "> $p2pfile" ) or die "Unable to write $p2pfile";
432 foreach my $p2pentry (sort @p2ps)
434 my @p2pline = split( /\;/, $p2pentry );
435 if ($p2pline[1] eq $fwdfwsettings{'P2PROT'}) {
436 if($p2pline[2] eq 'on'){
442 print FILE
"$p2pline[0];$p2pline[1];$p2pline[2];\n";
448 if ($fwdfwsettings{'ACTION'} eq '')
456 $fwdfwsettings{'updatefwrule'}='';
457 $fwdfwsettings{'config'}=$oldchain;
458 $fwdfwsettings{'nobase'}='on';
460 &checkcounter
(0,0,$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
461 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
467 &General
::readhasharray
($fwdfwsettings{'config'}, \
%uphash);
468 foreach my $key (sort keys %uphash){
469 if ($key eq $fwdfwsettings{'key'}) {
471 if (exists $uphash{$last}){
473 foreach my $y (0 .. $#{$uphash{$last}}) {
474 $tmp{0}[$y] = $uphash{$last}[$y];
476 #copy active rule to last
477 foreach my $i (0 .. $#{$uphash{$last}}) {
478 $uphash{$last}[$i] = $uphash{$key}[$i];
480 #copy saved rule to actual position
481 foreach my $x (0 .. $#{$tmp{0}}) {
482 $uphash{$key}[$x] = $tmp{0}[$x];
487 &General
::writehasharray
($fwdfwsettings{'config'}, \
%uphash);
494 &General
::readhasharray
($fwdfwsettings{'config'}, \
%downhash);
495 foreach my $key (sort keys %downhash){
496 if ($key eq $fwdfwsettings{'key'}) {
498 if (exists $downhash{$next}){
500 foreach my $y (0 .. $#{$downhash{$next}}) {
501 $tmp{0}[$y] = $downhash{$next}[$y];
503 #copy active rule to next
504 foreach my $i (0 .. $#{$downhash{$next}}) {
505 $downhash{$next}[$i] = $downhash{$key}[$i];
507 #copy saved rule to actual position
508 foreach my $x (0 .. $#{$tmp{0}}) {
509 $downhash{$key}[$x] = $tmp{0}[$x];
514 &General
::writehasharray
($fwdfwsettings{'config'}, \
%downhash);
519 my ($base1,$val1,$base2,$val2) = @_;
521 if($base1 eq 'cust_net_src' || $base1 eq 'cust_net_tgt'){
522 &dec_counter
($confignet,\
%customnetwork,$val1);
523 }elsif($base1 eq 'cust_host_src' || $base1 eq 'cust_host_tgt'){
524 &dec_counter
($confighost,\
%customhost,$val1);
525 }elsif($base1 eq 'cust_grp_src' || $base1 eq 'cust_grp_tgt'){
526 &dec_counter
($configgrp,\
%customgrp,$val1);
527 }elsif($base1 eq 'cust_srv'){
528 &dec_counter
($configsrv,\
%customservice,$val1);
529 }elsif($base1 eq 'cust_srvgrp'){
530 &dec_counter
($configsrvgrp,\
%customservicegrp,$val1);
533 if($base2 eq 'cust_net_src' || $base2 eq 'cust_net_tgt'){
534 &inc_counter
($confignet,\
%customnetwork,$val2);
535 }elsif($base2 eq 'cust_host_src' || $base2 eq 'cust_host_tgt'){
536 &inc_counter
($confighost,\
%customhost,$val2);
537 }elsif($base2 eq 'cust_grp_src' || $base2 eq 'cust_grp_tgt'){
538 &inc_counter
($configgrp,\
%customgrp,$val2);
539 }elsif($base2 eq 'cust_srv'){
540 &inc_counter
($configsrv,\
%customservice,$val2);
541 }elsif($base2 eq 'cust_srvgrp'){
542 &inc_counter
($configsrvgrp,\
%customservicegrp,$val2);
552 &General
::readhasharray
($config, \
%hash);
553 foreach my $key (sort { uc($hash{$a}[0]) cmp uc($hash{$b}[0]) } keys %hash){
554 if($hash{$key}[0] eq $val){
555 $pos=$#{$hash{$key}};
556 $hash{$key}[$pos] = $hash{$key}[$pos]+1;
559 &General
::writehasharray
($config, \
%hash);
567 #$errormessage.="ALT:config: $config , verringert wird $val <br>";
568 &General
::readhasharray
($config, \
%hash);
569 foreach my $key (sort { uc($hash{$a}[0]) cmp uc($hash{$b}[0]) } keys %hash){
570 if($hash{$key}[0] eq $val){
571 $pos=$#{$hash{$key}};
572 $hash{$key}[$pos] = $hash{$key}[$pos]-1;
575 &General
::writehasharray
($config, \
%hash);
579 if ($fwdfwsettings{'POLICY'} eq 'MODE1'){ $selected{'POLICY'}{'MODE1'} = 'selected'; } else { $selected{'POLICY'}{'MODE1'} = ''; }
580 if ($fwdfwsettings{'POLICY'} eq 'MODE2'){ $selected{'POLICY'}{'MODE2'} = 'selected'; } else { $selected{'POLICY'}{'MODE2'} = ''; }
584 &Header
::openbox
('100%', 'center', $Lang::tr
{'fwdfw pol title'});
586 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
587 <table width='100%' border='0'>
588 <tr><td colspan='3'>$Lang::tr{'fwdfw pol text'}</td></tr>
590 <tr><td colspan='3'><hr /></td></tr>
591 <tr><td width='15%' align='left'> <select name='POLICY' style="width: 100px">
592 <option value='MODE1' $selected{'POLICY'}{'MODE1'}>$Lang::tr{'fwdfw pol block'}</option>
593 <option value='MODE2' $selected{'POLICY'}{'MODE2'}>$Lang::tr{'fwdfw pol allow'}</option></select>
594 <td width='45%' align='left'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
595 <td width='45%' align='left'>
597 print "$Lang::tr{'outgoing firewall reset'}: <input type='submit' name='ACTION' value='$Lang::tr{'reset'}' />";
598 print "</table></form>";
604 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw addrule'});
606 print "<form method='post'>";
607 print "<table border='0'>";
608 print "<tr><td><input type='submit' name='ACTION' value='$Lang::tr{'fwdfw newrule'}'></td>";
609 if (-f
"${General::swroot}/forward/reread"){
610 print "<td><input type='submit' name='ACTION' value='$Lang::tr{'fwdfw reread'}' style='font-face: Comic Sans MS; color: red; font-weight: bold;'>$Lang::tr{'fwhost reread'}</td>";
612 print"</tr></table></form><hr>";
620 &General
::readhasharray
($fwdfwsettings{'config'}, \
%delhash);
621 foreach my $key (sort {$a <=> $b} keys %delhash){
622 if ($key == $fwdfwsettings{'key'}){
623 #check hosts/net and groups
624 &checkcounter
($delhash{$key}[3],$delhash{$key}[4],,);
625 &checkcounter
($delhash{$key}[5],$delhash{$key}[6],,);
626 #check services and groups
627 if ($delhash{$key}[11] eq 'ON'){
628 &checkcounter
($delhash{$key}[14],$delhash{$key}[15],,);
631 if ($key >= $fwdfwsettings{'key'}) {
633 if (exists $delhash{$next}) {
634 foreach my $i (0 .. $#{$delhash{$next}}) {
635 $delhash{$key}[$i] = $delhash{$next}[$i];
640 # Remove the very last entry.
641 my $last_key = (sort {$a <=> $b} keys %delhash)[-1];
642 delete $delhash{$last_key};
644 &General
::writehasharray
($fwdfwsettings{'config'}, \
%delhash);
647 if($fwdfwsettings{'nobase'} ne 'on'){
654 &General
::readhasharray
("$configfwdfw", \
%configfwdfw);
655 foreach my $key (sort keys %configfwdfw){
657 if ($configfwdfw{$key}[2] eq 'ON'){$configfwdfw{$key}[2]='';}
660 &General
::writehasharray
("$configfwdfw", \
%configfwdfw);
667 #check ip-address if manual
668 if ($fwdfwsettings{'src_addr'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'src_addr'} ne ''){
669 #check if ip with subnet
670 if ($fwdfwsettings{'src_addr'} =~ /^(.*?)\/(.*?
)$/) {
671 ($ip,$subnet)=split (/\//,$fwdfwsettings{'src_addr'});
672 $subnet = &General
::iporsubtocidr
($subnet);
673 $fwdfwsettings{'isip'}='on';
676 if($fwdfwsettings{'src_addr'}=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/){
677 $ip=$fwdfwsettings{'src_addr'};
679 $fwdfwsettings{'isip'}='on';
682 if ($fwdfwsettings{'isip'} ne 'on'){
683 if (&General
::validmac
($fwdfwsettings{'src_addr'})){$fwdfwsettings{'ismac'}='on';}
685 if ($fwdfwsettings{'isip'} eq 'on'){
686 #check and form valid IP
687 $ip=&General
::ip2dec
($ip);
688 $ip=&General
::dec2ip
($ip);
689 #check if net or broadcast
690 my @tmp= split (/\./,$ip);
691 if (($tmp[3] eq "0") || ($tmp[3] eq "255"))
693 $errormessage=$Lang::tr
{'fwhost err hostip'}."<br>";
695 $fwdfwsettings{'src_addr'}="$ip/$subnet";
697 if(!&General
::validipandmask
($fwdfwsettings{'src_addr'})){
698 $errormessage.=$Lang::tr
{'fwdfw err src_addr'}."<br>";
701 if ($fwdfwsettings{'isip'} ne 'on' && $fwdfwsettings{'ismac'} ne 'on'){
702 $errormessage.=$Lang::tr
{'fwdfw err src_addr'}."<br>";
704 }elsif($fwdfwsettings{'src_addr'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'src_addr'} eq ''){
705 $errormessage.=$Lang::tr
{'fwdfw err nosrcip'};
706 return $errormessage;
710 if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq ''){ $errormessage.=$Lang::tr
{'fwdfw err nosrc'}."<br>";}
712 if ($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} eq 'ICMP'){
713 $fwdfwsettings{'SRC_PORT'}='';
714 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
715 foreach my $key (keys %icmptypes){
716 if($fwdfwsettings{'ICMP_TYPES'} eq "$icmptypes{$key}[0] ($icmptypes{$key}[1])"){
717 $fwdfwsettings{'ICMP_TYPES'}="$icmptypes{$key}[0]";
720 }elsif($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} eq 'GRE'){
721 $fwdfwsettings{'SRC_PORT'}='';
722 $fwdfwsettings{'ICMP_TYPES'}='';
723 }elsif($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} eq 'ESP'){
724 $fwdfwsettings{'SRC_PORT'}='';
725 $fwdfwsettings{'ICMP_TYPES'}='';
726 }elsif($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} eq 'AH'){
727 $fwdfwsettings{'SRC_PORT'}='';
728 $fwdfwsettings{'ICMP_TYPES'}='';
729 }elsif($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} ne 'ICMP'){
730 $fwdfwsettings{'ICMP_TYPES'}='';
732 $fwdfwsettings{'ICMP_TYPES'}='';
733 $fwdfwsettings{'SRC_PORT'}='';
734 $fwdfwsettings{'PROT'}='';
737 if($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && ($fwdfwsettings{'PROT'} eq 'TCP' || $fwdfwsettings{'PROT'} eq 'UDP') && $fwdfwsettings{'SRC_PORT'} ne ''){
738 my @parts=split(",",$fwdfwsettings{'SRC_PORT'});
742 if ($_ =~ /^(\d+)\:(\d+)$/) {
744 #change dashes with :
747 push(@values,"1:65535");
750 if ($_ =~ /^(\D)\:(\d+)$/) {
751 push(@values,"1:$2");
754 if ($_ =~ /^(\d+)\:(\D)$/) {
755 push(@values,"$1:65535");
758 $errormessage .= &General
::validportrange
($_, 'destination');
763 if (&General
::validport
($_)){
770 $fwdfwsettings{'SRC_PORT'}=join("|",@values);
771 return $errormessage;
778 if ($fwdfwsettings{'tgt_addr'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'tgt_addr'} ne ''){
779 #check if ip with subnet
780 if ($fwdfwsettings{'tgt_addr'} =~ /^(.*?)\/(.*?
)$/) {
781 ($ip,$subnet)=split (/\//,$fwdfwsettings{'tgt_addr'});
782 $subnet = &General
::iporsubtocidr
($subnet);
785 if($fwdfwsettings{'tgt_addr'}=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/){
786 $ip=$fwdfwsettings{'tgt_addr'};
789 #check and form valid IP
790 $ip=&General
::ip2dec
($ip);
791 $ip=&General
::dec2ip
($ip);
793 ##check if net or broadcast
794 #my @tmp= split (/\./,$ip);
795 #if ($tmp[3] eq "0" || ($tmp[3] eq "255"))
797 #$errormessage=$Lang::tr{'fwhost err hostip'}."<br>";
799 $fwdfwsettings{'tgt_addr'}="$ip/$subnet";
801 if(!&General
::validipandmask
($fwdfwsettings{'tgt_addr'})){
802 $errormessage.=$Lang::tr
{'fwdfw err tgt_addr'}."<br>";
805 }elsif($fwdfwsettings{'tgt_addr'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'tgt_addr'} eq ''){
806 $errormessage.=$Lang::tr
{'fwdfw err notgtip'};
807 return $errormessage;
811 if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq ''){ $errormessage.=$Lang::tr
{'fwdfw err notgt'}."<br>";}
814 if ($fwdfwsettings{'USESRV'} eq 'ON'){
815 if ($fwdfwsettings{'grp3'} eq 'cust_srv'){
816 $fwdfwsettings{'TGT_PROT'}='';
817 $fwdfwsettings{'ICMP_TGT'}='';
819 if ($fwdfwsettings{'grp3'} eq 'cust_srvgrp'){
820 $fwdfwsettings{'TGT_PROT'}='';
821 $fwdfwsettings{'ICMP_TGT'}='';
822 #check target service
823 if($fwdfwsettings{$fwdfwsettings{'grp3'}} eq ''){
824 $errormessage.=$Lang::tr
{'fwdfw err tgt_grp'};
827 if ($fwdfwsettings{'grp3'} eq 'TGT_PORT'){
828 if ($fwdfwsettings{'TGT_PROT'} eq 'TCP' || $fwdfwsettings{'TGT_PROT'} eq 'UDP'){
829 if ($fwdfwsettings{'TGT_PORT'} ne ''){
830 my @parts=split(",",$fwdfwsettings{'TGT_PORT'});
834 if ($_ =~ /^(\d+)\:(\d+)$/) {
836 #change dashes with :
839 push(@values,"1:65535");
842 if ($_ =~ /^(\D)\:(\d+)$/) {
843 push(@values,"1:$2");
846 if ($_ =~ /^(\d+)\:(\D)$/) {
847 push(@values,"$1:65535");
850 $errormessage .= &General
::validportrange
($_, 'destination');
855 if (&General
::validport
($_)){
862 $fwdfwsettings{'TGT_PORT'}=join("|",@values);
864 }elsif ($fwdfwsettings{'TGT_PROT'} eq 'GRE'){
865 $fwdfwsettings{$fwdfwsettings{'grp3'}} = '';
866 $fwdfwsettings{'TGT_PORT'} = '';
867 $fwdfwsettings{'ICMP_TGT'} = '';
868 }elsif($fwdfwsettings{'TGT_PROT'} eq 'ESP'){
869 $fwdfwsettings{$fwdfwsettings{'grp3'}} = '';
870 $fwdfwsettings{'TGT_PORT'} = '';
871 $fwdfwsettings{'ICMP_TGT'}='';
872 }elsif($fwdfwsettings{'TGT_PROT'} eq 'AH'){
873 $fwdfwsettings{$fwdfwsettings{'grp3'}} = '';
874 $fwdfwsettings{'TGT_PORT'} = '';
875 $fwdfwsettings{'ICMP_TGT'}='';
876 }elsif ($fwdfwsettings{'TGT_PROT'} eq 'ICMP'){
877 $fwdfwsettings{$fwdfwsettings{'grp3'}} = '';
878 $fwdfwsettings{'TGT_PORT'} = '';
879 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
880 foreach my $key (keys %icmptypes){
882 if ("$icmptypes{$key}[0] ($icmptypes{$key}[1])" eq $fwdfwsettings{'ICMP_TGT'}){
883 $fwdfwsettings{'ICMP_TGT'}=$icmptypes{$key}[0];
891 if ($fwdfwsettings{'USESRV'} ne 'ON'){
892 $fwdfwsettings{'grp3'}='';
893 $fwdfwsettings{$fwdfwsettings{'grp3'}}='';
894 $fwdfwsettings{'TGT_PROT'}='';
895 $fwdfwsettings{'ICMP_TGT'}='';
898 if($fwdfwsettings{'TIME'} eq 'ON'){
899 if($fwdfwsettings{'TIME_MON'} eq '' && $fwdfwsettings{'TIME_TUE'} eq '' && $fwdfwsettings{'TIME_WED'} eq '' && $fwdfwsettings{'TIME_THU'} eq '' && $fwdfwsettings{'TIME_FRI'} eq '' && $fwdfwsettings{'TIME_SAT'} eq '' && $fwdfwsettings{'TIME_SUN'} eq ''){
900 $errormessage=$Lang::tr
{'fwdfw err time'};
903 return $errormessage;
908 if ($fwdfwsettings{'ruleremark'} ne '' && !&validremark
($fwdfwsettings{'ruleremark'})){
909 $errormessage.=$Lang::tr
{'fwdfw err remark'}."<br>";
911 #check if source and target identical
912 if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{$fwdfwsettings{'grp1'}} ne 'ALL'){
913 $errormessage.=$Lang::tr
{'fwdfw err same'};
914 return $errormessage;
917 #get source and targetip address if possible
918 my ($sip,$scidr,$tip,$tcidr);
919 ($sip,$scidr)=&get_ip
("src","grp1");
920 ($tip,$tcidr)=&get_ip
("tgt","grp2");
922 #check same iprange in source and target
923 if ($sip ne '' && $scidr ne '' && $tip ne '' && $tcidr ne ''){
924 my $networkip1=&General
::getnetworkip
($sip,$scidr);
925 my $networkip2=&General
::getnetworkip
($tip,$tcidr);
926 if ($scidr gt $tcidr){
927 if ( &General
::IpInSubnet
($networkip1,$tip,&General
::iporsubtodec
($tcidr))){
928 $errormessage.=$Lang::tr
{'fwdfw err samesub'};
930 }elsif($scidr eq $tcidr && $scidr eq '32'){
931 my ($sbyte1,$sbyte2,$sbyte3,$sbyte4)=split(/\./,$networkip1);
932 my ($tbyte1,$tbyte2,$tbyte3,$tbyte4)=split(/\./,$networkip2);
933 if ($sbyte1 eq $tbyte1 && $sbyte2 eq $tbyte2 && $sbyte3 eq $tbyte3){
934 $hint=$Lang::tr
{'fwdfw hint ip1'}."<br>";
935 $hint.=$Lang::tr
{'fwdfw hint ip2'}." Source: $networkip1/$scidr Target: $networkip2/$tcidr<br>";
938 if ( &General
::IpInSubnet
($networkip2,$sip,&General
::iporsubtodec
($scidr)) ){
939 $errormessage.=$Lang::tr
{'fwdfw err samesub'};
944 #check source and destination protocol if manual
945 if( $fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'USESRV'} eq 'ON'){
946 if($fwdfwsettings{'PROT'} ne $fwdfwsettings{'TGT_PROT'} && $fwdfwsettings{'grp3'} eq 'TGT_PORT'){
947 $errormessage.=$Lang::tr
{'fwdfw err prot'};
949 #check source and destination protocol if source manual and dest servicegrp
950 if ($fwdfwsettings{'grp3'} eq 'cust_srv'){
951 &General
::readhasharray
("$configsrv", \
%customservice);
952 foreach my $key (sort keys %customservice){
953 if($customservice{$key}[0] eq $fwdfwsettings{$fwdfwsettings{'grp3'}}){
954 if ($customservice{$key}[2] ne $fwdfwsettings{'PROT'}){
955 $errormessage.=$Lang::tr
{'fwdfw err prot'};
969 &General
::readhash
("/var/ipfire/ethernet/settings", \
%netsettings);
970 if ($fwdfwsettings{$grp} ne $Lang::tr
{'fwhost any'}){
971 if ($fwdfwsettings{$grp} eq $val.'_addr'){
972 ($a,$b) = split (/\//, $fwdfwsettings{$fwdfwsettings{$grp}});
973 }elsif($fwdfwsettings{$grp} eq 'std_net_'.$val){
974 if ($fwdfwsettings{$fwdfwsettings{$grp}} =~ /Gr/i){
975 $a=$netsettings{'GREEN_NETADDRESS'};
976 $b=&General
::iporsubtocidr
($netsettings{'GREEN_NETMASK'});
977 }elsif($fwdfwsettings{$fwdfwsettings{$grp}} =~ /Ora/i){
978 $a=$netsettings{'ORANGE_NETADDRESS'};
979 $b=&General
::iporsubtocidr
($netsettings{'ORANGE_NETMASK'});
980 }elsif($fwdfwsettings{$fwdfwsettings{$grp}} =~ /Bl/i){
981 $a=$netsettings{'BLUE_NETADDRESS'};
982 $b=&General
::iporsubtocidr
($netsettings{'BLUE_NETMASK'});
983 }elsif($fwdfwsettings{$fwdfwsettings{$grp}} =~ /OpenVPN/i){
984 &General
::readhash
("$configovpn",\
%ovpnsettings);
985 ($a,$b) = split (/\//, $ovpnsettings{'DOVPN_SUBNET'});
986 $b=&General
::iporsubtocidr
($b);
988 }elsif($fwdfwsettings{$grp} eq 'cust_net_'.$val){
989 &General
::readhasharray
("$confignet", \
%customnetwork);
990 foreach my $key (keys %customnetwork){
991 if($customnetwork{$key}[0] eq $fwdfwsettings{$fwdfwsettings{$grp}}){
992 $a=$customnetwork{$key}[1];
993 $b=&General
::iporsubtocidr
($customnetwork{$key}[2]);
996 }elsif($fwdfwsettings{$grp} eq 'cust_host_'.$val){
997 &General
::readhasharray
("$confighost", \
%customhost);
998 foreach my $key (keys %customhost){
999 if($customhost{$key}[0] eq $fwdfwsettings{$fwdfwsettings{$grp}}){
1000 if ($customhost{$key}[1] eq 'ip'){
1001 ($a,$b)=split (/\//,$customhost{$key}[2]);
1002 $b=&General
::iporsubtocidr
($b);
1004 if ($grp eq 'grp2'){
1005 $errormessage=$Lang::tr
{'fwdfw err tgt_mac'};
1017 &General
::setup_default_networks
(\
%defaultNetworks);
1018 #read all configfiles
1019 &General
::readhasharray
("$configccdnet", \
%ccdnet);
1020 &General
::readhasharray
("$confignet", \
%customnetwork);
1021 &General
::readhasharray
("$configccdhost", \
%ccdhost);
1022 &General
::readhasharray
("$confighost", \
%customhost);
1023 &General
::readhasharray
("$configccdhost", \
%ccdhost);
1024 &General
::readhasharray
("$configgrp", \
%customgrp);
1025 &General
::readhasharray
("$configipsec", \
%ipsecconf);
1026 &General
::get_aliases
(\
%aliases);
1030 if($fwdfwsettings{'config'} eq ''){$fwdfwsettings{'config'}=$configfwdfw;}
1031 my $config=$fwdfwsettings{'config'};
1033 $checked{'grp1'}{$fwdfwsettings{'grp1'}} = 'CHECKED';
1034 $checked{'grp2'}{$fwdfwsettings{'grp2'}} = 'CHECKED';
1035 $checked{'grp3'}{$fwdfwsettings{'grp3'}} = 'CHECKED';
1036 $checked{'USE_SRC_PORT'}{$fwdfwsettings{'USE_SRC_PORT'}} = 'CHECKED';
1037 $checked{'USESRV'}{$fwdfwsettings{'USESRV'}} = 'CHECKED';
1038 $checked{'ACTIVE'}{$fwdfwsettings{'ACTIVE'}} = 'CHECKED';
1039 $checked{'LOG'}{$fwdfwsettings{'LOG'}} = 'CHECKED';
1040 $checked{'TIME'}{$fwdfwsettings{'TIME'}} = 'CHECKED';
1041 $checked{'TIME_MON'}{$fwdfwsettings{'TIME_MON'}} = 'CHECKED';
1042 $checked{'TIME_TUE'}{$fwdfwsettings{'TIME_TUE'}} = 'CHECKED';
1043 $checked{'TIME_WED'}{$fwdfwsettings{'TIME_WED'}} = 'CHECKED';
1044 $checked{'TIME_THU'}{$fwdfwsettings{'TIME_THU'}} = 'CHECKED';
1045 $checked{'TIME_FRI'}{$fwdfwsettings{'TIME_FRI'}} = 'CHECKED';
1046 $checked{'TIME_SAT'}{$fwdfwsettings{'TIME_SAT'}} = 'CHECKED';
1047 $checked{'TIME_SUN'}{$fwdfwsettings{'TIME_SUN'}} = 'CHECKED';
1048 $selected{'TIME_FROM'}{$fwdfwsettings{'TIME_FROM'}} = 'selected';
1049 $selected{'TIME_TO'}{$fwdfwsettings{'TIME_TO'}} = 'selected';
1050 $selected{'ipfire'}{$fwdfwsettings{$fwdfwsettings{'grp2'}}} ='selected';
1051 #check if update and get values
1052 if($fwdfwsettings{'updatefwrule'} eq 'on' || $fwdfwsettings{'copyfwrule'} eq 'on' && !$errormessage){
1053 &General
::readhasharray
("$config", \
%hash);
1054 foreach my $key (sort keys %hash){
1056 if ($key eq $fwdfwsettings{'key'}){
1057 $fwdfwsettings{'oldrulenumber'} = $fwdfwsettings{'key'};
1058 $fwdfwsettings{'RULE_ACTION'} = $hash{$key}[0];
1059 $fwdfwsettings{'ACTIVE'} = $hash{$key}[2];
1060 $fwdfwsettings{'grp1'} = $hash{$key}[3];
1061 $fwdfwsettings{$fwdfwsettings{'grp1'}} = $hash{$key}[4];
1062 $fwdfwsettings{'grp2'} = $hash{$key}[5];
1063 $fwdfwsettings{$fwdfwsettings{'grp2'}} = $hash{$key}[6];
1064 $fwdfwsettings{'USE_SRC_PORT'} = $hash{$key}[7];
1065 $fwdfwsettings{'PROT'} = $hash{$key}[8];
1066 $fwdfwsettings{'ICMP_TYPES'} = $hash{$key}[9];
1067 $fwdfwsettings{'SRC_PORT'} = $hash{$key}[10];
1068 $fwdfwsettings{'USESRV'} = $hash{$key}[11];
1069 $fwdfwsettings{'TGT_PROT'} = $hash{$key}[12];
1070 $fwdfwsettings{'ICMP_TGT'} = $hash{$key}[13];
1071 $fwdfwsettings{'grp3'} = $hash{$key}[14];
1072 $fwdfwsettings{$fwdfwsettings{'grp3'}} = $hash{$key}[15];
1073 $fwdfwsettings{'ruleremark'} = $hash{$key}[16];
1074 $fwdfwsettings{'LOG'} = $hash{$key}[17];
1075 $fwdfwsettings{'TIME'} = $hash{$key}[18];
1076 $fwdfwsettings{'TIME_MON'} = $hash{$key}[19];
1077 $fwdfwsettings{'TIME_TUE'} = $hash{$key}[20];
1078 $fwdfwsettings{'TIME_WED'} = $hash{$key}[21];
1079 $fwdfwsettings{'TIME_THU'} = $hash{$key}[22];
1080 $fwdfwsettings{'TIME_FRI'} = $hash{$key}[23];
1081 $fwdfwsettings{'TIME_SAT'} = $hash{$key}[24];
1082 $fwdfwsettings{'TIME_SUN'} = $hash{$key}[25];
1083 $fwdfwsettings{'TIME_FROM'} = $hash{$key}[26];
1084 $fwdfwsettings{'TIME_TO'} = $hash{$key}[27];
1085 $checked{'grp1'}{$fwdfwsettings{'grp1'}} = 'CHECKED';
1086 $checked{'grp2'}{$fwdfwsettings{'grp2'}} = 'CHECKED';
1087 $checked{'grp3'}{$fwdfwsettings{'grp3'}} = 'CHECKED';
1088 $checked{'USE_SRC_PORT'}{$fwdfwsettings{'USE_SRC_PORT'}} = 'CHECKED';
1089 $checked{'USESRV'}{$fwdfwsettings{'USESRV'}} = 'CHECKED';
1090 $checked{'ACTIVE'}{$fwdfwsettings{'ACTIVE'}} = 'CHECKED';
1091 $checked{'LOG'}{$fwdfwsettings{'LOG'}} = 'CHECKED';
1092 $checked{'TIME'}{$fwdfwsettings{'TIME'}} = 'CHECKED';
1093 $checked{'TIME_MON'}{$fwdfwsettings{'TIME_MON'}} = 'CHECKED';
1094 $checked{'TIME_TUE'}{$fwdfwsettings{'TIME_TUE'}} = 'CHECKED';
1095 $checked{'TIME_WED'}{$fwdfwsettings{'TIME_WED'}} = 'CHECKED';
1096 $checked{'TIME_THU'}{$fwdfwsettings{'TIME_THU'}} = 'CHECKED';
1097 $checked{'TIME_FRI'}{$fwdfwsettings{'TIME_FRI'}} = 'CHECKED';
1098 $checked{'TIME_SAT'}{$fwdfwsettings{'TIME_SAT'}} = 'CHECKED';
1099 $checked{'TIME_SUN'}{$fwdfwsettings{'TIME_SUN'}} = 'CHECKED';
1100 $selected{'TIME_FROM'}{$fwdfwsettings{'TIME_FROM'}} = 'selected';
1101 $selected{'TIME_TO'}{$fwdfwsettings{'TIME_TO'}} = 'selected';
1102 $selected{'ipfire'}{$fwdfwsettings{$fwdfwsettings{'grp2'}}} ='selected';
1105 $fwdfwsettings{'oldgrp1a'}=$fwdfwsettings{'grp1'};
1106 $fwdfwsettings{'oldgrp1b'}=$fwdfwsettings{$fwdfwsettings{'grp1'}};
1107 $fwdfwsettings{'oldgrp2a'}=$fwdfwsettings{'grp2'};
1108 $fwdfwsettings{'oldgrp2b'}=$fwdfwsettings{$fwdfwsettings{'grp2'}};
1109 $fwdfwsettings{'oldgrp3a'}=$fwdfwsettings{'grp3'};
1110 $fwdfwsettings{'oldgrp3b'}=$fwdfwsettings{$fwdfwsettings{'grp3'}};
1111 $fwdfwsettings{'oldusesrv'}=$fwdfwsettings{'USESRV'};
1112 $fwdfwsettings{'oldruleremark'}=$fwdfwsettings{'ruleremark'};
1114 $fwdfwsettings{'ACTIVE'}='ON';
1115 $checked{'ACTIVE'}{$fwdfwsettings{'ACTIVE'}} = 'CHECKED';
1118 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw addrule'});
1121 <form method="post">
1123 <tr><td nowrap>$Lang::tr{'fwdfw rule action'}</td><td><select name='RULE_ACTION'>
1125 foreach ("ACCEPT","DROP","REJECT")
1127 if($fwdfwsettings{'updatefwrule'} eq 'on'){
1129 print "selected='selected'" if ($fwdfwsettings{'RULE_ACTION'} eq $_);
1130 print">$_</option>";
1132 if($fwdfwsettings{'POLICY'} eq 'MODE2'){
1133 $fwdfwsettings{'RULE_ACTION'} = 'DROP';
1136 if ($_ eq $fwdfwsettings{'RULE_ACTION'})
1138 print"<option selected>$_</option>";
1140 print"<option>$_</option>";
1144 print"</select></td></tr></table><hr>";
1146 &Header
::closebox
();
1147 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw source'});
1148 #------SOURCE-------------------------------------------------------
1150 <table width='100%' border='0'>
1151 <tr><td width='1%'><input type='radio' name='grp1' value='src_addr' checked></td><td colspan='5'>$Lang::tr{'fwdfw sourceip'}<input type='TEXT' name='src_addr' value='$fwdfwsettings{'src_addr'}' ></td></tr>
1152 <tr><td colspan='7'><hr style='border:dotted #BFBFBF; border-width:1px 0 0 0 ; ' /></td></tr>
1153 <tr><td width='1%'><input type='radio' name='grp1' value='std_net_src' $checked{'grp1'}{'std_net_src'}></td><td nowrap='nowrap' width='12%'>$Lang::tr{'fwhost stdnet'}</td><td width='13%'><select name='std_net_src' style='min-width:185px;'>
1155 foreach my $network (sort keys %defaultNetworks)
1157 next if($defaultNetworks{$network}{'LOCATION'} eq "IPCOP");
1158 next if($defaultNetworks{$network}{'NAME'} eq "RED");
1159 print "<option value='$defaultNetworks{$network}{'NAME'}'";
1160 print " selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $defaultNetworks{$network}{'NAME'});
1161 print ">$network</option>";
1164 </select></td><td width='1%'><input type='radio' name='grp1' value='ovpn_net_src' $checked{'grp1'}{'ovpn_net_src'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdnet'}</td><td nowrap='nowrap' width='1%'><select name='ovpn_net_src' style='min-width:185px;'>
1166 &fillselect
(\
%ccdnet,$fwdfwsettings{$fwdfwsettings{'grp1'}});
1169 <tr><td><input type='radio' name='grp1' value='cust_net_src' $checked{'grp1'}{'cust_net_src'}></td><td>$Lang::tr{'fwhost cust net'}</td><td><select name='cust_net_src' style='min-width:185px;'>
1171 &fillselect
(\
%customnetwork,$fwdfwsettings{$fwdfwsettings{'grp1'}});
1173 </select></td><td width='1%'><input type='radio' name='grp1' value='ovpn_host_src' $checked{'grp1'}{'ovpn_host_src'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdhost'}</td><td nowrap='nowrap' width='1%'><select name='ovpn_host_src' style='min-width:185px;'>
1175 foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost)
1177 if ($ccdhost{$key}[33] ne ''){
1179 print "<option value='$ccdhost{$key}[1]'";
1180 print "selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $ccdhost{$key}[1]);
1181 print ">$ccdhost{$key}[1]</option>";
1186 <tr><td valign='top'><input type='radio' name='grp1' value='cust_host_src' $checked{'grp1'}{'cust_host_src'}></td><td>$Lang::tr{'fwhost cust addr'}</td><td><select name='cust_host_src' style='min-width:185px;'>
1188 &fillselect
(\
%customhost,$fwdfwsettings{$fwdfwsettings{'grp1'}});
1190 </select></td><td width='1%'><input type='radio' name='grp1' value='ovpn_n2n_src' $checked{'grp1'}{'ovpn_n2n_src'}></td><td >$Lang::tr{'fwhost ovpn_n2n'}</td><td colspan='3'><select name='ovpn_n2n_src' style='min-width:185px;'>
1192 foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost) {
1193 if($ccdhost{$key}[3] eq 'net'){
1195 print " selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $ccdhost{$key}[1]);
1196 print ">$ccdhost{$key}[1]</option>";
1202 <tr><td valign='top'><input type='radio' name='grp1' value='cust_grp_src' $checked{'grp1'}{'cust_grp_src'}></td><td >$Lang::tr{'fwhost cust grp'}</td><td><select name='cust_grp_src' style='min-width:185px;'>
1204 foreach my $key (sort { uc($customgrp{$a}[0]) cmp uc($customgrp{$b}[0]) } keys %customgrp) {
1205 if($helper ne $customgrp{$key}[0]){
1207 print "selected='selected' " if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $customgrp{$key}[0]);
1208 print ">$customgrp{$key}[0]</option>";
1210 $helper=$customgrp{$key}[0];
1214 <td valign='top'><input type='radio' name='grp1' value='ipsec_net_src' $checked{'grp1'}{'ipsec_net_src'}></td><td >$Lang::tr{'fwhost ipsec net'}</td><td><select name='ipsec_net_src' style='min-width:185px;'>
1216 foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
1217 if ($ipsecconf{$key}[3] eq 'net'){
1219 print "selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $ipsecconf{$key}[1]);
1220 print ">$ipsecconf{$key}[1]</option>";
1228 # <td valign='top'><input type='radio' name='grp1' value='ipsec_host_src' $checked{'grp1'}{'ipsec_host_src'}></td><td >$Lang::tr{'fwhost ipsec host'}</td><td><select name='ipsec_host_src' style='min-width:185px;'>
1230 # foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
1231 # if ($ipsecconf{$key}[3] eq 'host'){
1233 # print "selected='selected'" if($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $ipsecconf{$key}[1]);
1234 # print ">$ipsecconf{$key}[1]</option>";
1238 <tr><td colspan='8'><hr style='border:dotted #BFBFBF; border-width:1px 0 0 0 ; ' /></td></tr></table>
1239 <table width='100%' border='0'>
1240 <tr><td width='1%'><input type='checkbox' name='USE_SRC_PORT' value='ON' $checked{'USE_SRC_PORT'}{'ON'}></td><td width='51%' colspan='3'>$Lang::tr{'fwdfw use srcport'}</td>
1241 <td width='15%' nowrap='nowrap'>$Lang::tr{'fwdfw man port'}</td><td><select name='PROT'>
1243 foreach ("TCP","UDP","GRE","ESP","AH","ICMP")
1245 if ($_ eq $fwdfwsettings{'PROT'})
1247 print"<option selected>$_</option>";
1249 print"<option>$_</option>";
1252 $fwdfwsettings{'SRC_PORT'}=~ s/\|/,/g;
1254 </select></td><td align='right'><input type='text' name='SRC_PORT' value='$fwdfwsettings{'SRC_PORT'}' maxlength='20' size='18' ></td></tr>
1255 <tr><td></td><td></td><td></td><td></td><td nowrap='nowrap'>$Lang::tr{'fwhost icmptype'}</td><td colspan='2'><select name='ICMP_TYPES'>
1257 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
1258 print"<option>All ICMP-Types</option>";
1259 foreach my $key (sort { uc($icmptypes{$a}[0]) cmp uc($icmptypes{$b}[0]) } keys %icmptypes){
1260 if($fwdfwsettings{'ICMP_TYPES'} eq "$icmptypes{$key}[0]"){
1261 print"<option selected>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
1263 print"<option>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
1267 </select></td></tr></table><hr>
1269 &Header
::closebox
();
1271 #---TARGET------------------------------------------------------
1272 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw target'});
1274 <table width='100%' border='0'>
1275 <tr><td width='1%'><input type='radio' name='grp2' value='tgt_addr' checked></td><td colspan='2'>$Lang::tr{'fwdfw targetip'}<input type='TEXT' name='tgt_addr' value='$fwdfwsettings{'tgt_addr'}' size='16'><td><input type='radio' name='grp2' value='ipfire' $checked{'grp2'}{'ipfire'}></td><td><b>IPFire ($Lang::tr{'external access'})</b></td><td><select name='ipfire' style='min-width:185px;'>
1277 print "<option value='Default IP' $selected{'ipfire'}{'Default IP'}>Default IP</option>";
1279 foreach my $alias (sort keys %aliases)
1281 print "<option value='$alias' $selected{'ipfire'}{$alias}>$alias</option>";
1286 <tr><td colspan='7'><hr style='border:dotted #BFBFBF; border-width:1px 0 0 0 ; ' /></td></tr>
1287 <tr><td width='1%'><input type='radio' name='grp2' value='std_net_tgt' $checked{'grp2'}{'std_net_tgt'}></td><td nowrap='nowrap' width='12%'>$Lang::tr{'fwhost stdnet'}</td><td width='13%'><select name='std_net_tgt' style='min-width:185px;'>
1289 foreach my $network (sort keys %defaultNetworks)
1291 next if($defaultNetworks{$network}{'NAME'} eq "IPFire");
1292 print "<option value='$defaultNetworks{$network}{'NAME'}'";
1293 print " selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $defaultNetworks{$network}{'NAME'});
1294 print ">$network</option>";
1297 </select></td><td width='1%'><input type='radio' name='grp2' value='ovpn_net_tgt' $checked{'grp2'}{'ovpn_net_tgt'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdnet'}</td><td nowrap='nowrap' width='1%'><select name='ovpn_net_tgt' style='min-width:185px;'>
1299 &fillselect
(\
%ccdnet,$fwdfwsettings{$fwdfwsettings{'grp2'}});
1302 <tr><td><input type='radio' name='grp2' value='cust_net_tgt' $checked{'grp2'}{'cust_net_tgt'}></td><td>$Lang::tr{'fwhost cust net'}</td><td><select name='cust_net_tgt' style='min-width:185px;'>
1304 &fillselect
(\
%customnetwork,$fwdfwsettings{$fwdfwsettings{'grp2'}});
1306 </select></td><td width='1%'><input type='radio' name='grp2' value='ovpn_host_tgt' $checked{'grp2'}{'ovpn_host_tgt'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdhost'}</td><td nowrap='nowrap' width='1%'><select name='ovpn_host_tgt' style='min-width:185px;'>
1308 foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost)
1310 if ($ccdhost{$key}[33] ne ''){
1311 print "<option value='$ccdhost{$key}[1]' ";
1312 print "selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $ccdhost{$key}[33]);
1313 print ">$ccdhost{$key}[1]</option>";
1318 <tr><td valign='top'><input type='radio' name='grp2' value='cust_host_tgt' $checked{'grp2'}{'cust_host_tgt'}></td><td>$Lang::tr{'fwhost cust addr'}</td><td><select name='cust_host_tgt' style='min-width:185px;'>
1320 &fillselect
(\
%customhost,$fwdfwsettings{$fwdfwsettings{'grp2'}});
1322 </select></td><td width='1%'><input type='radio' name='grp2' value='ovpn_n2n_tgt' $checked{'grp2'}{'ovpn_n2n_tgt'}></td><td >$Lang::tr{'fwhost ovpn_n2n'}</td><td colspan='3'><select name='ovpn_n2n_tgt' style='min-width:185px;'>
1324 foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost) {
1325 if($ccdhost{$key}[3] eq 'net'){
1327 print "selected='selected'" if($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $ccdhost{$key}[1]);
1328 print ">$ccdhost{$key}[1]</option>";
1333 <tr><td valign='top'><input type='radio' name='grp2' value='cust_grp_tgt' $checked{'grp2'}{'cust_grp_tgt'}></td><td >$Lang::tr{'fwhost cust grp'}</td><td><select name='cust_grp_tgt' style='min-width:185px;'>
1336 foreach my $key (sort { uc($customgrp{$a}[0]) cmp uc($customgrp{$b}[0]) } keys %customgrp) {
1337 if($helper ne $customgrp{$key}[0]){
1339 print"selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $customgrp{$key}[0]);
1340 print">$customgrp{$key}[0]</option>";
1342 $helper=$customgrp{$key}[0];
1346 <td valign='top'><input type='radio' name='grp2' value='ipsec_net_tgt' $checked{'grp2'}{'ipsec_net_tgt'}></td><td >$Lang::tr{'fwhost ipsec net'}</td><td><select name='ipsec_net_tgt' style='min-width:185px;'>
1348 foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
1349 if ($ipsecconf{$key}[3] eq 'net'){
1351 print"selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $ipsecconf{$key}[1]);
1352 print">$ipsecconf{$key}[1]</option>";
1358 # <td valign='top'><input type='radio' name='grp2' value='ipsec_host_tgt' $checked{'grp2'}{'ipsec_host_tgt'}></td><td >$Lang::tr{'fwhost ipsec host'}</td><td><select name='ipsec_host_tgt' style='min-width:185px;'>
1360 # foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
1361 # if ($ipsecconf{$key}[3] eq 'host'){
1363 # print"selected='Selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $ipsecconf{$key}[1]);
1364 # print">$ipsecconf{$key}[1]</option>";
1369 <b>$Lang::tr{'fwhost attention'}:</b><br>
1370 $Lang::tr{'fwhost macwarn'}<br><hr style='border:dotted #BFBFBF; border-width:1px 0 0 0 ; '></hr><br>
1372 <table width='100%' border='0'>
1373 <tr><td width='1%'><input type='checkbox' name='USESRV' value='ON' $checked{'USESRV'}{'ON'} ></td><td width='48%'>$Lang::tr{'fwdfw use srv'}</td><td width='1%'><input type='radio' name='grp3' value='cust_srv' checked></td><td nowrap='nowrap'>$Lang::tr{'fwhost cust service'}</td><td width='1%' colspan='2'><select name='cust_srv'style='min-width:230px;' >
1375 &General
::readhasharray
("$configsrv", \
%customservice);
1376 foreach my $key (sort { uc($customservice{$a}[0]) cmp uc($customservice{$b}[0]) } keys %customservice){
1378 print"selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp3'}} eq $customservice{$key}[0]);
1379 print"value='$customservice{$key}[0]'>$customservice{$key}[0]</option>";
1383 <tr><td colspan='2'></td><td><input type='radio' name='grp3' value='cust_srvgrp' $checked{'grp3'}{'cust_srvgrp'}></td><td nowrap='nowrap'>$Lang::tr{'fwhost cust srvgrp'}:</td><td colspan='2'><select name='cust_srvgrp'style='min-width:230px;' >
1385 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
1387 foreach my $key (sort { uc($customservicegrp{$a}[0]) cmp uc($customservicegrp{$b}[0]) } keys %customservicegrp){
1388 if ($helper ne $customservicegrp{$key}[0]){
1390 print"selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp3'}} eq $customservicegrp{$key}[0]);
1391 print">$customservicegrp{$key}[0]</option>";
1393 $helper=$customservicegrp{$key}[0];
1397 <tr><td colspan='2'></td><td><input type='radio' name='grp3' value='TGT_PORT' $checked{'grp3'}{'TGT_PORT'}></td><td>$Lang::tr{'fwdfw man port'}</td><td><select name='TGT_PROT'>
1399 foreach ("TCP","UDP","GRE","ESP","AH","ICMP")
1401 if ($_ eq $fwdfwsettings{'TGT_PROT'})
1403 print"<option selected>$_</option>";
1405 print"<option>$_</option>";
1408 $fwdfwsettings{'TGT_PORT'} =~ s/\|/,/g;
1410 </select></td><td align='right'><input type='text' name='TGT_PORT' value='$fwdfwsettings{'TGT_PORT'}' maxlength='20' size='18' ></td></tr>
1411 <tr><td colspan='2'></td><td></td><td>$Lang::tr{'fwhost icmptype'}</td><td colspan='2'><select name='ICMP_TGT'>
1413 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
1414 print"<option>All ICMP-Types</option>";
1415 foreach my $key (sort { uc($icmptypes{$a}[0]) cmp uc($icmptypes{$b}[0]) }keys %icmptypes){
1416 if($fwdfwsettings{'ICMP_TGT'} eq "$icmptypes{$key}[0]"){
1417 print"<option selected>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
1419 print"<option>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
1424 </table><hr><br><br>
1427 #---Activate/logging/remark-------------------------------------
1428 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw additional'});
1430 <table width='100%' border='0'>
1431 <tr><td width='12%'>$Lang::tr{'remark'}:</td><td align='left'><input type='text' name='ruleremark' size='40' maxlength='255' value='$fwdfwsettings{'ruleremark'}'></td></tr>
1433 if($fwdfwsettings{'updatefwrule'} eq 'on' || $fwdfwsettings{'copyfwrule'} eq 'on'){
1434 print "<tr><td width='12%'>$Lang::tr{'fwdfw rulepos'}:</td><td><select name='rulepos' >";
1435 for (my $count =1; $count <= $sum; $count++){
1436 print"<option value='$count' ";
1437 print"selected='selected'" if($fwdfwsettings{'oldrulenumber'} eq $count);
1438 print">$count</option>";
1440 print"</select></td></tr>";
1442 print "<tr><td width='12%'>$Lang::tr{'fwdfw rulepos'}:</td><td><input type='text' name='rulepos' size='2'></td></tr>";
1446 </table><table width='100%'>
1447 <tr><td width='1%'><input type='checkbox' name='ACTIVE' value='ON' $checked{'ACTIVE'}{'ON'}></td><td>$Lang::tr{'fwdfw rule activate'}</td></tr>
1448 <tr><td width='1%'><input type='checkbox' name='LOG' value='ON' $checked{'LOG'}{'ON'} ></td><td>$Lang::tr{'fwdfw log rule'}</td></tr>
1451 &Header
::closebox
();
1452 #---ADD TIMEFRAME-----------------------------------------------
1453 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw timeframe'});
1455 <table width='70%' border='0'>
1456 <tr><td width='1%'><input type='checkbox' name='TIME' value='ON' $checked{'TIME'}{'ON'}></td><td colspan='4'>$Lang::tr{'fwdfw timeframe'}</td></tr>
1457 <tr><td colspan='7'> </td></tr>
1459 <td align='left'>$Lang::tr{'time'}:</td>
1460 <td width='30%' align='left'>$Lang::tr{'advproxy monday'} $Lang::tr{'advproxy tuesday'} $Lang::tr{'advproxy wednesday'} $Lang::tr{'advproxy thursday'} $Lang::tr{'advproxy friday'} $Lang::tr{'advproxy saturday'} $Lang::tr{'advproxy sunday'}</td>
1461 <td width='15%' align='left'>$Lang::tr{'advproxy from'}</td>
1462 <td width='15%' align='left'>$Lang::tr{'advproxy to'}</td>
1465 <td align='right'></td>
1466 <td width='30%' align='left'>
1467 <input type='checkbox' name='TIME_MON' value='on' $checked{'TIME_MON'}{'on'} />
1468 <input type='checkbox' name='TIME_TUE' value='on' $checked{'TIME_TUE'}{'on'} />
1469 <input type='checkbox' name='TIME_WED' value='on' $checked{'TIME_WED'}{'on'} />
1470 <input type='checkbox' name='TIME_THU' value='on' $checked{'TIME_THU'}{'on'} />
1471 <input type='checkbox' name='TIME_FRI' value='on' $checked{'TIME_FRI'}{'on'} />
1472 <input type='checkbox' name='TIME_SAT' value='on' $checked{'TIME_SAT'}{'on'} />
1473 <input type='checkbox' name='TIME_SUN' value='on' $checked{'TIME_SUN'}{'on'} />
1475 <td><select name='TIME_FROM'>
1477 for (my $i=0;$i<=23;$i++) {
1478 $i = sprintf("%02s",$i);
1479 for (my $j=0;$j<=45;$j+=15) {
1480 $j = sprintf("%02s",$j);
1481 my $time = $i.":".$j;
1482 print "\t\t\t\t\t<option $selected{'TIME_FROM'}{$time}>$i:$j</option>\n";
1487 <td><select name='TIME_TO'>
1489 for (my $i=0;$i<=23;$i++) {
1490 $i = sprintf("%02s",$i);
1491 for (my $j=0;$j<=45;$j+=15) {
1492 $j = sprintf("%02s",$j);
1493 my $time = $i.":".$j;
1494 print "\t\t\t\t\t<option $selected{'TIME_TO'}{$time}>$i:$j</option>\n";
1501 &Header
::closebox
();
1502 #---ACTION------------------------------------------------------
1503 if($fwdfwsettings{'updatefwrule'} ne 'on'){
1505 <table border='0' width='100%'>
1506 <tr><td align='right'><input type='submit' value='$Lang::tr{'add'}' style='min-width:100px;' />
1507 <input type='hidden' name='config' value='$config' >
1508 <input type='hidden' name='ACTION' value='saverule' >
1509 </form><form method='post' style='display:inline'><input type='submit' value='$Lang::tr{'fwhost back'}' style='min-width:100px;'><input type='hidden' name='ACTION' value'reset'></td></td>
1514 <table border='0' width='100%'>
1515 <tr><td align='right'><input type='submit' value='$Lang::tr{'fwdfw change'}' style='min-width:100px;' /><input type='hidden' name='updatefwrule' value='$fwdfwsettings{'updatefwrule'}'><input type='hidden' name='key' value='$fwdfwsettings{'key'}'>
1516 <input type='hidden' name='oldgrp1a' value='$fwdfwsettings{'oldgrp1a'}' />
1517 <input type='hidden' name='oldgrp1b' value='$fwdfwsettings{'oldgrp1b'}' />
1518 <input type='hidden' name='oldgrp2a' value='$fwdfwsettings{'oldgrp2a'}' />
1519 <input type='hidden' name='oldgrp2b' value='$fwdfwsettings{'oldgrp2b'}' />
1520 <input type='hidden' name='oldgrp3a' value='$fwdfwsettings{'oldgrp3a'}' />
1521 <input type='hidden' name='oldgrp3b' value='$fwdfwsettings{'oldgrp3b'}' />
1522 <input type='hidden' name='oldusesrv' value='$fwdfwsettings{'oldusesrv'}' />
1523 <input type='hidden' name='oldrulenumber' value='$fwdfwsettings{'oldrulenumber'}' />
1524 <input type='hidden' name='rulenumber' value='$fwdfwsettings{'rulepos'}' />
1525 <input type='hidden' name='oldruleremark' value='$fwdfwsettings{'oldruleremark'}' />
1526 <input type='hidden' name='ACTION' value='saverule' ></form><form method='post' style='display:inline'><input type='submit' value='$Lang::tr{'fwhost back'}' style='min-width:100px;'><input type='hidden' name='ACTION' value'reset'></td></td>
1530 &Header
::closebox
();
1536 &General
::readhasharray
("$config", $hash);
1537 if (!$errormessage){
1538 #check if we change an forward rule to an external access
1539 if( $fwdfwsettings{'grp2'} eq 'ipfire' && $fwdfwsettings{'oldgrp2a'} ne 'ipfire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1540 &changerule
($configfwdfw);
1542 #check if we change an forward rule to an outgoing
1543 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} eq 'IPFire' && $fwdfwsettings{'oldgrp1b'} ne 'IPFire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1544 &changerule
($configfwdfw);
1546 #check if we change an external access rule to a forward
1547 if( $fwdfwsettings{'grp2'} ne 'ipfire' && $fwdfwsettings{'oldgrp2a'} eq 'ipfire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1548 &changerule
($configinput);
1550 #check if we change an external access rule to a outgoing
1551 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} eq 'IPFire' && $fwdfwsettings{'grp2'} ne 'ipfire' && $fwdfwsettings{'oldgrp2a'} eq 'ipfire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1552 &changerule
($configinput);
1554 #check if we change an outgoing rule to a forward
1555 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} ne 'IPFire' && $fwdfwsettings{'oldgrp1b'} eq 'IPFire' && $fwdfwsettings{'grp2'} ne 'ipfire' &&$fwdfwsettings{'updatefwrule'} eq 'on'){
1556 &changerule
($configoutgoing);
1558 #check if we change an outgoing rule to a external access
1559 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} ne 'IPFire' && $fwdfwsettings{'oldgrp1b'} eq 'IPFire' && $fwdfwsettings{'grp2'} eq 'ipfire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1560 &changerule
($configoutgoing);
1562 if ($fwdfwsettings{'updatefwrule'} ne 'on'){
1563 my $key = &General
::findhasharraykey
($hash);
1564 $$hash{$key}[0] = $fwdfwsettings{'RULE_ACTION'};
1565 $$hash{$key}[1] = $fwdfwsettings{'chain'};
1566 $$hash{$key}[2] = $fwdfwsettings{'ACTIVE'};
1567 $$hash{$key}[3] = $fwdfwsettings{'grp1'};
1568 $$hash{$key}[4] = $fwdfwsettings{$fwdfwsettings{'grp1'}};
1569 $$hash{$key}[5] = $fwdfwsettings{'grp2'};
1570 $$hash{$key}[6] = $fwdfwsettings{$fwdfwsettings{'grp2'}};
1571 $$hash{$key}[7] = $fwdfwsettings{'USE_SRC_PORT'};
1572 $$hash{$key}[8] = $fwdfwsettings{'PROT'};
1573 $$hash{$key}[9] = $fwdfwsettings{'ICMP_TYPES'};
1574 $$hash{$key}[10] = $fwdfwsettings{'SRC_PORT'};
1575 $$hash{$key}[11] = $fwdfwsettings{'USESRV'};
1576 $$hash{$key}[12] = $fwdfwsettings{'TGT_PROT'};
1577 $$hash{$key}[13] = $fwdfwsettings{'ICMP_TGT'};
1578 $$hash{$key}[14] = $fwdfwsettings{'grp3'};
1579 $$hash{$key}[15] = $fwdfwsettings{$fwdfwsettings{'grp3'}};
1580 $$hash{$key}[16] = $fwdfwsettings{'ruleremark'};
1581 $$hash{$key}[17] = $fwdfwsettings{'LOG'};
1582 $$hash{$key}[18] = $fwdfwsettings{'TIME'};
1583 $$hash{$key}[19] = $fwdfwsettings{'TIME_MON'};
1584 $$hash{$key}[20] = $fwdfwsettings{'TIME_TUE'};
1585 $$hash{$key}[21] = $fwdfwsettings{'TIME_WED'};
1586 $$hash{$key}[22] = $fwdfwsettings{'TIME_THU'};
1587 $$hash{$key}[23] = $fwdfwsettings{'TIME_FRI'};
1588 $$hash{$key}[24] = $fwdfwsettings{'TIME_SAT'};
1589 $$hash{$key}[25] = $fwdfwsettings{'TIME_SUN'};
1590 $$hash{$key}[26] = $fwdfwsettings{'TIME_FROM'};
1591 $$hash{$key}[27] = $fwdfwsettings{'TIME_TO'};
1592 &General
::writehasharray
("$config", $hash);
1594 foreach my $key (sort {$a <=> $b} keys %$hash){
1595 if($key eq $fwdfwsettings{'key'}){
1596 $$hash{$key}[0] = $fwdfwsettings{'RULE_ACTION'};
1597 $$hash{$key}[1] = $fwdfwsettings{'chain'};
1598 $$hash{$key}[2] = $fwdfwsettings{'ACTIVE'};
1599 $$hash{$key}[3] = $fwdfwsettings{'grp1'};
1600 $$hash{$key}[4] = $fwdfwsettings{$fwdfwsettings{'grp1'}};
1601 $$hash{$key}[5] = $fwdfwsettings{'grp2'};
1602 $$hash{$key}[6] = $fwdfwsettings{$fwdfwsettings{'grp2'}};
1603 $$hash{$key}[7] = $fwdfwsettings{'USE_SRC_PORT'};
1604 $$hash{$key}[8] = $fwdfwsettings{'PROT'};
1605 $$hash{$key}[9] = $fwdfwsettings{'ICMP_TYPES'};
1606 $$hash{$key}[10] = $fwdfwsettings{'SRC_PORT'};
1607 $$hash{$key}[11] = $fwdfwsettings{'USESRV'};
1608 $$hash{$key}[12] = $fwdfwsettings{'TGT_PROT'};
1609 $$hash{$key}[13] = $fwdfwsettings{'ICMP_TGT'};
1610 $$hash{$key}[14] = $fwdfwsettings{'grp3'};
1611 $$hash{$key}[15] = $fwdfwsettings{$fwdfwsettings{'grp3'}};
1612 $$hash{$key}[16] = $fwdfwsettings{'ruleremark'};
1613 $$hash{$key}[17] = $fwdfwsettings{'LOG'};
1614 $$hash{$key}[18] = $fwdfwsettings{'TIME'};
1615 $$hash{$key}[19] = $fwdfwsettings{'TIME_MON'};
1616 $$hash{$key}[20] = $fwdfwsettings{'TIME_TUE'};
1617 $$hash{$key}[21] = $fwdfwsettings{'TIME_WED'};
1618 $$hash{$key}[22] = $fwdfwsettings{'TIME_THU'};
1619 $$hash{$key}[23] = $fwdfwsettings{'TIME_FRI'};
1620 $$hash{$key}[24] = $fwdfwsettings{'TIME_SAT'};
1621 $$hash{$key}[25] = $fwdfwsettings{'TIME_SUN'};
1622 $$hash{$key}[26] = $fwdfwsettings{'TIME_FROM'};
1623 $$hash{$key}[27] = $fwdfwsettings{'TIME_TO'};
1628 &General
::writehasharray
("$config", $hash);
1629 if($fwdfwsettings{'oldrulenumber'} > $fwdfwsettings{'rulepos'}){
1631 my $val=$fwdfwsettings{'oldrulenumber'}-$fwdfwsettings{'rulepos'};
1632 for (my $z=0;$z<$val;$z++){
1633 foreach my $key (sort {$a <=> $b} keys %$hash){
1634 if ($key eq $fwdfwsettings{'oldrulenumber'}) {
1636 if (exists $$hash{$last}){
1638 foreach my $y (0 .. $#{$$hash{$last}}) {
1639 $tmp{0}[$y] = $$hash{$last}[$y];
1641 #copy active rule to last
1642 foreach my $i (0 .. $#{$$hash{$last}}) {
1643 $$hash{$last}[$i] = $$hash{$key}[$i];
1645 #copy saved rule to actual position
1646 foreach my $x (0 .. $#{$tmp{0}}) {
1647 $$hash{$key}[$x] = $tmp{0}[$x];
1652 $fwdfwsettings{'oldrulenumber'}--;
1654 &General
::writehasharray
("$config", $hash);
1656 }elsif($fwdfwsettings{'rulepos'} > $fwdfwsettings{'oldrulenumber'}){
1658 my $val=$fwdfwsettings{'rulepos'}-$fwdfwsettings{'oldrulenumber'};
1659 for (my $z=0;$z<$val;$z++){
1660 foreach my $key (sort {$a <=> $b} keys %$hash){
1661 if ($key eq $fwdfwsettings{'oldrulenumber'}) {
1662 my $next = $key + 1;
1663 if (exists $$hash{$next}){
1665 foreach my $y (0 .. $#{$$hash{$next}}) {
1666 $tmp{0}[$y] = $$hash{$next}[$y];
1668 #copy active rule to next
1669 foreach my $i (0 .. $#{$$hash{$next}}) {
1670 $$hash{$next}[$i] = $$hash{$key}[$i];
1672 #copy saved rule to actual position
1673 foreach my $x (0 .. $#{$tmp{0}}) {
1674 $$hash{$key}[$x] = $tmp{0}[$x];
1679 $fwdfwsettings{'oldrulenumber'}++;
1681 &General
::writehasharray
("$config", $hash);
1688 if ($errormessage) {
1689 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
1690 print "<class name='base'>$errormessage\n";
1691 print " </class>\n";
1692 &Header
::closebox
();
1699 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost hint'});
1700 print "<class name='base'>$hint\n";
1701 print " </class>\n";
1702 &Header
::closebox
();
1709 &General
::setup_default_networks
(\
%defaultNetworks);
1710 foreach my $network (sort keys %defaultNetworks)
1712 return "$network" if ($val eq $defaultNetworks{$network}{'NAME'});
1717 # Checks a hostname against RFC1035
1720 # Each part should be at least two characters in length
1721 # but no more than 63 characters
1722 if (length ($remark) < 1 || length ($remark) > 255) {
1724 # Only valid characters are a-z, A-Z, 0-9 and -
1725 if ($remark !~ /^[a-zäöüA-ZÖÄÜ0-9-.:;_\/\s
]*$/) {
1727 # First character can only be a letter or a digit
1728 if (substr ($remark, 0, 1) !~ /^[a-zäöüA-ZÖÄÜ0-9]*$/) {
1730 # Last character can only be a letter or a digit
1731 if (substr ($remark, -1, 1) !~ /^[a-zöäüA-ZÖÄÜ0-9.]*$/) {
1737 my %hash=%{(shift)};
1739 if($hash{$key}[7] eq 'ON' && $hash{$key}[8] ne '' && $hash{$key}[10]){
1740 $hash{$key}[10]=~ s/\|/,/g;
1741 print": $hash{$key}[10]";
1742 }elsif($hash{$key}[7] eq 'ON' && $hash{$key}[8] eq 'ICMP'){
1743 print": <br>$hash{$key}[9] ";
1748 my %hash=%{(shift)};
1752 if($hash{$key}[11] eq 'ON' && $hash{$key}[12] ne 'ICMP'){
1753 if($hash{$key}[14] eq 'cust_srv'){
1754 &General
::readhasharray
("$configsrv", \
%customservice);
1755 foreach my $i (sort keys %customservice){
1756 if($customservice{$i}[0] eq $hash{$key}[15]){
1757 $service = $customservice{$i}[0];
1760 }elsif($hash{$key}[14] eq 'cust_srvgrp'){
1761 $service=$hash{$key}[15];
1762 }elsif($hash{$key}[14] eq 'TGT_PORT'){
1763 $hash{$key}[15]=~ s/\|/,/g;
1764 $service=$hash{$key}[15];
1769 }elsif($hash{$key}[11] eq 'ON' && $hash{$key}[12] eq 'ICMP'){
1770 print":<br>$hash{$key}[13]";
1773 sub get_serviceports
1777 &General
::readhasharray
("$configsrv", \
%customservice);
1778 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
1782 if($type eq 'service'){
1783 foreach my $key (sort { uc($customservice{$a}[0]) cmp uc($customservice{$b}[0]) } keys %customservice){
1784 if ($customservice{$key}[0] eq $name){
1785 $protocols=$customservice{$key}[2];
1788 }elsif($type eq 'group'){
1789 foreach my $key (sort { uc($customservicegrp{$a}[0]) cmp uc($customservicegrp{$b}[0]) } keys %customservicegrp){
1790 if ($customservicegrp{$key}[0] eq $name){
1791 foreach my $key1 (sort { uc($customservice{$a}[0]) cmp uc($customservice{$b}[0]) } keys %customservice){
1792 if ($customservice{$key1}[0] eq $customservicegrp{$key}[2]){
1793 if($customservice{$key1}[2] eq 'TCP'){$tcp='TCP';}else{$udp='UDP';}
1799 if($tcp && $udp){$protocols="TCP,UDP";
1800 }elsif($tcp){$protocols.="TCP";
1801 }elsif($udp){$protocols.="UDP";}
1807 &viewtablenew
(\
%configfwdfw,$configfwdfw,$Lang::tr
{'fwdfw rules'},"Forward" );
1808 &viewtablenew
(\
%configfwdfw,$configfwdfw,'',"DMZ" );
1809 &viewtablenew
(\
%configfwdfw,$configfwdfw,'',"WLAN" );
1810 &viewtablenew
(\
%configinputfw,$configinput,"",$Lang::tr
{'external access'} );
1811 &viewtablenew
(\
%configoutgoingfw,$configoutgoing,"","Outgoing" );
1820 &General
::readhasharray
("$config", $hash);
1821 #check if there are DMZ entries
1822 if ($title1 eq 'DMZ'){
1823 foreach my $key (keys %$hash){
1824 if ($$hash{$key}[4] eq 'ORANGE'){$go='on';last}
1826 }elsif($title1 eq 'WLAN'){
1827 foreach my $key (keys %$hash){
1828 if ($$hash{$key}[4] eq 'BLUE'){$go='on';last}
1830 }elsif($title1 eq 'Forward'){
1831 foreach my $key (keys %$hash){
1832 if (($$hash{$key}[4] ne 'ORANGE' && $$hash{$key}[4] ne 'BLUE')){$go='on';last}
1834 }elsif( ! -z
$config){
1838 &Header
::openbox
('100%', 'left',$title);
1846 print"<b>$title1</b><br>";
1847 print"<table width='100%' border='0' cellspacing='1' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;'>";
1848 print"<tr><td align='center' width='1%'><b>#</td><td width='1%'></td><td align='center' ><b>$Lang::tr{'fwdfw source'}</td><td width='1%'><b>Log</td><td align='center' width='20%'><b>$Lang::tr{'fwdfw target'}</td><td align='center'><b>$Lang::tr{'protocol'}</b></td><td align='center' width='70%'><b>$Lang::tr{'remark'}</td><td align='center' colspan='3' width='1%'><b>$Lang::tr{'fwdfw action'}</td></tr>";
1849 foreach my $key (sort {$a <=> $b} keys %$hash){
1850 #check if we have a FORWARDFW OR DMZ RULE
1851 if ($title1 eq 'DMZ' && ($$hash{$key}[4] ne 'ORANGE')){next;}
1852 if ($title1 eq 'WLAN' && ($$hash{$key}[4] ne 'BLUE')){next;}
1853 if ($title1 eq 'Forward' && ($$hash{$key}[4] eq 'ORANGE' || $$hash{$key}[4] eq 'BLUE')){next;}
1855 #check if vpn hosts/nets have been deleted
1856 if($$hash{$key}[3] =~ /ipsec/i || $$hash{$key}[3] =~ /ovpn/i){
1857 push (@tmpsrc,$$hash{$key}[4]);
1859 if($$hash{$key}[5] =~ /ipsec/i || $$hash{$key}[5] =~ /ovpn/i){
1860 push (@tmpsrc,$$hash{$key}[6]);
1862 foreach my $host (@tmpsrc){
1863 if($$hash{$key}[3] eq 'ipsec_net_src' || $$hash{$key}[5] eq 'ipsec_net_tgt'){
1864 if(&fwlib
::get_ipsec_net_ip
($host,11) eq ''){
1866 &disable_rule
($key);
1869 }elsif($$hash{$key}[3] eq 'ovpn_net_src' || $$hash{$key}[5] eq 'ovpn_net_tgt'){
1870 if(&fwlib
::get_ovpn_net_ip
($host,1) eq ''){
1872 &disable_rule
($key);
1875 }elsif($$hash{$key}[3] eq 'ovpn_n2n_src' || $$hash{$key}[5] eq 'ovpn_n2n_tgt'){
1876 if(&fwlib
::get_ovpn_n2n_ip
($host,27) eq ''){
1878 &disable_rule
($key);
1881 }elsif($$hash{$key}[3] eq 'ovpn_host_src' || $$hash{$key}[5] eq 'ovpn_host_tgt'){
1882 if(&fwlib
::get_ovpn_host_ip
($host,33) eq ''){
1884 &disable_rule
($key);
1891 $$hash{'ACTIVE'}=$$hash{$key}[2];
1893 if($coloryellow eq 'on'){
1894 print"<tr bgcolor='$color{'color14'}' >";
1896 }elsif($coloryellow eq ''){
1898 print"<tr bgcolor='$color{'color22'}' >";
1901 print"<tr bgcolor='$color{'color20'}' >";
1905 <td align='right'>$key</td>
1907 if ($$hash{$key}[0] eq 'ACCEPT'){
1910 $rulecolor=$color{'color17'};
1911 }elsif($$hash{$key}[0] eq 'DROP'){
1914 $rulecolor=$color{'color25'};
1915 }elsif($$hash{$key}[0] eq 'REJECT'){
1918 $rulecolor=$color{'color16'};
1920 print"<td bgcolor='$rulecolor' width='2%' align='center'><span title='$tooltip'><b>$ruletype</b></span></td>";
1921 print"<td align='center' nowrap='nowrap'>";
1922 if ($$hash{$key}[3] eq 'std_net_src'){
1923 print &get_name
($$hash{$key}[4]);
1925 print $$hash{$key}[4];
1927 &getsrcport
(\
%$hash,$key);
1928 if ($$hash{$key}[17] eq 'ON'){
1929 $log="/images/on.gif";
1931 $log="/images/off.gif";
1935 <form method='post'>
1936 <td width='1%' align='left'><input type='image' img src='$log' alt='$Lang::tr{'click to disable'}' title='$Lang::tr{'fwdfw togglelog'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;'/>
1937 <input type='hidden' name='key' value='$key' />
1938 <input type='hidden' name='config' value='$config' />
1939 <input type='hidden' name='ACTION' value='$Lang::tr{'fwdfw togglelog'}' />
1943 <td align='center' nowrap='nowrap'>
1945 if ($$hash{$key}[5] eq 'std_net_tgt'){
1946 print &get_name
($$hash{$key}[6]);
1948 print $$hash{$key}[6];
1950 &gettgtport
(\
%$hash,$key);
1951 ################################################################################
1955 if ($$hash{$key}[12]){ #target prot if manual
1956 $prot=$$hash{$key}[12];
1957 }elsif($$hash{$key}[8]){ #source prot if manual
1958 $prot=$$hash{$key}[8];
1959 }elsif($$hash{$key}[14] eq 'cust_srv'){
1960 $prot=&get_serviceports
("service",$$hash{$key}[15]);
1961 }elsif($$hash{$key}[14] eq 'cust_srvgrp'){
1962 $prot=&get_serviceports
("group",$$hash{$key}[15]);
1964 $prot=$Lang::tr
{'all'};
1966 print"<td align='center'>$prot</td>";
1968 print"<td width='20%'>$$hash{$key}[16]</td>";
1970 if($$hash{$key}[2] eq 'ON'){
1971 $gif="/images/on.gif"
1974 $gif="/images/off.gif"
1977 <form method='post'>
1978 <td width='1%'><input type='image' img src='$gif' alt='$Lang::tr{'click to disable'}' title='$Lang::tr{'fwdfw toggle'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
1979 <input type='hidden' name='key' value='$key' />
1980 <input type='hidden' name='config' value='$config' />
1981 <input type='hidden' name='ACTION' value='$Lang::tr{'fwdfw toggle'}' />
1983 <form method='post'>
1984 <td width='1%' ><input type='image' img src='/images/edit.gif' alt='$Lang::tr{'edit'}' title='$Lang::tr{'fwdfw edit'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
1985 <input type='hidden' name='key' value='$key' />
1986 <input type='hidden' name='config' value='$config' />
1987 <input type='hidden' name='ACTION' value='editrule' />
1989 <form method='post'>
1990 <td width='1%'><input type='image' img src='/images/addblue.gif' alt='$Lang::tr{'fwdfw copy'}' title='$Lang::tr{'fwdfw copy'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
1991 <input type='hidden' name='key' value='$key' />
1992 <input type='hidden' name='config' value='$config' />
1993 <input type='hidden' name='ACTION' value='copyrule' />
1995 <form method='post'>
1996 <td width='1%' ><input type='image' img src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'fwdfw delete'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
1997 <input type='hidden' name='key' value='$key' />
1998 <input type='hidden' name='config' value='$config' />
1999 <input type='hidden' name='ACTION' value='deleterule' />
2002 if (exists $$hash{$key-1}){
2004 <form method='post'>
2005 <td width='1%'><input type='image' img src='/images/up.gif' alt='$Lang::tr{'fwdfw moveup'}' title='$Lang::tr{'fwdfw moveup'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
2006 <input type='hidden' name='key' value='$key' />
2007 <input type='hidden' name='config' value='$config' />
2008 <input type='hidden' name='ACTION' value='moveup' />
2014 if (exists $$hash{$key+1}){
2016 <form method='post'>
2017 <td width='1%' ><input type='image' img src='/images/down.gif' alt='$Lang::tr{'fwdfw movedown'}' title='$Lang::tr{'fwdfw movedown'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
2018 <input type='hidden' name='key' value='$key' />
2019 <input type='hidden' name='config' value='$config' />
2020 <input type='hidden' name='ACTION' value='movedown' />
2021 </td></form></td></tr>
2024 print"<td></td></tr>";
2026 #if timeframe set, print new line in table
2027 if ($$hash{$key}[18] eq 'ON'){
2029 if($$hash{$key}[19] ne ''){push (@days,$Lang::tr
{'fwdfw wd_mon'});}
2030 if($$hash{$key}[20] ne ''){push (@days,$Lang::tr
{'fwdfw wd_tue'});}
2031 if($$hash{$key}[21] ne ''){push (@days,$Lang::tr
{'fwdfw wd_wed'});}
2032 if($$hash{$key}[22] ne ''){push (@days,$Lang::tr
{'fwdfw wd_thu'});}
2033 if($$hash{$key}[23] ne ''){push (@days,$Lang::tr
{'fwdfw wd_fri'});}
2034 if($$hash{$key}[24] ne ''){push (@days,$Lang::tr
{'fwdfw wd_sat'});}
2035 if($$hash{$key}[25] ne ''){push (@days,$Lang::tr
{'fwdfw wd_sun'});}
2036 my $weekdays=join(",",@days);
2038 print"<tr bgcolor='#FFE4B5'><td colspan='6'>$Lang::tr{'fwdfw time'} ";
2040 print "  $Lang::tr{'fwdfw from'} $$hash{$key}[26]   $Lang::tr{'fwdfw till'} $$hash{$key}[27]</td><td colspan='8'></d></tr>";
2045 &Header
::closebox
();
2051 open( FILE
, "< $p2pfile" ) or die "Unable to read $p2pfile";
2054 &Header
::openbox
('100%', 'center', 'P2P-Block');
2056 <table width='35%' border='0'>
2057 <tr bgcolor='$color{'color22'}'><td align=center colspan='2' ><b>$Lang::tr{'protocol'}</b></td><td align='center'><b>$Lang::tr{'status'}</b></td></tr>
2059 foreach my $p2pentry (sort @p2ps)
2061 my @p2pline = split( /\;/, $p2pentry );
2062 if($p2pline[2] eq 'on'){
2063 $gif="/images/on.gif"
2065 $gif="/images/off.gif"
2068 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
2069 <tr bgcolor='$color{'color20'}'>
2070 <td align='center' colspan='2' >$p2pline[0]:</td><td align='center'><input type='hidden' name='P2PROT' value='$p2pline[1]' /><input type='image' img src='$gif' alt='$Lang::tr{'click to disable'}' title='$Lang::tr{'fwdfw toggle'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' ><input type='hidden' name='ACTION' value='togglep2p'></td></tr></form>
2073 print"<tr><td><img src='/images/on.gif'></td><td align='left'>$Lang::tr{'outgoing firewall p2p allow'}</td></tr>";
2074 print"<tr><td><img src='/images/off.gif'></td><td align='left'>$Lang::tr{'outgoing firewall p2p deny'}</td></tr></table>";
2075 &Header
::closebox
();
2079 my %hash=%{(shift)};
2082 foreach my $key (sort { uc($hash{$a}[0]) cmp uc($hash{$b}[0]) } keys %hash){
2083 if($hash{$key}[0] eq $val){
2084 print"<option value='$hash{$key}[0]' selected>$hash{$key}[0]</option>";
2086 print"<option value='$hash{$key}[0]'>$hash{$key}[0]</option>";
2092 if (!-f
"${General::swroot}/forward/reread"){
2093 system("touch ${General::swroot}/forward/reread");
2098 system("/usr/local/bin/forwardfwctrl");
2099 if ( -f
"${General::swroot}/forward/reread"){
2100 system("rm ${General::swroot}/forward/reread");
2103 &Header
::closebigbox
();
2104 &Header
::closepage
();