]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - html/cgi-bin/fwhosts.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2011 IPFire Team <info@ipfire.org> #
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 ###############################################################################
21 # New function for forwarding firewall. To make it comfortable to create #
22 # rules, we need "spelling names" for single Hosts. If you have any questions #
23 # <amarx@ipfire.org> #
24 ###############################################################################
27 # enable only the following on debugging purpose
30 use CGI
::Carp
'fatalsToBrowser';
31 no warnings
'uninitialized';
32 require '/var/ipfire/general-functions.pl';
33 require "${General::swroot}/lang.pl";
34 require "${General::swroot}/header.pl";
36 my %fwhostsettings=();
41 my %customservicegrp=();
47 my %defaultNetworks=();
57 my $confignet = "${General::swroot}/fwhosts/customnetworks";
58 my $confighost = "${General::swroot}/fwhosts/customhosts";
59 my $configgrp = "${General::swroot}/fwhosts/customgroups";
60 my $configccdnet = "${General::swroot}/ovpn/ccd.conf";
61 my $configccdhost = "${General::swroot}/ovpn/ovpnconfig";
62 my $configipsec = "${General::swroot}/vpn/config";
63 my $configsrv = "${General::swroot}/fwhosts/customservices";
64 my $configsrvgrp = "${General::swroot}/fwhosts/customservicegrp";
65 my $fwconfigfwd = "${General::swroot}/forward/config";
66 my $fwconfiginp = "${General::swroot}/forward/input";
68 unless (-e
$confignet) { system("touch $confignet"); }
69 unless (-e
$confighost) { system("touch $confighost"); }
70 unless (-e
$configgrp) { system("touch $configgrp"); }
71 unless (-e
$configsrv) { system("touch $configsrv"); }
72 unless (-e
$configsrvgrp) { system("touch $configsrvgrp"); }
74 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
75 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
76 &General
::readhash
("${General::swroot}/ethernet/settings", \
%ownnet);
77 &Header
::getcgihash
(\
%fwhostsettings);
79 &Header
::showhttpheaders
();
80 &Header
::openpage
($Lang::tr
{'fwhost hosts'}, 1, '');
81 &Header
::openbigbox
('100%', 'center');
86 \$(document).ready(function() {
87 // Automatically select radio buttons when corresponding
88 // dropdown menu changes.
89 \$("select").change(function() {
90 var id = \$(this).attr("name");
91 //When using SNAT or DNAT, check "USE NAT" Checkbox
92 if ( id === 'snat' || id === 'dnat') {
93 \$('#USE_NAT').prop('checked', true);
95 \$('#' + id).prop("checked", true);
102 if ($fwhostsettings{'ACTION'} eq $Lang::tr
{'fwdfw reread'})
108 if ($fwhostsettings{'ACTION'} eq 'updatenet' )
110 &General
::readhasharray
("$confignet", \
%customnetwork);
111 foreach my $key (keys %customnetwork)
113 if($customnetwork{$key}[0] eq $fwhostsettings{'orgname'})
115 $fwhostsettings{'orgname'} = $customnetwork{$key}[0];
116 $fwhostsettings{'orgip'} = $customnetwork{$key}[1];
117 $fwhostsettings{'orgsub'} = $customnetwork{$key}[2];
118 $fwhostsettings{'netremark'} = $customnetwork{$key}[3];
119 $fwhostsettings{'count'} = $customnetwork{$key}[4];
120 delete $customnetwork{$key};
124 &General
::writehasharray
("$confignet", \
%customnetwork);
125 $fwhostsettings{'actualize'} = 'on';
126 $fwhostsettings{'ACTION'} = 'savenet';
128 if ($fwhostsettings{'ACTION'} eq 'updatehost')
131 &General
::readhasharray
("$confighost", \
%customhost);
132 foreach my $key (keys %customhost)
134 if($customhost{$key}[0] eq $fwhostsettings{'orgname'})
136 if ($customhost{$key}[1] eq 'ip'){
137 ($ip,$subnet) = split (/\//,$customhost{$key}[2]);
139 $ip = $customhost{$key}[2];
141 $fwhostsettings{'orgip'} = $ip;
142 $fwhostsettings{'count'} = $customhost{$key}[4];
143 delete $customhost{$key};
144 &General
::writehasharray
("$confighost", \
%customhost);
147 $fwhostsettings{'actualize'} = 'on';
148 if($fwhostsettings{'orgip'}){
149 $fwhostsettings{'ACTION'} = 'savehost';
151 $fwhostsettings{'ACTION'} = $Lang::tr
{'fwhost newhost'};
154 if ($fwhostsettings{'ACTION'} eq 'updateservice')
158 $errormessage=&checkports
(\
%customservice);
160 &General
::readhasharray
("$configsrv", \
%customservice);
161 foreach my $key (keys %customservice)
163 if ($customservice{$key}[0] eq $fwhostsettings{'oldsrvname'})
165 $count=$customservice{$key}[4];
166 delete $customservice{$key};
167 &General
::writehasharray
("$configsrv", \
%customservice);
171 if ($fwhostsettings{'PROT'} ne 'ICMP'){
172 $fwhostsettings{'ICMP_TYPES'}='BLANK';
174 my $key1 = &General
::findhasharraykey
(\
%customservice);
175 foreach my $i (0 .. 4) { $customservice{$key1}[$i] = "";}
176 $customservice{$key1}[0] = $fwhostsettings{'SRV_NAME'};
177 $customservice{$key1}[1] = $fwhostsettings{'SRV_PORT'};
178 $customservice{$key1}[2] = $fwhostsettings{'PROT'};
179 $customservice{$key1}[3] = $fwhostsettings{'ICMP_TYPES'};
180 $customservice{$key1}[4] = $count;
181 &General
::writehasharray
("$configsrv", \
%customservice);
182 #check if we need to update firewallrules
183 if ($fwhostsettings{'SRV_NAME'} ne $fwhostsettings{'oldsrvname'}){
184 if ( ! -z
$fwconfigfwd ){
185 &General
::readhasharray
("$fwconfigfwd", \
%fwfwd);
186 foreach my $key (sort keys %fwfwd){
187 if ($fwfwd{$key}[15] eq $fwhostsettings{'oldsrvname'}){
188 $fwfwd{$key}[15] = $fwhostsettings{'SRV_NAME'};
191 &General
::writehasharray
("$fwconfigfwd", \
%fwfwd);
193 if ( ! -z
$fwconfiginp ){
194 &General
::readhasharray
("$fwconfiginp", \
%fwinp);
195 foreach my $line (sort keys %fwinp){
196 if ($fwfwd{$line}[15] eq $fwhostsettings{'oldsrvname'}){
197 $fwfwd{$line}[15] = $fwhostsettings{'SRV_NAME'};
200 &General
::writehasharray
("$fwconfiginp", \
%fwinp);
202 #check if we need to update groups
203 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
204 foreach my $key (sort keys %customservicegrp){
205 if($customservicegrp{$key}[2] eq $fwhostsettings{'oldsrvname'}){
206 $customservicegrp{$key}[2] = $fwhostsettings{'SRV_NAME'};
209 &General
::writehasharray
("$configsrvgrp", \
%customservicegrp);
212 if($count gt 0 && $fwhostsettings{'oldsrvport'} ne $fwhostsettings{'SRV_PORT'} ){
215 if($count gt 0 && $fwhostsettings{'oldsrvprot'} ne $fwhostsettings{'PROT'} ){
218 $fwhostsettings{'SRV_NAME'} = '';
219 $fwhostsettings{'SRV_PORT'} = '';
220 $fwhostsettings{'PROT'} = '';
222 $fwhostsettings{'SRV_NAME'} = $fwhostsettings{'oldsrvname'};
223 $fwhostsettings{'SRV_PORT'} = $fwhostsettings{'oldsrvport'};
224 $fwhostsettings{'PROT'} = $fwhostsettings{'oldsrvprot'};
225 $fwhostsettings{'updatesrv'}= 'on';
227 if($needrules eq 'on'){
233 if ($fwhostsettings{'ACTION'} eq 'savenet' )
237 if ($fwhostsettings{'orgname'} eq ''){$fwhostsettings{'orgname'}=$fwhostsettings{'HOSTNAME'};}
238 #check if all fields are set
239 if ($fwhostsettings{'HOSTNAME'} eq '' || $fwhostsettings{'IP'} eq '' || $fwhostsettings{'SUBNET'} eq '')
241 $errormessage=$errormessage.$Lang::tr
{'fwhost err empty'};
246 if (!&General
::validipandmask
($fwhostsettings{'IP'}."/".$fwhostsettings{'SUBNET'}))
248 $errormessage=$errormessage.$Lang::tr
{'fwhost err addr'};
249 $fwhostsettings{'BLK_HOST'} ='readonly';
250 $fwhostsettings{'NOCHECK'} ='false';
251 $fwhostsettings{'error'} ='on';
254 if ($fwhostsettings{'NETREMARK'} ne '' && !&validremark
($fwhostsettings{'NETREMARK'})){
255 $errormessage=$Lang::tr
{'fwhost err remark'};
256 $fwhostsettings{'error'} ='on';
258 #check if subnet is sigle host
259 if(&General
::iporsubtocidr
($fwhostsettings{'SUBNET'}) eq '32')
261 $errormessage=$errormessage.$Lang::tr
{'fwhost err sub32'};
263 if($fwhostsettings{'error'} ne 'on'){
264 #check if we use one of ipfire's networks (green,orange,blue)
265 if (($ownnet{'GREEN_NETADDRESS'} ne '' && $ownnet{'GREEN_NETADDRESS'} ne '0.0.0.0') && &General
::IpInSubnet
($fwhostsettings{'IP'},$ownnet{'GREEN_NETADDRESS'},$ownnet{'GREEN_NETMASK'}))
267 $errormessage=$errormessage.$Lang::tr
{'ccd err green'}."<br>";
268 $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
269 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
271 if (($ownnet{'ORANGE_NETADDRESS'} ne '' && $ownnet{'ORANGE_NETADDRESS'} ne '0.0.0.0') && &General
::IpInSubnet
($fwhostsettings{'IP'},$ownnet{'ORANGE_NETADDRESS'},$ownnet{'ORANGE_NETMASK'}))
273 $errormessage=$errormessage.$Lang::tr
{'ccd err orange'}."<br>";
274 $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
275 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
277 if (($ownnet{'BLUE_NETADDRESS'} ne '' && $ownnet{'BLUE_NETADDRESS'} ne '0.0.0.0') && &General
::IpInSubnet
($fwhostsettings{'IP'},$ownnet{'BLUE_NETADDRESS'},$ownnet{'BLUE_NETMASK'}))
279 $errormessage=$errormessage.$Lang::tr
{'ccd err blue'}."<br>";
280 $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
281 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
283 if (($ownnet{'RED_NETADDRESS'} ne '' && $ownnet{'RED_NETADDRESS'} ne '0.0.0.0') && &General
::IpInSubnet
($fwhostsettings{'IP'},$ownnet{'RED_NETADDRESS'},$ownnet{'RED_NETMASK'}))
285 $errormessage=$errormessage.$Lang::tr
{'ccd err red'}."<br>";
286 $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
287 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
290 #only check plausi when no error till now
292 &plausicheck
("editnet");
294 #check if network ip is part of an already used one
295 if(&checksubnet
(\
%customnetwork))
297 $errormessage=$errormessage.$Lang::tr
{'fwhost err partofnet'};
298 $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
300 if($fwhostsettings{'actualize'} eq 'on' && $fwhostsettings{'newnet'} ne 'on' && $errormessage)
302 $fwhostsettings{'actualize'} = '';
303 my $key = &General
::findhasharraykey
(\
%customnetwork);
304 foreach my $i (0 .. 3) { $customnetwork{$key}[$i] = "";}
305 $customnetwork{$key}[0] = $fwhostsettings{'orgname'} ;
306 $customnetwork{$key}[1] = $fwhostsettings{'orgip'} ;
307 $customnetwork{$key}[2] = $fwhostsettings{'orgsub'};
308 $customnetwork{$key}[3] = $fwhostsettings{'orgnetremark'};
309 $customnetwork{$key}[4] = $fwhostsettings{'count'};
310 &General
::writehasharray
("$confignet", \
%customnetwork);
311 undef %customnetwork;
315 &General
::readhasharray
("$confignet", \
%customnetwork);
316 if ($fwhostsettings{'ACTION'} eq 'updatenet'){
317 if ($fwhostsettings{'update'} == '0'){
318 foreach my $key (keys %customnetwork) {
319 if($customnetwork{$key}[0] eq $fwhostsettings{'orgname'}){
320 $count=$customnetwork{$key}[4];
321 delete $customnetwork{$key};
327 #get count if actualize is 'on'
328 if($fwhostsettings{'actualize'} eq 'on'){
329 $fwhostsettings{'actualize'} = '';
330 $count=$fwhostsettings{'count'};
331 #check if we need to reload rules
332 if($fwhostsettings{'orgip'} ne $fwhostsettings{'IP'} && $count gt '0'){
335 if ($fwhostsettings{'orgname'} ne $fwhostsettings{'HOSTNAME'}){
336 #check if we need to update groups
337 &General
::readhasharray
("$configgrp", \
%customgrp);
338 foreach my $key (sort keys %customgrp){
339 if($customgrp{$key}[2] eq $fwhostsettings{'orgname'}){
340 $customgrp{$key}[2]=$fwhostsettings{'HOSTNAME'};
344 &General
::writehasharray
("$configgrp", \
%customgrp);
345 #check if we need to update firewallrules
346 if ( ! -z
$fwconfigfwd ){
347 &General
::readhasharray
("$fwconfigfwd", \
%fwfwd);
348 foreach my $line (sort keys %fwfwd){
349 if ($fwfwd{$line}[4] eq $fwhostsettings{'orgname'}){
350 $fwfwd{$line}[4] = $fwhostsettings{'HOSTNAME'};
352 if ($fwfwd{$line}[6] eq $fwhostsettings{'orgname'}){
353 $fwfwd{$line}[6] = $fwhostsettings{'HOSTNAME'};
356 &General
::writehasharray
("$fwconfigfwd", \
%fwfwd);
358 if ( ! -z
$fwconfiginp ){
359 &General
::readhasharray
("$fwconfiginp", \
%fwinp);
360 foreach my $line (sort keys %fwinp){
361 if ($fwfwd{$line}[4] eq $fwhostsettings{'orgname'}){
362 $fwfwd{$line}[4] = $fwhostsettings{'HOSTNAME'};
365 &General
::writehasharray
("$fwconfiginp", \
%fwinp);
369 my $key = &General
::findhasharraykey
(\
%customnetwork);
370 foreach my $i (0 .. 4) { $customnetwork{$key}[$i] = "";}
371 $fwhostsettings{'SUBNET'} = &General
::iporsubtocidr
($fwhostsettings{'SUBNET'});
372 $customnetwork{$key}[0] = $fwhostsettings{'HOSTNAME'};
373 #convert ip when leading '0' in byte
374 $fwhostsettings{'IP'} =&General
::ip2dec
($fwhostsettings{'IP'});
375 $fwhostsettings{'IP'} =&General
::dec2ip
($fwhostsettings{'IP'});
376 $customnetwork{$key}[1] = &General
::getnetworkip
($fwhostsettings{'IP'},$fwhostsettings{'SUBNET'}) ;
377 $customnetwork{$key}[2] = &General
::iporsubtodec
($fwhostsettings{'SUBNET'}) ;
378 if($fwhostsettings{'newnet'} eq 'on'){$count=0;}
379 $customnetwork{$key}[3] = $fwhostsettings{'NETREMARK'};
380 $customnetwork{$key}[4] = $count;
381 &General
::writehasharray
("$confignet", \
%customnetwork);
382 $fwhostsettings{'IP'}=$fwhostsettings{'IP'}."/".&General
::iporsubtodec
($fwhostsettings{'SUBNET'});
383 undef %customnetwork;
384 $fwhostsettings{'HOSTNAME'}='';
385 $fwhostsettings{'IP'}='';
386 $fwhostsettings{'SUBNET'}='';
387 $fwhostsettings{'NETREMARK'}='';
388 #check if an edited net affected groups and need to reload rules
389 if ($needrules eq 'on'){
400 if ($fwhostsettings{'ACTION'} eq 'savehost')
404 if ($fwhostsettings{'orgname'} eq ''){$fwhostsettings{'orgname'}=$fwhostsettings{'HOSTNAME'};}
405 $fwhostsettings{'SUBNET'}='32';
406 #check if all fields are set
407 if ($fwhostsettings{'HOSTNAME'} eq '' || $fwhostsettings{'IP'} eq '' || $fwhostsettings{'SUBNET'} eq '')
409 $errormessage=$errormessage.$Lang::tr
{'fwhost err empty'};
410 $fwhostsettings{'ACTION'} = 'edithost';
412 if($fwhostsettings{'IP'}=~/^([0-9a-fA-F]{1,2}:){5}[0-9a-fA-F]{1,2}$/){
413 $fwhostsettings{'type'} = 'mac';
414 }elsif($fwhostsettings{'IP'}=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/){
415 $fwhostsettings{'type'} = 'ip';
417 $fwhostsettings{'type'} = '';
418 $errormessage=$Lang::tr
{'fwhost err ipmac'};
421 if ($fwhostsettings{'HOSTREMARK'} ne '' && !&validremark
($fwhostsettings{'HOSTREMARK'})){
422 $errormessage=$Lang::tr
{'fwhost err remark'};
425 if ($fwhostsettings{'type'} eq 'ip'){
427 if (rindex($fwhostsettings{'IP'},'/') eq '-1' ){
428 if($fwhostsettings{'type'} eq 'ip' && !&General
::validipandmask
($fwhostsettings{'IP'}."/32"))
430 $errormessage.=$errormessage.$Lang::tr
{'fwhost err ip'};
431 $fwhostsettings{'error'}='on';
433 }elsif(rindex($fwhostsettings{'IP'},'/') ne '-1' ){
434 $errormessage=$errormessage.$Lang::tr
{'fwhost err ipwithsub'};
435 $fwhostsettings{'error'}='on';
437 #check if net or broadcast
438 my @tmp= split (/\./,$fwhostsettings{'IP'});
439 if (($tmp[3] eq "0") || ($tmp[3] eq "255")){
440 $errormessage=$Lang::tr
{'fwhost err hostip'};
443 #only check plausi when no error till now
445 &plausicheck
("edithost");
447 if($fwhostsettings{'actualize'} eq 'on' && $fwhostsettings{'newhost'} ne 'on' && $errormessage){
448 $fwhostsettings{'actualize'} = '';
449 my $key = &General
::findhasharraykey
(\
%customhost);
450 foreach my $i (0 .. 4) { $customhost{$key}[$i] = "";}
451 $customhost{$key}[0] = $fwhostsettings{'orgname'} ;
452 $customhost{$key}[1] = $fwhostsettings{'type'} ;
453 if($customhost{$key}[1] eq 'ip'){
454 $customhost{$key}[2] = $fwhostsettings{'orgip'}."/".&General
::iporsubtodec
($fwhostsettings{'SUBNET'});
456 $customhost{$key}[2] = $fwhostsettings{'orgip'};
458 $customhost{$key}[3] = $fwhostsettings{'orgremark'};
459 $customhost{$key}[4] = $fwhostsettings{'count'};
460 &General
::writehasharray
("$confighost", \
%customhost);
464 #get count if host was edited
465 if($fwhostsettings{'actualize'} eq 'on'){
466 $count=$fwhostsettings{'count'};
467 if($fwhostsettings{'orgip'} ne $fwhostsettings{'IP'} && $count gt '0' ){
470 if($fwhostsettings{'orgname'} ne $fwhostsettings{'HOSTNAME'}){
471 #check if we need to update groups
472 &General
::readhasharray
("$configgrp", \
%customgrp);
473 foreach my $key (sort keys %customgrp){
474 if($customgrp{$key}[2] eq $fwhostsettings{'orgname'}){
475 $customgrp{$key}[2]=$fwhostsettings{'HOSTNAME'};
478 &General
::writehasharray
("$configgrp", \
%customgrp);
479 #check if we need to update firewallrules
480 if ( ! -z
$fwconfigfwd ){
481 &General
::readhasharray
("$fwconfigfwd", \
%fwfwd);
482 foreach my $line (sort keys %fwfwd){
483 if ($fwfwd{$line}[4] eq $fwhostsettings{'orgname'}){
484 $fwfwd{$line}[4] = $fwhostsettings{'HOSTNAME'};
486 if ($fwfwd{$line}[6] eq $fwhostsettings{'orgname'}){
487 $fwfwd{$line}[6] = $fwhostsettings{'HOSTNAME'};
490 &General
::writehasharray
("$fwconfigfwd", \
%fwfwd);
492 if ( ! -z
$fwconfiginp ){
493 &General
::readhasharray
("$fwconfiginp", \
%fwinp);
494 foreach my $line (sort keys %fwinp){
495 if ($fwfwd{$line}[4] eq $fwhostsettings{'orgname'}){
496 $fwfwd{$line}[4] = $fwhostsettings{'HOSTNAME'};
499 &General
::writehasharray
("$fwconfiginp", \
%fwinp);
503 my $key = &General
::findhasharraykey
(\
%customhost);
504 foreach my $i (0 .. 4) { $customhost{$key}[$i] = "";}
505 $customhost{$key}[0] = $fwhostsettings{'HOSTNAME'} ;
506 $customhost{$key}[1] = $fwhostsettings{'type'} ;
507 if ($fwhostsettings{'type'} eq 'ip'){
508 #convert ip when leading '0' in byte
509 $fwhostsettings{'IP'}=&General
::ip2dec
($fwhostsettings{'IP'});
510 $fwhostsettings{'IP'}=&General
::dec2ip
($fwhostsettings{'IP'});
511 $customhost{$key}[2] = $fwhostsettings{'IP'}."/".&General
::iporsubtodec
($fwhostsettings{'SUBNET'});
513 $customhost{$key}[2] = $fwhostsettings{'IP'};
515 if($fwhostsettings{'newhost'} eq 'on'){$count=0;}
516 $customhost{$key}[3] = $fwhostsettings{'HOSTREMARK'};
517 $customhost{$key}[4] =$count;
518 &General
::writehasharray
("$confighost", \
%customhost);
520 $fwhostsettings{'HOSTNAME'}='';
521 $fwhostsettings{'IP'}='';
522 $fwhostsettings{'type'}='';
523 $fwhostsettings{'HOSTREMARK'}='';
524 #check if we need to update rules while host was edited
525 if($needrules eq 'on'){
536 if ($fwhostsettings{'ACTION'} eq 'savegrp')
538 my $grp=$fwhostsettings{'grp_name'};;
539 my $rem=$fwhostsettings{'remark'};
542 my $updcounter='off';
545 &General
::readhasharray
("$configgrp", \
%customgrp);
546 &General
::readhasharray
("$confignet", \
%customnetwork);
547 &General
::readhasharray
("$confighost", \
%customhost);
549 if (!&validhostname
($grp)){$errormessage.=$Lang::tr
{'fwhost err name'};}
551 if ($rem ne '' && !&validremark
($rem) && $fwhostsettings{'update'} ne 'on'){
552 $errormessage.=$Lang::tr
{'fwhost err remark'};
554 if ($fwhostsettings{'update'} eq 'on'){
555 #check standard networks
556 if ($fwhostsettings{'grp2'} eq 'std_net'){
557 @target=$fwhostsettings{'DEFAULT_SRC_ADR'};
558 $type='Standard Network';
560 #check custom networks
561 if ($fwhostsettings{'grp2'} eq 'cust_net' && $fwhostsettings{'CUST_SRC_NET'} ne ''){
562 @target=$fwhostsettings{'CUST_SRC_NET'};
564 $type='Custom Network';
565 }elsif($fwhostsettings{'grp2'} eq 'cust_net' && $fwhostsettings{'CUST_SRC_NET'} eq ''){
566 $errormessage=$Lang::tr
{'fwhost err groupempty'}."<br>";
567 $fwhostsettings{'grp_name'}='';
568 $fwhostsettings{'remark'}='';
570 #check custom addresses
571 if ($fwhostsettings{'grp2'} eq 'cust_host' && $fwhostsettings{'CUST_SRC_HOST'} ne ''){
572 @target=$fwhostsettings{'CUST_SRC_HOST'};
575 }elsif($fwhostsettings{'grp2'} eq 'cust_host' && $fwhostsettings{'CUST_SRC_HOST'} eq ''){
576 $errormessage=$Lang::tr
{'fwhost err groupempty'}."<br>";
577 $fwhostsettings{'grp_name'}='';
578 $fwhostsettings{'remark'}='';
580 #get address from ovpn ccd static net
581 if ($fwhostsettings{'grp2'} eq 'ovpn_net' && $fwhostsettings{'OVPN_CCD_NET'} ne ''){
582 @target=$fwhostsettings{'OVPN_CCD_NET'};
583 $type='OpenVPN static network';
584 }elsif($fwhostsettings{'grp2'} eq 'ovpn_net' && $fwhostsettings{'OVPN_CCD_NET'} eq ''){
585 $errormessage=$Lang::tr
{'fwhost err groupempty'};
586 $fwhostsettings{'grp_name'}='';
587 $fwhostsettings{'remark'}='';
589 #get address from ovpn ccd static host
590 if ($fwhostsettings{'grp2'} eq 'ovpn_host' && $fwhostsettings{'OVPN_CCD_HOST'} ne ''){
591 @target=$fwhostsettings{'OVPN_CCD_HOST'};
592 $type='OpenVPN static host';
593 }elsif ($fwhostsettings{'grp2'} eq 'ovpn_host' && $fwhostsettings{'OVPN_CCD_HOST'} eq ''){
594 $errormessage=$Lang::tr
{'fwhost err groupempty'};
596 #get address from ovpn ccd Net-2-Net
597 if ($fwhostsettings{'grp2'} eq 'ovpn_n2n' && $fwhostsettings{'OVPN_N2N'} ne ''){
598 @target=$fwhostsettings{'OVPN_N2N'};
599 $type='OpenVPN N-2-N';
600 }elsif ($fwhostsettings{'grp2'} eq 'ovpn_n2n' && $fwhostsettings{'OVPN_N2N'} eq ''){
601 $errormessage=$Lang::tr
{'fwhost err groupempty'};
602 $fwhostsettings{'grp_name'}='';
603 $fwhostsettings{'remark'}='';
605 #get address from IPSEC HOST
606 if ($fwhostsettings{'grp2'} eq 'ipsec_host' && $fwhostsettings{'IPSEC_HOST'} ne ''){
607 @target=$fwhostsettings{'IPSEC_HOST'};
609 }elsif ($fwhostsettings{'grp2'} eq 'ipsec_host' && $fwhostsettings{'IPSEC_HOST'} eq ''){
610 $errormessage=$Lang::tr
{'fwhost err groupempty'};
611 $fwhostsettings{'grp_name'}='';
612 $fwhostsettings{'remark'}='';
614 #get address from IPSEC NETWORK
615 if ($fwhostsettings{'grp2'} eq 'ipsec_net' && $fwhostsettings{'IPSEC_NET'} ne ''){
616 @target=$fwhostsettings{'IPSEC_NET'};
617 $type='IpSec Network';
618 }elsif ($fwhostsettings{'grp2'} eq 'ipsec_net' && $fwhostsettings{'IPSEC_NET'} eq ''){
619 $errormessage=$Lang::tr
{'fwhost err groupempty'};
620 $fwhostsettings{'grp_name'}='';
621 $fwhostsettings{'remark'}='';
623 #check if host/net exists in grp
625 my $test="$grp,$fwhostsettings{'oldremark'},@target";
626 foreach my $key (keys %customgrp) {
627 my $test1="$customgrp{$key}[0],$customgrp{$key}[1],$customgrp{$key}[2]";
628 if ($test1 eq $test){
629 $errormessage=$Lang::tr
{'fwhost err isingrp'};
630 $fwhostsettings{'update'} = 'on';
636 #on first save, we have an empty @target, so fill it with nothing
637 my $targetvalues=@target;
638 if ($targetvalues == '0'){
641 #on update, we have to delete the dummy entry
642 foreach my $key (keys %customgrp){
643 if ($customgrp{$key}[0] eq $grp && $customgrp{$key}[2] eq "none"){
644 delete $customgrp{$key};
648 &General
::writehasharray
("$configgrp", \
%customgrp);
649 &General
::readhasharray
("$configgrp", \
%customgrp);
651 foreach my $key (keys %customgrp)
653 if($customgrp{$key}[0] eq $grp)
655 $count=$customgrp{$key}[4];
659 if ($count eq '' ){$count='0';}
661 #create array with new lines
662 foreach my $line (@target){
663 push (@newgrp,"$grp,$rem,$line");
666 my $key = &General
::findhasharraykey
(\
%customgrp);
667 foreach my $line (@newgrp){
668 foreach my $i (0 .. 4) { $customgrp{$key}[$i] = "";}
669 my ($a,$b,$c,$d) = split (",",$line);
670 $customgrp{$key}[0] = $a;
671 $customgrp{$key}[1] = $b;
672 $customgrp{$key}[2] = $c;
673 $customgrp{$key}[3] = $type;
674 $customgrp{$key}[4] = $count;
676 &General
::writehasharray
("$configgrp", \
%customgrp);
677 #update counter in Host/Net
678 if($updcounter eq 'net'){
679 foreach my $key (keys %customnetwork) {
680 if($customnetwork{$key}[0] eq $fwhostsettings{'CUST_SRC_NET'}){
681 $customnetwork{$key}[4] = $customnetwork{$key}[4]+1;
685 &General
::writehasharray
("$confignet", \
%customnetwork);
686 }elsif($updcounter eq 'host'){
687 foreach my $key (keys %customhost) {
688 if ($customhost{$key}[0] eq $fwhostsettings{'CUST_SRC_HOST'}){
689 $customhost{$key}[4]=$customhost{$key}[4]+1;
692 &General
::writehasharray
("$confighost", \
%customhost);
694 $fwhostsettings{'update'}='on';
696 #check if ruleupdate is needed
704 if ($fwhostsettings{'ACTION'} eq 'saveservice')
707 &General
::readhasharray
("$configsrv", \
%customservice );
708 $errormessage=&checkports
(\
%customservice);
709 if ($fwhostsettings{'PROT'} eq 'ICMP'){
710 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
711 foreach my $key (keys %icmptypes){
712 if ("$icmptypes{$key}[0] ($icmptypes{$key}[1])" eq $fwhostsettings{'ICMP_TYPES'}){
713 $ICMP=$icmptypes{$key}[0];
717 if($ICMP eq ''){$ICMP='BLANK';}
719 my $key = &General
::findhasharraykey
(\
%customservice);
720 foreach my $i (0 .. 4) { $customservice{$key}[$i] = "";}
721 $customservice{$key}[0] = $fwhostsettings{'SRV_NAME'};
722 $customservice{$key}[1] = $fwhostsettings{'SRV_PORT'};
723 $customservice{$key}[2] = $fwhostsettings{'PROT'};
724 $customservice{$key}[3] = $ICMP;
725 $customservice{$key}[4] = 0;
726 &General
::writehasharray
("$configsrv", \
%customservice );
728 $fwhostsettings{'SRV_NAME'}='';
729 $fwhostsettings{'SRV_PORT'}='';
730 $fwhostsettings{'PROT'}='';
731 $fwhostsettings{'ICMP_TYPES'}='';
735 if ($fwhostsettings{'ACTION'} eq 'saveservicegrp')
740 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp );
741 &General
::readhasharray
("$configsrv", \
%customservice );
742 $errormessage=&checkservicegroup
;
744 if ($fwhostsettings{'SRVGRP_REMARK'} ne '' && !&validremark
($fwhostsettings{'SRVGRP_REMARK'})){
745 $errormessage=$Lang::tr
{'fwhost err remark'};
748 #on first save, we have to enter a dummy value
749 if ($fwhostsettings{'CUST_SRV'} eq ''){
750 $fwhostsettings{'CUST_SRV'}='none';
752 #on update, we have to delete the dummy entry
753 foreach my $key (keys %customservicegrp){
754 if ($customservicegrp{$key}[2] eq 'none'){
755 delete $customservicegrp{$key};
759 &General
::writehasharray
("$configsrvgrp", \
%customservicegrp );
760 #check if remark has also changed
761 if ($fwhostsettings{'SRVGRP_REMARK'} ne $fwhostsettings{'oldsrvgrpremark'} && $fwhostsettings{'updatesrvgrp'} eq 'on')
763 foreach my $key (keys %customservicegrp)
765 if($customservicegrp{$key}[0] eq $fwhostsettings{'SRVGRP_NAME'} && $customservicegrp{$key}[1] eq $fwhostsettings{'oldsrvgrpremark'})
767 $customservicegrp{$key}[1]='';
768 $customservicegrp{$key}[1]=$fwhostsettings{'SRVGRP_REMARK'};
773 foreach my $key (keys %customservicegrp)
775 if($customservicegrp{$key}[0] eq $fwhostsettings{'SRVGRP_NAME'})
777 $count=$customservicegrp{$key}[3];
781 if ($count eq '' ){$count='0';}
783 foreach my $key (sort keys %customservice){
784 if($customservice{$key}[0] eq $fwhostsettings{'CUST_SRV'}){
785 $port=$customservice{$key}[1];
786 $prot=$customservice{$key}[2];
787 $customservice{$key}[4]++;
790 &General
::writehasharray
("$configsrv", \
%customservice );
791 my $key = &General
::findhasharraykey
(\
%customservicegrp);
792 foreach my $i (0 .. 3) { $customservice{$key}[$i] = "";}
793 $customservicegrp{$key}[0] = $fwhostsettings{'SRVGRP_NAME'};
794 $customservicegrp{$key}[1] = $fwhostsettings{'SRVGRP_REMARK'};
795 $customservicegrp{$key}[2] = $fwhostsettings{'CUST_SRV'};
796 $customservicegrp{$key}[3] = $count;
797 &General
::writehasharray
("$configsrvgrp", \
%customservicegrp );
798 $fwhostsettings{'updatesrvgrp'}='on';
804 &viewtableservicegrp
;
807 if ($fwhostsettings{'ACTION'} eq 'editnet')
812 if ($fwhostsettings{'ACTION'} eq 'edithost')
817 if ($fwhostsettings{'ACTION'} eq 'editgrp')
819 $fwhostsettings{'update'}='on';
823 if ($fwhostsettings{'ACTION'} eq 'editservice')
825 $fwhostsettings{'updatesrv'}='on';
828 if ($fwhostsettings{'ACTION'} eq 'editservicegrp')
830 $fwhostsettings{'updatesrvgrp'} = 'on';
832 &viewtableservicegrp
;
835 if ($fwhostsettings{'ACTION'} eq 'resetnet')
837 $fwhostsettings{'HOSTNAME'} ="";
838 $fwhostsettings{'IP'} ="";
839 $fwhostsettings{'SUBNET'} ="";
842 if ($fwhostsettings{'ACTION'} eq 'resethost')
844 $fwhostsettings{'HOSTNAME'} ="";
845 $fwhostsettings{'IP'} ="";
846 $fwhostsettings{'type'} ="";
849 if ($fwhostsettings{'ACTION'} eq 'resetgrp')
851 $fwhostsettings{'grp_name'} ="";
852 $fwhostsettings{'remark'} ="";
856 if ($fwhostsettings{'ACTION'} eq 'delnet')
858 &General
::readhasharray
("$confignet", \
%customnetwork);
859 foreach my $key (keys %customnetwork) {
860 if($fwhostsettings{'key'} eq $customnetwork{$key}[0]){
861 delete $customnetwork{$key};
862 &General
::writehasharray
("$confignet", \
%customnetwork);
869 if ($fwhostsettings{'ACTION'} eq 'delhost')
871 &General
::readhasharray
("$confighost", \
%customhost);
872 foreach my $key (keys %customhost) {
873 if($fwhostsettings{'key'} eq $customhost{$key}[0]){
874 delete $customhost{$key};
875 &General
::writehasharray
("$confighost", \
%customhost);
882 if ($fwhostsettings{'ACTION'} eq 'deletegrphost')
886 &General
::readhasharray
("$configgrp", \
%customgrp);
887 foreach my $key (keys %customgrp){
888 if($customgrp{$key}[0].",".$customgrp{$key}[1].",".$customgrp{$key}[2].",".$customgrp{$key}[3] eq $fwhostsettings{'delhost'}){
889 #decrease count from source host/net
890 if ($customgrp{$key}[3] eq 'Custom Network'){
891 &General
::readhasharray
("$confignet", \
%customnetwork);
892 foreach my $key1 (keys %customnetwork){
893 if ($customnetwork{$key1}[0] eq $customgrp{$key}[2]){
894 $customnetwork{$key1}[4] = $customnetwork{$key1}[4]-1;
898 &General
::writehasharray
("$confignet", \
%customnetwork);
900 if ($customgrp{$key}[3] eq 'Custom Host'){
901 &General
::readhasharray
("$confighost", \
%customhost);
902 foreach my $key1 (keys %customhost){
903 if ($customhost{$key1}[0] eq $customgrp{$key}[2]){
904 $customhost{$key1}[4] = $customhost{$key1}[4]-1;
908 &General
::writehasharray
("$confighost", \
%customhost);
910 $grpname=$customgrp{$key}[0];
911 $grpremark=$customgrp{$key}[1];
912 delete $customgrp{$key};
915 &General
::writehasharray
("$configgrp", \
%customgrp);
916 if ($fwhostsettings{'grpcnt'} > 0){&rules
;}
917 if ($fwhostsettings{'update'} eq 'on'){
918 $fwhostsettings{'remark'}= $grpremark;
919 $fwhostsettings{'grp_name'}=$grpname;
924 if ($fwhostsettings{'ACTION'} eq 'delgrp')
926 &General
::readhasharray
("$configgrp", \
%customgrp);
927 &decrease
($fwhostsettings{'grp_name'});
928 foreach my $key (sort keys %customgrp)
930 if($customgrp{$key}[0] eq $fwhostsettings{'grp_name'})
932 delete $customgrp{$key};
935 &General
::writehasharray
("$configgrp", \
%customgrp);
936 $fwhostsettings{'grp_name'}='';
940 if ($fwhostsettings{'ACTION'} eq 'delservice')
942 &General
::readhasharray
("$configsrv", \
%customservice);
943 foreach my $key (keys %customservice) {
944 if($customservice{$key}[0] eq $fwhostsettings{'SRV_NAME'}){
945 #&deletefromgrp($customhost{$key}[0],$configgrp);
946 delete $customservice{$key};
947 &General
::writehasharray
("$configsrv", \
%customservice);
951 $fwhostsettings{'SRV_NAME'}='';
952 $fwhostsettings{'SRV_PORT'}='';
953 $fwhostsettings{'PROT'}='';
956 if ($fwhostsettings{'ACTION'} eq 'delservicegrp')
958 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
959 &decreaseservice
($fwhostsettings{'SRVGRP_NAME'});
960 foreach my $key (sort keys %customservicegrp)
962 if($customservicegrp{$key}[0] eq $fwhostsettings{'SRVGRP_NAME'})
964 delete $customservicegrp{$key};
967 &General
::writehasharray
("$configsrvgrp", \
%customservicegrp);
968 $fwhostsettings{'SRVGRP_NAME'}='';
970 &viewtableservicegrp
;
972 if ($fwhostsettings{'ACTION'} eq 'delgrpservice')
976 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
977 &General
::readhasharray
("$configsrv", \
%customservice);
978 foreach my $key (keys %customservicegrp){
979 if($customservicegrp{$key}[0].",".$customservicegrp{$key}[1].",".$customservicegrp{$key}[2].",".$customservicegrp{$key}[3] eq $fwhostsettings{'delsrvfromgrp'})
981 #decrease count from source service
982 foreach my $key1 (sort keys %customservice){
983 if($customservice{$key1}[0] eq $customservicegrp{$key}[2]){
984 $customservice{$key1}[4]--;
988 &General
::writehasharray
("$configsrv", \
%customservice);
989 $grpname=$customservicegrp{$key}[0];
990 $grpremark=$customservicegrp{$key}[1];
991 delete $customservicegrp{$key};
994 &General
::writehasharray
("$configsrvgrp", \
%customservicegrp);
996 if ($fwhostsettings{'updatesrvgrp'} eq 'on'){
997 $fwhostsettings{'SRVGRP_NAME'}=$grpname;
998 $fwhostsettings{'SRVGRP_REMARK'}=$grpremark;
1001 &viewtableservicegrp
;
1004 if ($fwhostsettings{'ACTION'} eq $Lang::tr
{'fwhost newnet'})
1009 if ($fwhostsettings{'ACTION'} eq $Lang::tr
{'fwhost newhost'})
1014 if ($fwhostsettings{'ACTION'} eq $Lang::tr
{'fwhost newgrp'})
1019 if ($fwhostsettings{'ACTION'} eq $Lang::tr
{'fwhost newservice'})
1023 if ($fwhostsettings{'ACTION'} eq $Lang::tr
{'fwhost newservicegrp'})
1026 &viewtableservicegrp
;
1028 if ($fwhostsettings{'ACTION'} eq 'changegrpremark')
1030 &General
::readhasharray
("$configgrp", \
%customgrp);
1031 if ($fwhostsettings{'oldrem'} ne $fwhostsettings{'newrem'} && (&validremark
($fwhostsettings{'newrem'}) || $fwhostsettings{'newrem'} eq '')){
1032 foreach my $key (sort keys %customgrp)
1034 if($customgrp{$key}[0] eq $fwhostsettings{'grp'} && $customgrp{$key}[1] eq $fwhostsettings{'oldrem'})
1036 $customgrp{$key}[1]='';
1037 $customgrp{$key}[1]=$fwhostsettings{'newrem'};
1040 &General
::writehasharray
("$configgrp", \
%customgrp);
1041 $fwhostsettings{'update'}='on';
1042 $fwhostsettings{'remark'}=$fwhostsettings{'newrem'};
1044 $errormessage=$Lang::tr
{'fwhost err remark'};
1045 $fwhostsettings{'remark'}=$fwhostsettings{'oldrem'};
1046 $fwhostsettings{'grp_name'}=$fwhostsettings{'grp'};
1047 $fwhostsettings{'update'} = 'on';
1049 $fwhostsettings{'grp_name'}=$fwhostsettings{'grp'};
1053 if ($fwhostsettings{'ACTION'} eq 'changesrvgrpremark')
1055 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp );
1056 if ($fwhostsettings{'oldsrvrem'} ne $fwhostsettings{'newsrvrem'} && (&validremark
($fwhostsettings{'newsrvrem'}) || $fwhostsettings{'newsrvrem'} eq '')){
1057 foreach my $key (sort keys %customservicegrp)
1059 if($customservicegrp{$key}[0] eq $fwhostsettings{'srvgrp'} && $customservicegrp{$key}[1] eq $fwhostsettings{'oldsrvrem'})
1061 $customservicegrp{$key}[1]='';
1062 $customservicegrp{$key}[1]=$fwhostsettings{'newsrvrem'};
1065 &General
::writehasharray
("$configsrvgrp", \
%customservicegrp);
1066 $fwhostsettings{'updatesrvgrp'}='on';
1067 $fwhostsettings{'SRVGRP_REMARK'}=$fwhostsettings{'newsrvrem'};
1069 $errormessage=$Lang::tr
{'fwhost err remark'};
1070 $fwhostsettings{'SRVGRP_REMARK'}=$fwhostsettings{'oldsrvrem'};
1071 $fwhostsettings{'SRVGRP_NAME'}=$fwhostsettings{'srvgrp'};
1072 $fwhostsettings{'updatesrvgrp'} = 'on';
1074 $fwhostsettings{'SRVGRP_NAME'}=$fwhostsettings{'srvgrp'};
1076 &viewtableservicegrp
;
1079 if($fwhostsettings{'ACTION'} eq '')
1086 if (-f
"${General::swroot}/forward/reread"){
1087 print "<table border='1' rules='groups' bgcolor='lightgreen' width='100%'><form method='post'><td><div style='font-size:11pt; font-weight: bold;vertical-align: middle; '><input type='submit' name='ACTION' value='$Lang::tr{'fwdfw reread'}' style='font-face: Comic Sans MS; color: green; font-weight: bold; font-size: 14pt;'>    $Lang::tr{'fwhost reread'}</td></tr></table></form><br>";
1089 &Header
::openbox
('100%', 'left',$Lang::tr
{'fwhost menu'});
1090 print "$Lang::tr{'fwhost welcome'}";
1092 <br><br><table border='0' width='100%'>
1093 <tr><td><form method='post'><input type='submit' name='ACTION' value='$Lang::tr{'fwhost newnet'}' ><input type='submit' name='ACTION' value='$Lang::tr{'fwhost newhost'}' ><input type='submit' name='ACTION' value='$Lang::tr{'fwhost newgrp'}' ></form></td>
1094 <td align='right'><form method='post'><input type='submit' name='ACTION' value='$Lang::tr{'fwhost newservice'}' ><input type='submit' name='ACTION' value='$Lang::tr{'fwhost newservicegrp'}' ></form></td></tr>
1095 <tr><td colspan='6'><hr></td></tr></table>
1097 &Header
::closebox
();
1105 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost addnet'});
1106 $fwhostsettings{'orgname'}=$fwhostsettings{'HOSTNAME'};
1107 $fwhostsettings{'orgnetremark'}=$fwhostsettings{'NETREMARK'};
1109 <table border='0' width='100%'>
1110 <tr><td width='15%'>$Lang::tr{'name'}:</td><td><form method='post'><input type='TEXT' name='HOSTNAME' id='textbox1' value='$fwhostsettings{'HOSTNAME'}' $fwhostsettings{'BLK_HOST'} size='20'><script>document.getElementById('textbox1').focus()</script></td></tr>
1111 <tr><td>$Lang::tr{'fwhost netaddress'}:</td><td><input type='TEXT' name='IP' value='$fwhostsettings{'IP'}' $fwhostsettings{'BLK_IP'} size='20' maxlength='15'></td></tr>
1112 <tr><td>$Lang::tr{'netmask'}:</td><td><input type='TEXT' name='SUBNET' value='$fwhostsettings{'SUBNET'}' $fwhostsettings{'BLK_IP'} size='20' maxlength='15'></td></tr>
1113 <tr><td>$Lang::tr{'remark'}:</td><td><input type='TEXT' name='NETREMARK' value='$fwhostsettings{'NETREMARK'}' style='width: 98.5%;'></td></tr>
1114 <tr><td colspan='6'><br><hr></td></tr><tr>
1116 if ($fwhostsettings{'ACTION'} eq 'editnet' || $fwhostsettings{'error'} eq 'on')
1118 print "<td colspan='6' align='right' ><input type='submit' value='$Lang::tr{'update'}' style='min-width:100px;'><input type='hidden' name='ACTION' value='updatenet'><input type='hidden' name='orgnetremark' value='$fwhostsettings{'orgnetremark'}' ><input type='hidden' name='orgname' value='$fwhostsettings{'orgname'}' ><input type='hidden' name='update' value='on'><input type='hidden' name='newnet' value='$fwhostsettings{'newnet'}'></td>";
1120 print "<td colspan='6' align='right'><input type='submit' value='$Lang::tr{'save'}' style='min-width:100px;'/><input type='hidden' name='ACTION' value='savenet'><input type='hidden' name='newnet' value='on'>";
1122 print "</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='resetnet'></form></td></tr></table>";
1123 &Header
::closebox
();
1129 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost addhost'});
1130 $fwhostsettings{'orgname'}=$fwhostsettings{'HOSTNAME'};
1131 $fwhostsettings{'orgremark'}=$fwhostsettings{'HOSTREMARK'};
1133 <table border='0' width='100%'>
1134 <tr><td>$Lang::tr{'name'}:</td><td><form method='post' style='display:inline;'><input type='TEXT' name='HOSTNAME' id='textbox1' value='$fwhostsettings{'HOSTNAME'}' $fwhostsettings{'BLK_HOST'} size='20'><script>document.getElementById('textbox1').focus()</script></td></tr>
1135 <tr><td>IP/MAC:</td><td><input type='TEXT' name='IP' value='$fwhostsettings{'IP'}' $fwhostsettings{'BLK_IP'} size='20' maxlength='17'></td></tr>
1136 <tr><td width='10%'>$Lang::tr{'remark'}:</td><td><input type='TEXT' name='HOSTREMARK' value='$fwhostsettings{'HOSTREMARK'}' style='width:98%;'></td></tr>
1137 <tr><td colspan='5'><hr></td></tr><tr>
1140 if ($fwhostsettings{'ACTION'} eq 'edithost' || $fwhostsettings{'error'} eq 'on')
1143 print " <td colspan='4' align='right'><input type='submit' value='$Lang::tr{'update'}' style='min-width:100px;'/><input type='hidden' name='ACTION' value='updatehost'><input type='hidden' name='orgremark' value='$fwhostsettings{'orgremark'}' ><input type='hidden' name='orgname' value='$fwhostsettings{'orgname'}' ><input type='hidden' name='update' value='on'><input type='hidden' name='newhost' value='$fwhostsettings{'newhost'}'></form>";
1145 print " <td colspan='4' align='right'><input type='submit' name='savehost' value='$Lang::tr{'save'}' style='min-width:100px;' /><input type='hidden' name='ACTION' value='savehost' /><input type='hidden' name='newhost' value='on'>";
1147 print " </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='resethost'></form></td></tr></table>";
1148 &Header
::closebox
();
1155 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost addgrp'});
1156 &General
::setup_default_networks
(\
%defaultNetworks);
1157 &General
::readhasharray
("$configccdnet", \
%ccdnet);
1158 &General
::readhasharray
("$confignet", \
%customnetwork);
1159 &General
::readhasharray
("$configccdhost", \
%ccdhost);
1160 &General
::readhasharray
("$confighost", \
%customhost);
1161 &General
::readhasharray
("$configipsec", \
%ipsecconf);
1165 $checked{'check1'}{'off'} = '';
1166 $checked{'check1'}{'on'} = '';
1167 $checked{'grp2'}{$fwhostsettings{'grp2'}} = 'CHECKED';
1168 $fwhostsettings{'oldremark'}=$fwhostsettings{'remark'};
1169 my $grp=$fwhostsettings{'grp_name'};
1170 my $rem=$fwhostsettings{'remark'};
1171 if ($fwhostsettings{'update'} eq ''){
1173 <table width='100%' border='0'>
1174 <tr><td width='10%'>$Lang::tr{'fwhost addgrpname'}</td><td><form method='post'><input type='TEXT' name='grp_name' value='$fwhostsettings{'grp_name'}' size='20'></td></tr>
1175 <tr><td width='10%'>$Lang::tr{'remark'}:</td><td ><input type='TEXT' name='remark' value='$fwhostsettings{'remark'}' style='width: 98%;'></td></tr>
1176 <tr><td colspan='2'><br><hr></td></tr></table>
1180 <table width='100%' border='0'><form method='post' style='display:inline'>
1181 <tr><td nowrap='nowrap' width='12%'>$Lang::tr{'fwhost addgrpname'}</td><td><input type='TEXT' name='grp' value='$fwhostsettings{'grp_name'}' readonly ></td><td></td></tr>
1182 <tr><td>$Lang::tr{'remark'}:</td><td><input type='TEXT' name='newrem' size='45' value='$fwhostsettings{'remark'}' style='width:98%'></td><td align='right'><input type='submit' value='$Lang::tr{'fwhost change'}'><input type='hidden' name='oldrem' value='$fwhostsettings{'oldremark'}'><input type='hidden' name='ACTION' value='changegrpremark' ></td></tr></table></form>
1186 if ($fwhostsettings{'update'} eq 'on'){
1188 <form method='post'><input type='hidden' name='remark' value='$rem'><input type='hidden' name='grp_name' value='$grp'>
1189 <table width='100%' border='0'>
1190 <tr><td width=50% valign='top'>
1191 <table width='100%' border='0'>
1192 <tr><td width='1%'><input type='radio' name='grp2' value='std_net' id='DEFAULT_SRC_ADR' checked></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost stdnet'}</td><td><select name='DEFAULT_SRC_ADR' style='min-width:185px;'>
1194 foreach my $network (sort keys %defaultNetworks)
1196 next if($defaultNetworks{$network}{'LOCATION'} eq "IPCOP");
1197 next if($defaultNetworks{$network}{'NAME'} eq "IPFire");
1198 print "<option value='$defaultNetworks{$network}{'NAME'}'";
1199 print " selected='selected'" if ($fwhostsettings{'DEFAULT_SRC_ADR'} eq $defaultNetworks{$network}{'NAME'});
1200 my $defnet="$defaultNetworks{$network}{'NAME'}_NETADDRESS";
1201 my $defsub="$defaultNetworks{$network}{'NAME'}_NETMASK";
1202 my $defsub1=&General
::subtocidr
($ownnet{$defsub});
1203 $ownnet{$defnet}='' if ($defaultNetworks{$network}{'NAME'} eq 'RED');
1204 if ($ownnet{$defnet}){
1205 print ">$network ($ownnet{$defnet}/$defsub1)</option>";
1207 print ">$network</option>";
1210 print"</select></td></tr>";
1211 if (! -z
$confignet){
1212 print"<tr><td><input type='radio' name='grp2' id='CUST_SRC_NET' value='cust_net' $checked{'grp2'}{'cust_net'}></td><td>$Lang::tr{'fwhost cust net'}</td><td><select name='CUST_SRC_NET' style='min-width:185px;'>";
1213 foreach my $key (sort { ncmp
($customnetwork{$a}[0],$customnetwork{$b}[0]) } keys %customnetwork) {
1214 print"<option>$customnetwork{$key}[0]</option>";
1216 print"</select></td></tr>";
1218 if (! -z
$confighost){
1219 print"<tr><td valign='top'><input type='radio' name='grp2' id='CUST_SRC_HOST' value='cust_host' $checked{'grp2'}{'cust_host'}></td><td valign='top'>$Lang::tr{'fwhost cust addr'}</td><td><select name='CUST_SRC_HOST' style='min-width:185px;'>";
1220 foreach my $key (sort { ncmp
($customhost{$a}[0],$customhost{$b}[0]) } keys %customhost) {
1221 print"<option>$customhost{$key}[0]</option>";
1223 print"</select></td></tr>";
1227 print"</td><td valign='top'><table width='100%' border='0'>";
1229 if (! -z
$configccdnet){
1230 print"<td width='1%'><input type='radio' name='grp2' id='OVPN_CCD_NET' value='ovpn_net' $checked{'grp2'}{'ovpn_net'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdnet'}</td><td nowrap='nowrap' width='1%'><select name='OVPN_CCD_NET' style='min-width:185px;'>";
1231 foreach my $key (sort { ncmp
($ccdnet{$a}[0],$ccdnet{$b}[0]) } keys %ccdnet)
1233 print"<option value='$ccdnet{$key}[0]'>$ccdnet{$key}[0]</option>";
1235 print"</select></td></tr>";
1238 foreach my $key (sort { ncmp
($ccdhost{$a}[0],$ccdhost{$b}[0]) } keys %ccdhost)
1240 if ($ccdhost{$key}[33] ne ''){
1241 print"<td width='1%'><input type='radio' name='grp2' value='ovpn_host' $checked{'grp2'}{'ovpn_host'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdhost'}</td><td nowrap='nowrap' width='1%'><select name='OVPN_CCD_HOST' style='min-width:185px;'>" if ($show eq '');
1243 print"<option value='$ccdhost{$key}[1]'>$ccdhost{$key}[1]</option>";
1246 if ($show eq '1'){$show='';print"</select></td></tr>";}
1248 foreach my $key (sort { ncmp
($ccdhost{$a}[1],$ccdhost{$b}[1]) } keys %ccdhost) {
1249 if($ccdhost{$key}[3] eq 'net'){
1250 print"<td width='1%'><input type='radio' name='grp2' id='OVPN_N2N' value='ovpn_n2n' $checked{'grp2'}{'ovpn_n2n'}></td><td valign='top'>$Lang::tr{'fwhost ovpn_n2n'}</td><td colspan='3'><select name='OVPN_N2N' style='min-width:185px;'>" if ($show eq '');
1252 print"<option>$ccdhost{$key}[1]</option>";
1255 if ($show eq '1'){$show='';print"</select></td></tr>";}
1257 foreach my $key (sort { ncmp
($ipsecconf{$a}[0],$ipsecconf{$b}[0]) } keys %ipsecconf) {
1258 if ($ipsecconf{$key}[3] eq 'net'){
1259 print"<td valign='top'><input type='radio' name='grp2' id='IPSEC_NET' value='ipsec_net' $checked{'grp2'}{'ipsec_net'}></td><td valign='top'>$Lang::tr{'fwhost ipsec net'}</td><td><select name='IPSEC_NET' style='min-width:185px;'>" if ($show eq '');
1261 print"<option value='$ipsecconf{$key}[1]'>$ipsecconf{$key}[1]</option>";
1264 if ($show eq '1'){$show='';print"</select></td></tr>";}
1266 print"</td></tr></table>";
1267 print"<br><br><b>$Lang::tr{'fwhost attention'}:</b><br> $Lang::tr{'fwhost macwarn'}<br><hr>";
1269 print"<table border='0' width='100%'>";
1270 print"<tr><td align='right'><input type='submit' value='$Lang::tr{'add'}' style='min-width:100px;' /><input type='hidden' name='oldremark' value='$fwhostsettings{'oldremark'}'><input type='hidden' name='update' value=\"$fwhostsettings{'update'}\"><input type='hidden' name='ACTION' value='savegrp' ></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='resetgrp'></form></td></table>";
1271 &Header
::closebox
();
1277 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost addservice'});
1278 if ($fwhostsettings{'updatesrv'} eq 'on')
1280 $fwhostsettings{'oldsrvname'} = $fwhostsettings{'SRV_NAME'};
1281 $fwhostsettings{'oldsrvport'} = $fwhostsettings{'SRV_PORT'};
1282 $fwhostsettings{'oldsrvprot'} = $fwhostsettings{'PROT'};
1285 <table width='100%' border='0'><form method='post'>
1286 <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost srv_name'}:</td><td><input type='text' name='SRV_NAME' id='textbox1' value='$fwhostsettings{'SRV_NAME'}' size='24'><script>document.getElementById('textbox1').focus()</script></td></tr>
1287 <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost prot'}:</td><td><select name='PROT'>
1289 foreach ("TCP","UDP","ICMP")
1291 if ($_ eq $fwhostsettings{'PROT'})
1293 print"<option selected>$_</option>";
1295 print"<option>$_</option>";
1300 <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost icmptype'}</td><td><select name='ICMP_TYPES'>
1302 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
1303 print"<option>All ICMP-Types</option>";
1304 foreach my $key (sort { ncmp
($icmptypes{$a}[0],$icmptypes{$b}[0]) }keys %icmptypes){
1305 print"<option>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
1310 <tr><td width='10%'>$Lang::tr{'fwhost port'}:</td><td><input type='text' name='SRV_PORT' value='$fwhostsettings{'SRV_PORT'}' maxlength='11' size='24'></td></tr>
1311 <tr><td colspan='6'><br><hr></td></tr>
1312 <tr><td colspan='6' align='right'>
1314 if ($fwhostsettings{'updatesrv'} eq 'on')
1317 <input type='submit' value='$Lang::tr{'update'}'style='min-width:100px;' >
1318 <input type='hidden' name='ACTION' value='updateservice'>
1319 <input type='hidden' name='oldsrvname' value='$fwhostsettings{'oldsrvname'}'>
1320 <input type='hidden' name='oldsrvport' value='$fwhostsettings{'oldsrvport'}'>
1321 <input type='hidden' name='oldsrvprot' value='$fwhostsettings{'oldsrvprot'}'></form>
1325 print"<input type='submit' value='$Lang::tr{'save'}' style='min-width:100px;'><input type='hidden' name='ACTION' value='saveservice'></form>";
1328 <form style='display:inline;' method='post'><input type='submit' value='$Lang::tr{'fwhost back'}' style='min-width:100px;'></form></td></tr>
1333 &Header
::closebox
();
1341 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost addservicegrp'});
1342 $fwhostsettings{'oldsrvgrpremark'}=$fwhostsettings{'SRVGRP_REMARK'};
1343 if ($fwhostsettings{'updatesrvgrp'} eq ''){
1345 <table width='100%' border='0'><form method='post'>
1346 <tr><td width='10%'>$Lang::tr{'fwhost addgrpname'}</td><td><input type='text' name='SRVGRP_NAME' value='$fwhostsettings{'SRVGRP_NAME'}' size='24'></td></tr>
1347 <tr><td width='10%'>$Lang::tr{'remark'}:</td><td><input type='text' name='SRVGRP_REMARK' value='$fwhostsettings{'SRVGRP_REMARK'}' style='width: 98%;'></td></tr>
1348 <tr><td colspan='2'><br><hr></tr>
1353 <table width='100%' border='0'><form method='post' style='display:inline'>
1354 <tr><td width='10%'>$Lang::tr{'fwhost addgrpname'}</td><td><input type='text' name='srvgrp' value='$fwhostsettings{'SRVGRP_NAME'}' readonly size='14'></td><td width='3%'></td></tr>
1355 <tr><td width='10%'>$Lang::tr{'remark'}:</td><td><input type='text' name='newsrvrem' value='$fwhostsettings{'SRVGRP_REMARK'}' style='width:98%;'></td><td align='right'><input type='submit' value='$Lang::tr{'fwhost change'}'><input type='hidden' name='oldsrvrem' value='$fwhostsettings{'oldsrvgrpremark'}'><input type='hidden' name='ACTION' value='changesrvgrpremark' ></td></tr>
1356 <tr><td colspan='3'><br><hr></td></td></tr>
1360 if($fwhostsettings{'updatesrvgrp'} eq 'on'){
1362 <form method='post'><input type='hidden' name='SRVGRP_REMARK' value='$fwhostsettings{'SRVGRP_REMARK'}'><input type='hidden' name='SRVGRP_NAME' value='$fwhostsettings{'SRVGRP_NAME'}'><table border='0' width='100%'>
1363 <tr><td width='1%' nowrap='nowrap'>$Lang::tr{'fwhost cust service'}</td><td><select name='CUST_SRV' style='min-width:185px;'>
1365 &General
::readhasharray
("$configsrv", \
%customservice);
1366 foreach my $key (sort { ncmp
($customservice{$a}[0],$customservice{$b}[0]) } keys %customservice)
1368 print "<option>$customservice{$key}[0]</option>";
1372 <tr><td colspan='4'><br><br></td></tr>
1373 <tr><td colspan='4'><hr></td></tr>
1378 <table width='100%' border='0'>
1379 <tr><td align='right'><input type='submit' value='$Lang::tr{'add'}' style='min-width:100px;' /><input type='hidden' name='updatesrvgrp' value='$fwhostsettings{'updatesrvgrp'}'><input type='hidden' name='oldsrvgrpremark' value='$fwhostsettings{'oldsrvgrpremark'}'><input type='hidden' name='ACTION' value='saveservicegrp' ></form><form style='display:inline;' method='post'><input type='submit' value='$Lang::tr{'fwhost back'}' style='min-width:100px;'></td></tr>
1382 &Header
::closebox
();
1387 if(! -z
$confignet){
1388 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost cust net'});
1389 &General
::readhasharray
("$confignet", \
%customnetwork);
1390 if (!keys %customnetwork)
1392 print "<center><b>$Lang::tr{'fwhost empty'}</b>";
1395 <table border='0' width='100%' cellspacing='0'>
1396 <tr><td align='center'><b>$Lang::tr{'name'}</b></td><td align='center'><b>$Lang::tr{'fwhost netaddress'}</b></td><td align='center'><b>$Lang::tr{'remark'}</b></td><td align='center'><b>$Lang::tr{'used'}</b></td><td></td><td width='3%'></td></tr>
1400 foreach my $key (sort {ncmp
($a,$b)} keys %customnetwork) {
1401 if ($fwhostsettings{'ACTION'} eq 'editnet' && $fwhostsettings{'HOSTNAME'} eq $customnetwork{$key}[0]) {
1402 print" <tr bgcolor='${Header::colouryellow}'>";
1405 print" <tr bgcolor='$color{'color22'}'>";
1408 print" <tr bgcolor='$color{'color20'}'>";
1410 my $colnet="$customnetwork{$key}[1]/".&General
::subtocidr
($customnetwork{$key}[2]);
1411 print"<td width='20%'><form method='post'>$customnetwork{$key}[0]</td><td width='15%' align='center'>".&Header
::colorize
($colnet)."</td><td width='40%'>$customnetwork{$key}[3]</td><td align='center'>$customnetwork{$key}[4]x</td>";
1413 <td width='1%'><input type='image' src='/images/edit.gif' align='middle' alt=$Lang::tr{'edit'} title=$Lang::tr{'edit'} />
1414 <input type='hidden' name='ACTION' value='editnet'>
1415 <input type='hidden' name='HOSTNAME' value='$customnetwork{$key}[0]' />
1416 <input type='hidden' name='IP' value='$customnetwork{$key}[1]' />
1417 <input type='hidden' name='SUBNET' value='$customnetwork{$key}[2]' />
1418 <input type='hidden' name='NETREMARK' value='$customnetwork{$key}[3]' />
1421 if($customnetwork{$key}[4] == '0')
1423 print"<td width='1%'><form method='post'><input type='image' src='/images/delete.gif' align='middle' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} /><input type='hidden' name='ACTION' value='delnet' /><input type='hidden' name='key' value='$customnetwork{$key}[0]' /></td></form></tr>";
1425 print"<td></td></tr>";
1430 &Header
::closebox
();
1436 if (! -z
$confighost){
1437 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost cust addr'});
1438 &General
::readhasharray
("$confighost", \
%customhost);
1439 if (!keys %customhost)
1441 print "<center><b>$Lang::tr{'fwhost empty'}</b>";
1444 <table border='0' width='100%' cellspacing='0'>
1445 <tr><td align='center'><b>$Lang::tr{'name'}</b></td><td align='center'><b>$Lang::tr{'fwhost ip_mac'}</b></td><td align='center'><b>$Lang::tr{'remark'}</b></td><td align='center'><b>$Lang::tr{'used'}</b></td><td></td><td width='3%'></td></tr>
1449 foreach my $key (sort { ncmp
($customhost{$a}[0],$customhost{$b}[0])} keys %customhost) {
1450 if ( ($fwhostsettings{'ACTION'} eq 'edithost' || $fwhostsettings{'error'}) && $fwhostsettings{'HOSTNAME'} eq $customhost{$key}[0]) {
1451 print" <tr bgcolor='${Header::colouryellow}'>";
1452 }elsif ($count % 2){ print" <tr bgcolor='$color{'color22'}'>";}
1453 else{ print" <tr bgcolor='$color{'color20'}'>";}
1454 my ($ip,$sub)=split(/\//,$customhost{$key}[2]);
1455 $customhost{$key}[4]=~s/\s+//g;
1456 print"<td width='20%'>$customhost{$key}[0]</td><td width='20%' align='center'>".&Header
::colorize
($ip)."</td><td width='50%' align='left'>$customhost{$key}[3]</td><td align='center'>$customhost{$key}[4]x</td>";
1458 <td width='1%'><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt=$Lang::tr{'edit'} title=$Lang::tr{'edit'} />
1459 <input type='hidden' name='ACTION' value='edithost' />
1460 <input type='hidden' name='HOSTNAME' value='$customhost{$key}[0]' />
1461 <input type='hidden' name='IP' value='$ip' />
1462 <input type='hidden' name='type' value='$customhost{$key}[1]' />
1463 <input type='hidden' name='HOSTREMARK' value='$customhost{$key}[3]' />
1466 if($customhost{$key}[4] == '0')
1468 print"<td width='1%'><form method='post'><input type='image' src='/images/delete.gif' align='middle' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} /><input type='hidden' name='ACTION' value='delhost' /><input type='hidden' name='key' value='$customhost{$key}[0]' /></td></form></tr>";
1470 print"<td width='1%'></td></tr>";
1475 &Header
::closebox
();
1480 if(! -z
"$configgrp"){
1481 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost cust grp'});
1482 &General
::readhasharray
("$configgrp", \
%customgrp);
1483 &General
::readhasharray
("$configipsec", \
%ipsecconf);
1484 &General
::readhasharray
("$configccdhost", \
%ccdhost);
1485 &General
::readhasharray
("$configccdnet", \
%ccdnet);
1486 &General
::readhasharray
("$confighost", \
%customhost);
1487 &General
::readhasharray
("$confignet", \
%customnetwork);
1495 if (!keys %customgrp)
1497 print "<center><b>$Lang::tr{'fwhost empty'}</b>";
1499 foreach my $key (sort { ncmp
($customgrp{$a}[0],$customgrp{$b}[0]) } sort { ncmp
($customgrp{$a}[2],$customgrp{$b}[2]) } keys %customgrp){
1501 if ($helper ne $customgrp{$key}[0]){
1503 foreach my $key1 (sort { ncmp
($customgrp{$a}[0],$customgrp{$b}[0]) } sort { ncmp
($customgrp{$a}[2],$customgrp{$b}[2]) } keys %customgrp){
1504 if ($customgrp{$key}[0] eq $customgrp{$key1}[0])
1513 if ($customgrp{$key}[2] eq "none"){$customgrp{$key}[2]=$Lang::tr
{'fwhost empty'};}
1514 $grpname=$customgrp{$key}[0];
1515 $remark="$customgrp{$key}[1]";
1516 if($count gt 2){ print"</table>";}
1517 print "<br><b><u>$grpname</u></b> ";
1518 print " <b>$Lang::tr{'remark'}:</b>  $remark   " if ($remark ne '');
1519 print "<b>$Lang::tr{'used'}:</b> $customgrp{$key}[4]x";
1520 if($customgrp{$key}[4] == '0')
1522 print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='ACTION' value='delgrp'></form>";
1524 print"<form method='post' style='display:inline'><input type='image' src='/images/edit.gif' alt=$Lang::tr{'edit'} title=$Lang::tr{'edit'} align='right' /><input type='hidden' name='grp_name' value='$grpname' ><input type='hidden' name='remark' value='$remark' ><input type='hidden' name='ACTION' value='editgrp'></form>";
1525 print"<table width='100%' style='border: 1px solid #CCCCCC;' rules='none' cellspacing='0'><tr><td align='center'><b>Name</b></td><td align='center'><b>$Lang::tr{'ip address'}</b></td><td align='center' width='25%'><b>$Lang::tr{'fwhost type'}</td><td></td></tr>";
1528 if ( ($fwhostsettings{'ACTION'} eq 'editgrp' || $fwhostsettings{'update'} ne '') && $fwhostsettings{'grp_name'} eq $customgrp{$key}[0]) {
1529 print" <tr bgcolor='${Header::colouryellow}'>";
1530 }elsif ($count %2 == 0){
1531 print"<tr bgcolor='$color{'color22'}'>";
1533 print"<tr bgcolor='$color{'color20'}'>";
1535 my $ip=&getipforgroup
($customgrp{$key}[2],$customgrp{$key}[3]);
1536 if ($ip eq ''){print"<tr bgcolor='${Header::colouryellow}'>";}
1537 print "<td width='39%' align='left'>";
1538 if($customgrp{$key}[3] eq 'Standard Network'){
1539 print &get_name
($customgrp{$key}[2])."</td>";
1541 print "$customgrp{$key}[2]</td>";
1543 if ($ip eq '' && $customgrp{$key}[2] ne $Lang::tr
{'fwhost empty'}){
1544 print "<td align='center'>$Lang::tr{'fwhost deleted'}</td><td align='center'>$customgrp{$key}[3]</td><td width='1%'><form method='post'>";
1546 my ($colip,$colsub) = split("/",$ip);
1547 $ip="$colip/".&General
::subtocidr
($colsub) if ($colsub);
1548 print"<td align='center'>".&Header
::colorize
($ip)."</td><td align='center'>$customgrp{$key}[3]</td><td width='1%'><form method='post'>";
1550 if ($delflag > '1' && $ip ne ''){
1551 print"<input type='image' src='/images/delete.gif' align='middle' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} />";
1553 print"<input type='hidden' name='ACTION' value='deletegrphost'><input type='hidden' name='grpcnt' value='$customgrp{$key}[4]'><input type='hidden' name='update' value='$fwhostsettings{'update'}'><input type='hidden' name='delhost' value='$grpname,$remark,$customgrp{$key}[2],$customgrp{$key}[3]'></form></td></tr>";
1555 $helper=$customgrp{$key}[0];
1561 &Header
::closebox
();
1565 sub viewtableservice
1568 if(! -z
"$configsrv")
1570 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost services'});
1571 &General
::readhasharray
("$configsrv", \
%customservice);
1573 <table width='100%' border='0' cellspacing='0'>
1574 <tr><td align='center'><b>$Lang::tr{'fwhost srv_name'}</b></td><td align='center'><b>$Lang::tr{'fwhost prot'}</b></td><td align='center'><b>$Lang::tr{'fwhost port'}</b></td><td align='center'><b>ICMP</b></td><td align='center'><b>$Lang::tr{'fwhost used'}</b></td><td></td><td width='3%'></td></tr>
1576 foreach my $key (sort { ncmp
($customservice{$a}[0],$customservice{$b}[0])} keys %customservice)
1579 if ( ($fwhostsettings{'updatesrv'} eq 'on' || $fwhostsettings{'error'}) && $fwhostsettings{'SRV_NAME'} eq $customservice{$key}[0]) {
1580 print" <tr bgcolor='${Header::colouryellow}'>";
1581 }elsif ($count % 2){ print" <tr bgcolor='$color{'color22'}'>";}else{ print" <tr bgcolor='$color{'color20'}'>";}
1583 <td>$customservice{$key}[0]</td><td align='center'>$customservice{$key}[2]</td><td align='center'>$customservice{$key}[1]</td><td align='center'>
1585 if($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
1588 </td><td align='center'>$customservice{$key}[4]x</td>
1589 <td width='1%'><form method='post'><input type='image' src='/images/edit.gif' align='middle' alt=$Lang::tr{'edit'} title=$Lang::tr{'edit'} /><input type='hidden' name='ACTION' value='editservice' />
1590 <input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
1591 <input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
1592 <input type='hidden' name='PROT' value='$customservice{$key}[2]' /></form></td>
1594 if ($customservice{$key}[4] eq '0')
1596 print"<td width='1%'><form method='post'><input type='image' src='/images/delete.gif' align='middle' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} /><input type='hidden' name='ACTION' value='delservice' /><input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]'></td></tr></form>";
1598 print"<td></td></tr>";
1602 &Header
::closebox
();
1605 sub viewtableservicegrp
1614 if (! -z
$configsrvgrp){
1615 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost cust srvgrp'});
1616 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
1617 &General
::readhasharray
("$configsrv", \
%customservice);
1618 my $number= keys %customservicegrp;
1619 foreach my $key (sort { ncmp
($customservicegrp{$a}[0],$customservicegrp{$b}[0]) } keys %customservicegrp){
1621 if ($helper ne $customservicegrp{$key}[0]){
1623 foreach my $key1 (sort { ncmp
($customservicegrp{$a}[0],$customservicegrp{$b}[0]) } sort { ncmp
($customservicegrp{$a}[2],$customservicegrp{$b}[2]) } keys %customservicegrp){
1624 if ($customservicegrp{$key}[0] eq $customservicegrp{$key1}[0])
1632 $grpname=$customservicegrp{$key}[0];
1633 if ($customservicegrp{$key}[2] eq "none"){
1634 $customservicegrp{$key}[2]=$Lang::tr
{'fwhost empty'};
1638 $remark="$customservicegrp{$key}[1]";
1639 if($count >=2){print"</table>";}
1640 print "<br><b><u>$grpname</u></b> ";
1641 print "<b>$Lang::tr{'remark'}:</b> $remark " if ($remark ne '');
1642 print " <b>$Lang::tr{'used'}:</b> $customservicegrp{$key}[3]x";
1643 if($customservicegrp{$key}[3] == '0')
1645 print"<form method='post' style='display:inline'><input type='image' src='/images/delete.gif' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='ACTION' value='delservicegrp'></form>";
1647 print"<form method='post' style='display:inline'><input type='image' src='/images/edit.gif' alt=$Lang::tr{'edit'} title=$Lang::tr{'edit'} align='right' /><input type='hidden' name='SRVGRP_NAME' value='$grpname' ><input type='hidden' name='SRVGRP_REMARK' value='$remark' ><input type='hidden' name='ACTION' value='editservicegrp'></form>";
1648 print"<table width='100%' style='border: 1px solid #CCCCCC;' rules='none' cellspacing='0'><tr><td align='center'><b>Name</b></td><td align='center'><b>$Lang::tr{'port'}</b></td><td align='center' width='25%'><b>$Lang::tr{'fwhost prot'}</td><td></td></tr>";
1650 if( $fwhostsettings{'SRVGRP_NAME'} eq $customservicegrp{$key}[0]) {
1651 print" <tr bgcolor='${Header::colouryellow}'>";
1652 }elsif ($count %2 == 0){
1653 print"<tr bgcolor='$color{'color22'}'>";
1655 print"<tr bgcolor='$color{'color20'}'>";
1657 print "<td width='39%'>$customservicegrp{$key}[2]</td>";
1658 foreach my $srv (sort keys %customservice){
1659 if ($customservicegrp{$key}[2] eq $customservice{$srv}[0]){
1660 $protocol=$customservice{$srv}[2];
1661 $port=$customservice{$srv}[1];
1665 print"<td align='center'>$port</td><td align='center'>$protocol</td><td width='1%'><form method='post'>";
1666 if ($number gt '1'){
1667 print"<input type='image' src='/images/delete.gif' align='middle' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} />";
1669 print"<input type='hidden' name='ACTION' value='delgrpservice'><input type='hidden' name='updatesrvgrp' value='$fwhostsettings{'updatesrvgrp'}'><input type='hidden' name='delsrvfromgrp' value='$grpname,$remark,$customservicegrp{$key}[2],$customservicegrp{$key}[3]'></form></td></tr>";
1670 $helper=$customservicegrp{$key}[0];
1673 &Header
::closebox
();
1679 my %hash=%{(shift)};
1680 foreach my $key (keys %hash) {
1681 if($hash{$key}[0] eq $fwhostsettings{'HOSTNAME'}){
1691 my %hash=%{(shift)};
1693 foreach my $key (keys %hash) {
1694 if($hash{$key}[$a] eq $fwhostsettings{'IP'}."/".&General
::iporsubtodec
($fwhostsettings{'SUBNET'})){
1702 my %hash=%{(shift)};
1703 &General
::readhasharray
("$confignet", \
%hash);
1704 foreach my $key (keys %hash) {
1705 if(&General
::IpInSubnet
($fwhostsettings{'IP'},$hash{$key}[1],$hash{$key}[2]))
1712 sub checkservicegroup
1714 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
1718 if ( ! &validhostname
($fwhostsettings{'SRVGRP_NAME'}))
1720 $errormessage.=$Lang::tr
{'fwhost err name'}."<br>";
1721 return $errormessage;
1723 #check empty selectbox
1724 if (keys %customservice lt 1)
1726 $errormessage.=$Lang::tr
{'fwhost err groupempty'}."<br>";
1728 #check if name already exists
1729 if ($fwhostsettings{'updatesrvgrp'} ne 'on'){
1730 foreach my $key (keys %customservicegrp) {
1731 if( $customservicegrp{$key}[0] eq $fwhostsettings{'SRVGRP_NAME'} ){
1732 $errormessage.=$Lang::tr
{'fwhost err grpexist'}."<br>";
1737 #check if service already exists in group
1738 foreach my $key (keys %customservicegrp) {
1739 if($customservicegrp{$key}[0] eq $fwhostsettings{'SRVGRP_NAME'} && $customservicegrp{$key}[2] eq $fwhostsettings{'CUST_SRV'} ){
1740 $errormessage.=$Lang::tr
{'fwhost err srvexist'}."<br>";
1743 return $errormessage;
1747 if ($errormessage) {
1748 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
1749 print "<class name='base'>$errormessage\n";
1750 print " </class>\n";
1751 &Header
::closebox
();
1757 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost hint'});
1758 print "<class name='base'>$hint\n";
1759 print " </class>\n";
1760 &Header
::closebox
();
1766 &General
::setup_default_networks
(\
%defaultNetworks);
1767 foreach my $network (sort keys %defaultNetworks)
1769 return "$network" if ($val eq $defaultNetworks{$network}{'NAME'});
1777 &General
::readhasharray
("$config",\
%hash);
1778 foreach my $key (keys %hash) {
1779 $errormessage.="lese $hash{$key}[2] und $target<br>";
1780 if($hash{$key}[2] eq $target){
1783 $errormessage.="Habe $target aus Gruppe gelöscht!<br>";
1786 &General
::writehasharray
("$config",\
%hash);
1793 if (!&validhostname
($fwhostsettings{'HOSTNAME'}))
1795 $errormessage=$errormessage.$Lang::tr
{'fwhost err name'};
1796 $fwhostsettings{'BLK_IP'}='readonly';
1797 $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
1798 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
1800 #check if name collides with CCD Netname
1801 &General
::readhasharray
("$configccdnet", \
%ccdnet);
1802 foreach my $key (keys %ccdnet) {
1803 if($ccdnet{$key}[0] eq $fwhostsettings{'HOSTNAME'}){
1804 $errormessage=$errormessage.$Lang::tr
{'fwhost err isccdnet'};;
1805 $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
1806 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
1810 #check if IP collides with CCD NetIP
1811 if ($fwhostsettings{'type'} ne 'mac'){
1812 &General
::readhasharray
("$configccdnet", \
%ccdnet);
1813 foreach my $key (keys %ccdnet) {
1814 my $test=(&General
::getnetworkip
($fwhostsettings{'IP'},&General
::iporsubtocidr
($fwhostsettings{'SUBNET'})))."/".$fwhostsettings{'SUBNET'};
1815 if($ccdnet{$key}[1] eq $test){
1816 $errormessage=$errormessage.$Lang::tr
{'fwhost err isccdipnet'};
1817 $fwhostsettings{'IP'} = $fwhostsettings{'orgip'};
1818 $fwhostsettings{'SUBNET'} = $fwhostsettings{'orgsubnet'};
1819 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
1824 #check if name collides with CCD Hostname
1825 &General
::readhasharray
("$configccdhost", \
%ccdhost);
1826 foreach my $key (keys %ccdhost) {
1827 my ($ip,$sub)=split(/\//,$ccdhost{$key}[33]);
1828 if($ip eq $fwhostsettings{'IP'}){
1829 $errormessage=$Lang::tr
{'fwhost err isccdiphost'};
1830 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
1834 #check if IP collides with CCD HostIP (only hosts)
1835 if ($edit eq 'edithost')
1837 foreach my $key (keys %ccdhost) {
1838 if($ccdhost{$key}[1] eq $fwhostsettings{'HOSTNAME'}){
1839 $errormessage=$Lang::tr
{'fwhost err isccdhost'};
1840 $fwhostsettings{'IP'} = $fwhostsettings{'orgname'};
1841 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
1846 #check if network with this name already exists
1847 &General
::readhasharray
("$confignet", \
%customnetwork);
1848 if (!&checkname
(\
%customnetwork))
1850 $errormessage=$errormessage."<br>".$Lang::tr
{'fwhost err netexist'};
1851 $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
1852 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
1854 #check if network ip already exists
1855 if (!&checkip
(\
%customnetwork,1))
1857 $errormessage=$errormessage."<br>".$Lang::tr
{'fwhost err net'};
1858 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
1860 #check if host with this name already exists
1861 &General
::readhasharray
("$confighost", \
%customhost);
1862 if (!&checkname
(\
%customhost))
1864 $errormessage.="<br>".$Lang::tr
{'fwhost err hostexist'};
1865 $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
1866 if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
1868 #check if host with this ip already exists
1869 if (!&checkip
(\
%customhost,2))
1871 $errormessage=$errormessage."<br>".$Lang::tr
{'fwhost err ipcheck'};
1881 #get address from IPSEC NETWORK
1882 if ($type eq 'IpSec Network'){
1883 foreach my $key (keys %ipsecconf) {
1884 if ($ipsecconf{$key}[1] eq $name){
1885 return $ipsecconf{$key}[11];
1888 &deletefromgrp
($name,$configgrp);
1891 #get address from IPSEC HOST
1892 if ($type eq 'IpSec Host'){
1893 foreach my $key (keys %ipsecconf) {
1894 if ($ipsecconf{$key}[1] eq $name){
1895 return $ipsecconf{$key}[10];
1898 &deletefromgrp
($name,$configgrp);
1901 #get address from ovpn ccd Net-2-Net
1902 if ($type eq 'OpenVPN N-2-N'){
1903 foreach my $key (keys %ccdhost) {
1904 if($ccdhost{$key}[1] eq $name){
1905 my ($a,$b) = split ("/",$ccdhost{$key}[11]);
1906 $b=&General
::iporsubtodec
($b);
1910 &deletefromgrp
($name,$configgrp);
1913 #get address from ovpn ccd static host
1914 if ($type eq 'OpenVPN static host'){
1915 foreach my $key (keys %ccdhost) {
1916 if($ccdhost{$key}[1] eq $name){
1917 my ($a,$b) = split (/\//,$ccdhost{$key}[33]);
1918 $b=&General
::iporsubtodec
($b);
1922 &deletefromgrp
($name,$configgrp);
1925 #get address from ovpn ccd static net
1926 if ($type eq 'OpenVPN static network'){
1927 foreach my $key (keys %ccdnet) {
1928 if ($ccdnet{$key}[0] eq $name){
1929 my ($a,$b) = split (/\//,$ccdnet{$key}[1]);
1930 $b=&General
::iporsubtodec
($b);
1936 #check custom addresses
1937 if ($type eq 'Custom Host'){
1938 foreach my $key (keys %customhost) {
1939 if ($customhost{$key}[0] eq $name){
1940 my ($ip,$sub) = split("/",$customhost{$key}[2]);
1946 ##check custom networks
1947 if ($type eq 'Custom Network'){
1948 foreach my $key (keys %customnetwork) {
1949 if($customnetwork{$key}[0] eq $name){
1950 return $customnetwork{$key}[1]."/".$customnetwork{$key}[2];
1955 #check standard networks
1956 if ($type eq 'Standard Network'){
1957 if ($name =~ /OpenVPN/i){
1959 &General
::readhash
("${General::swroot}/ovpn/settings",\
%ovpn);
1960 return $ovpn{'DOVPN_SUBNET'};
1962 if ($name eq 'GREEN'){
1964 &General
::readhash
("${General::swroot}/ethernet/settings",\
%hash);
1965 return $hash{'GREEN_NETADDRESS'}."/".$hash{'GREEN_NETMASK'};
1967 if ($name eq 'BLUE'){
1969 &General
::readhash
("${General::swroot}/ethernet/settings",\
%hash);
1970 return $hash{'BLUE_NETADDRESS'}."/".$hash{'BLUE_NETMASK'};
1972 if ($name eq 'ORANGE'){
1974 &General
::readhash
("${General::swroot}/ethernet/settings",\
%hash);
1975 return $hash{'ORANGE_NETADDRESS'}."/".$hash{'ORANGE_NETMASK'};
1977 if ($name eq 'ALL'){
1978 return "0.0.0.0/0.0.0.0";
1980 if ($name =~ /IPsec/i){
1982 &General
::readhash
("${General::swroot}/vpn/settings",\
%hash);
1983 return $hash{'RW_NET'};
1989 if (!-f
"${General::swroot}/fwhosts/reread"){
1990 system("touch ${General::swroot}/fwhosts/reread");
1991 system("touch ${General::swroot}/forward/reread");
1996 system ("/usr/local/bin/forwardfwctrl");
1997 if ( -f
"${General::swroot}/fwhosts/reread"){
1998 system("rm ${General::swroot}/fwhosts/reread");
1999 system("rm ${General::swroot}/forward/reread");
2006 &General
::readhasharray
("$confignet", \
%customnetwork);
2007 &General
::readhasharray
("$confighost", \
%customhost);
2008 foreach my $key (sort keys %customgrp ){
2009 if ( ($customgrp{$key}[0] eq $grp) && ($customgrp{$key}[3] eq 'Custom Network')){
2010 foreach my $key1 (sort keys %customnetwork){
2011 if ($customnetwork{$key1}[0] eq $customgrp{$key}[2]){
2012 $customnetwork{$key1}[4]=$customnetwork{$key1}[4]-1;
2018 if (($customgrp{$key}[0] eq $grp) && ($customgrp{$key}[3] eq 'Custom Host')){
2019 foreach my $key2 (sort keys %customhost){
2020 if ($customhost{$key2}[0] eq $customgrp{$key}[2]){
2021 $customhost{$key2}[4]=$customhost{$key2}[4]-1;
2028 &General
::writehasharray
("$confignet", \
%customnetwork);
2029 &General
::writehasharray
("$confighost", \
%customhost);
2034 &General
::readhasharray
("$configsrv", \
%customservice);
2035 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
2037 foreach my $key (sort keys %customservicegrp){
2038 if ($customservicegrp{$key}[0] eq $grp ){
2039 foreach my $key2 (sort keys %customservice){
2040 if ($customservice{$key2}[0] eq $customservicegrp{$key}[2]){
2041 $customservice{$key2}[4]--;
2046 &General
::writehasharray
("$configsrv", \
%customservice);
2052 my %hash=%{(shift)};
2054 if ($fwhostsettings{'SRV_NAME'} eq '' ){
2055 $errormessage=$Lang::tr
{'fwhost err name1'};
2057 if ($fwhostsettings{'SRV_PORT'} eq '' && $fwhostsettings{'PROT'} ne 'ICMP'){
2058 $errormessage=$Lang::tr
{'fwhost err port'};
2061 if (! &validhostname
($fwhostsettings{'SRV_NAME'})){
2062 $errormessage="<br>".$Lang::tr
{'fwhost err name'};
2064 #change dashes with :
2065 $fwhostsettings{'SRV_PORT'}=~ tr/-/:/;
2067 if ($fwhostsettings{'SRV_PORT'} eq "*") {
2068 $fwhostsettings{'SRV_PORT'} = "1:65535";
2070 if ($fwhostsettings{'SRV_PORT'} =~ /^(\D)\:(\d+)$/) {
2071 $fwhostsettings{'SRV_PORT'} = "1:$2";
2073 if ($fwhostsettings{'SRV_PORT'} =~ /^(\d+)\:(\D)$/) {
2074 $fwhostsettings{'SRV_PORT'} = "$1:65535";
2076 if($fwhostsettings{'PROT'} ne 'ICMP'){
2077 $errormessage = $errormessage.&General
::validportrange
($fwhostsettings{'SRV_PORT'}, 'src');
2079 # a new service has to have a different name
2080 foreach my $key (keys %hash){
2081 if ($hash{$key}[0] eq $fwhostsettings{'SRV_NAME'}){
2082 $errormessage = "<br>".$Lang::tr
{'fwhost err srv exists'};
2086 return $errormessage;
2090 # Checks a hostname against RFC1035
2091 my $hostname = $_[0];
2093 # Each part should be at least two characters in length
2094 # but no more than 63 characters
2095 if (length ($hostname) < 1 || length ($hostname) > 63) {
2097 # Only valid characters are a-z, A-Z, 0-9 and -
2098 if ($hostname !~ /^[a-zA-ZäöüÖÄÜ0-9-_.;()\/\s
]*$/) {
2100 # First character can only be a letter or a digit
2101 if (substr ($hostname, 0, 1) !~ /^[a-zA-ZöäüÖÄÜ0-9]*$/) {
2103 # Last character can only be a letter or a digit
2104 if (substr ($hostname, -1, 1) !~ /^[a-zA-ZöäüÖÄÜ0-9()]*$/) {
2110 # Checks a hostname against RFC1035
2112 # Each part should be at least two characters in length
2113 # but no more than 63 characters
2114 if (length ($remark) < 1 || length ($remark) > 255) {
2116 # Only valid characters are a-z, A-Z, 0-9 and -
2117 if ($remark !~ /^[a-zäöüA-ZÖÄÜ0-9-.:;\|_()\/\s
]*$/) {
2119 # First character can only be a letter or a digit
2120 if (substr ($remark, 0, 1) !~ /^[a-zäöüA-ZÖÄÜ0-9]*$/) {
2122 # Last character can only be a letter or a digit
2123 if (substr ($remark, -1, 1) !~ /^[a-zöäüA-ZÖÄÜ0-9.:;_)]*$/) {
2127 &Header
::closebigbox
();
2128 &Header
::closepage
();