]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - config/firewall/rules.pl
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2013 Alexander Marx <amarx@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 ###############################################################################
24 no warnings
'uninitialized' ;
26 require '/var/ipfire/general-functions.pl' ;
27 require "${General::swroot}/lang.pl" ;
28 require "/usr/lib/firewall/firewall-lib.pl" ;
30 # Set to one to enable debugging mode.
33 my $IPTABLES = "iptables --wait" ;
36 my %defaultNetworks =();
46 my %configoutgoingfw =();
52 my $configfwdfw = "${General::swroot}/firewall/config" ;
53 my $configinput = "${General::swroot}/firewall/input" ;
54 my $configoutgoing = "${General::swroot}/firewall/outgoing" ;
55 my $p2pfile = "${General::swroot}/firewall/p2protocols" ;
56 my $configgrp = "${General::swroot}/fwhosts/customgroups" ;
57 my $netsettings = "${General::swroot}/ethernet/settings" ;
58 my $errormessage = '' ;
62 my ( $TYPE , $PROT , $SPROT , $DPROT , $SPORT , $DPORT , $TIME , $TIMEFROM , $TIMETILL , $SRC_TGT );
63 my $CHAIN = "FORWARDFW" ;
64 my $conexists = 'off' ;
68 & General
:: readhash
( "${General::swroot}/firewall/settings" , \
%fwdfwsettings );
69 & General
:: readhash
( " $netsettings " , \
%defaultNetworks );
70 & General
:: readhasharray
( $configfwdfw , \
%configfwdfw );
71 & General
:: readhasharray
( $configinput , \
%configinputfw );
72 & General
:: readhasharray
( $configoutgoing , \
%configoutgoingfw );
73 & General
:: readhasharray
( $configgrp , \
%customgrp );
74 & General
:: get_aliases
( \
%aliases );
76 #check if we have an internetconnection
77 open ( CONN
, "/var/ipfire/red/iface" );
81 if (- f
"/var/ipfire/red/active" ){
85 open ( CONN1
, "/var/ipfire/red/local-ipaddress" );
96 # Reload firewall rules.
99 # Load P2P block rules.
102 # Reload firewall policy.
103 run
( "/usr/sbin/firewall-policy" );
107 # Executes or prints the given shell command.
118 run
( " $IPTABLES -F FORWARDFW" );
119 run
( " $IPTABLES -F INPUTFW" );
120 run
( " $IPTABLES -F OUTGOINGFW" );
121 run
( " $IPTABLES -t nat -F NAT_DESTINATION" );
122 run
( " $IPTABLES -t nat -F NAT_SOURCE" );
126 if (! - z
"${General::swroot}/firewall/config" ){
127 & buildrules
( \
%configfwdfw );
129 if (! - z
"${General::swroot}/firewall/input" ){
130 & buildrules
( \
%configinputfw );
132 if (! - z
"${General::swroot}/firewall/outgoing" ){
133 & buildrules
( \
%configoutgoingfw );
147 foreach my $key ( sort { $a <=> $b } keys % $hash ){
148 next if (($ $hash { $key }[ 6 ] eq 'RED' || $ $hash { $key }[ 6 ] eq 'RED1' ) && $conexists eq 'off' );
149 if ($ $hash { $key }[ 28 ] eq 'ON' ){
150 $natip =& get_nat_ip
($ $hash { $key }[ 29 ],$ $hash { $key }[ 31 ]);
151 if ($ $hash { $key }[ 31 ] eq 'dnat' ){
153 if ($ $hash { $key }[ 30 ] =~ /\|/ ){
154 $ $hash { $key }[ 30 ]=~ tr/|/,/ ;
155 $fireport = '-m multiport --dport ' .$ $hash { $key }[ 30 ];
157 $fireport = '--dport ' .$ $hash { $key }[ 30 ] if ($ $hash { $key }[ 30 ]> 0 );
164 if ($ $hash { $key }[ 2 ] eq 'ON' ){
166 if ($ $hash { $key }[ 3 ] eq 'cust_grp_src' ){
167 foreach my $grp ( sort { $a <=> $b } keys %customgrp ){
168 if ( $customgrp { $grp }[ 0 ] eq $ $hash { $key }[ 4 ]){
169 & get_address
( $customgrp { $grp }[ 3 ], $customgrp { $grp }[ 2 ], "src" );
173 & get_address
($ $hash { $key }[ 3 ],$ $hash { $key }[ 4 ], "src" );
176 if ($ $hash { $key }[ 5 ] eq 'cust_grp_tgt' ){
177 foreach my $grp ( sort { $a <=> $b } keys %customgrp ){
178 if ( $customgrp { $grp }[ 0 ] eq $ $hash { $key }[ 6 ]){
179 & get_address
( $customgrp { $grp }[ 3 ], $customgrp { $grp }[ 2 ], "tgt" );
182 } elsif ($ $hash { $key }[ 5 ] eq 'ipfire' ){
183 if ($ $hash { $key }[ 6 ] eq 'GREEN' ){
184 $targethash { $key }[ 0 ]= $defaultNetworks { 'GREEN_ADDRESS' };
186 if ($ $hash { $key }[ 6 ] eq 'BLUE' ){
187 $targethash { $key }[ 0 ]= $defaultNetworks { 'BLUE_ADDRESS' };
189 if ($ $hash { $key }[ 6 ] eq 'ORANGE' ){
190 $targethash { $key }[ 0 ]= $defaultNetworks { 'ORANGE_ADDRESS' };
192 if ($ $hash { $key }[ 6 ] eq 'ALL' ){
193 $targethash { $key }[ 0 ]= '0.0.0.0/0' ;
195 if ($ $hash { $key }[ 6 ] eq 'RED' || $ $hash { $key }[ 6 ] eq 'RED1' ){
196 open ( FILE
, "/var/ipfire/red/local-ipaddress" ) or die "Couldn't open local-ipaddress" ;
197 $targethash { $key }[ 0 ]= < FILE
>;
200 foreach my $alias ( sort keys %aliases ){
201 if ($ $hash { $key }[ 6 ] eq $alias ){
202 $targethash { $key }[ 0 ]= $aliases { $alias }{ 'IPT' };
207 & get_address
($ $hash { $key }[ 5 ],$ $hash { $key }[ 6 ], "tgt" );
209 ##get source prot and port
211 $SPORT = & get_port
( $hash , $key );
214 ##get target prot and port
215 $DPROT =& get_prot
( $hash , $key );
217 if ( $DPROT eq '' ){ $DPROT = ' ' ;}
218 @DPROT = split ( "," , $DPROT );
221 if ($ $hash { $key }[ 18 ] eq 'ON' ){
222 my ( $time1 , $time2 , $daylight );
223 my $daylight =$ $hash { $key }[ 28 ];
224 $time1 =& get_time
($ $hash { $key }[ 26 ], $daylight );
225 $time2 =& get_time
($ $hash { $key }[ 27 ], $daylight );
226 if ($ $hash { $key }[ 19 ] ne '' ){ push ( @timeframe , "Mon" );}
227 if ($ $hash { $key }[ 20 ] ne '' ){ push ( @timeframe , "Tue" );}
228 if ($ $hash { $key }[ 21 ] ne '' ){ push ( @timeframe , "Wed" );}
229 if ($ $hash { $key }[ 22 ] ne '' ){ push ( @timeframe , "Thu" );}
230 if ($ $hash { $key }[ 23 ] ne '' ){ push ( @timeframe , "Fri" );}
231 if ($ $hash { $key }[ 24 ] ne '' ){ push ( @timeframe , "Sat" );}
232 if ($ $hash { $key }[ 25 ] ne '' ){ push ( @timeframe , "Sun" );}
233 $TIME = join ( "," , @timeframe );
235 $TIMEFROM = "--timestart $time1 " ;
236 $TIMETILL = "--timestop $time2 " ;
237 $TIME = "-m time --weekdays $TIME $TIMEFROM $TIMETILL " ;
239 foreach my $DPROT ( @DPROT ){
240 $DPORT = & get_port
( $hash , $key , $DPROT );
242 $PROT = "-p $PROT " if ( $PROT ne '' && $PROT ne ' ' );
243 if ( $DPROT ne 'TCP' && $DPROT ne 'UDP' && $DPROT ne 'ICMP' ){
246 foreach my $a ( sort keys %sourcehash ){
247 foreach my $b ( sort keys %targethash ){
248 if (! $sourcehash { $a }[ 0 ] || ! $targethash { $b }[ 0 ] || ( $natip eq '-d ' && $ $hash { $key }[ 28 ] eq 'ON' ) || (! $natip && $ $hash { $key }[ 28 ] eq 'ON' )){
249 #Skip rules when no RED IP is set (DHCP,DSL)
252 next if ( $targethash { $b }[ 0 ] eq 'none' );
254 if ( $sourcehash { $a }[ 0 ] ne $targethash { $b }[ 0 ] && $targethash { $b }[ 0 ] ne 'none' || $sourcehash { $a }[ 0 ] eq '0.0.0.0/0.0.0.0' ){
256 if ( substr ( $sourcehash { $a }[ 0 ], 3 , 3 ) ne 'mac' && $sourcehash { $a }[ 0 ] ne '' ){ $STAG = "-s" ;}
258 if ( substr ( $DPORT , 2 , 4 ) eq 'icmp' ){
259 my @icmprule = split ( "," , substr ( $DPORT , 12 ,));
261 $icmptype = "--icmp-type " ;
266 if ($ $hash { $key }[ 17 ] eq 'ON' ){
267 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $icmptype $_ $TIME -j LOG" );
269 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $icmptype $_ $TIME -j $ $hash { $key }[0]" );
271 #PROCESS DNAT RULE (Portforward)
272 } elsif ($ $hash { $key }[ 28 ] eq 'ON' && $ $hash { $key }[ 31 ] eq 'dnat' ){
273 $natchain = 'NAT_DESTINATION' ;
274 if ($ $hash { $key }[ 17 ] eq 'ON' ){
275 run
( " $IPTABLES -t nat -A $natchain $PROT $STAG $sourcehash { $a }[0] $SPORT $natip $fireport $TIME -j LOG --log-prefix 'DNAT'" );
277 my ( $ip , $sub ) = split ( "/" , $targethash { $b }[ 0 ]);
278 #Process NAT with servicegroup used
279 if ($ $hash { $key }[ 28 ] eq 'ON' && $ $hash { $key }[ 31 ] eq 'dnat' && $ $hash { $key }[ 14 ] eq 'cust_srvgrp' ){
280 run
( " $IPTABLES -t nat -A $natchain $PROT $STAG $sourcehash { $a }[0] $SPORT $natip $fireport $TIME -j $nat --to-destination $ip $DPORT " );
281 $fwaccessdport = $DPORT ;
283 run
( " $IPTABLES -t nat -A $natchain $PROT $STAG $sourcehash { $a }[0] $SPORT $natip $fireport $TIME -j $nat --to-destination $ip $DPORT " );
286 $fwaccessdport = "--dport " . substr ( $DPORT , 1 ,);
287 } elsif (! $DPORT && $ $hash { $key }[ 30 ] ne '' ){
288 if ($ $hash { $key }[ 30 ]=~ m/|/i ){
289 $ $hash { $key }[ 30 ] =~ s/\|/,/g ;
290 $fwaccessdport = "-m multiport --dport $ $hash { $key }[30]" ;
292 $fwaccessdport = "--dport $ $hash { $key }[30]" ;
296 run
( " $IPTABLES -A FORWARDFW $PROT $STAG $sourcehash { $a }[0] -d $ip $fwaccessdport $TIME -j $ $hash { $key }[0]" );
299 } elsif ($ $hash { $key }[ 28 ] eq 'ON' && $ $hash { $key }[ 31 ] eq 'snat' ){
300 $natchain = 'NAT_SOURCE' ;
301 if ($ $hash { $key }[ 17 ] eq 'ON' ){
302 run
( " $IPTABLES -t nat -A $natchain $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j LOG --log-prefix 'SNAT'" );
304 run
( " $IPTABLES -t nat -A $natchain $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j $nat --to-source $natip " );
306 #PROCESS EVERY OTHER RULE (If NOT ICMP, else the rule would be applied double)
307 if ( $PROT ne '-p ICMP' ){
308 if ($ $hash { $key }[ 17 ] eq 'ON' && $ $hash { $key }[ 28 ] ne 'ON' ){
309 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j LOG" );
311 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j $ $hash { $key }[0]" );
313 #PROCESS Prot ICMP and type = All ICMP-Types
314 if ( $PROT eq '-p ICMP' && $ $hash { $key }[ 9 ] eq 'All ICMP-Types' ){
315 if ($ $hash { $key }[ 17 ] eq 'ON' && $ $hash { $key }[ 28 ] ne 'ON' ){
316 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j LOG" );
318 run
( " $IPTABLES -A $ $hash { $key }[1] $PROT $STAG $sourcehash { $a }[0] $SPORT -d $targethash { $b }[0] $DPORT $TIME -j $ $hash { $key }[0]" );
339 if ( $val eq 'RED' || $val eq 'GREEN' || $val eq 'ORANGE' || $val eq 'BLUE' ){
340 $result = $defaultNetworks { $val . '_ADDRESS' };
341 } elsif ( $val eq 'ALL' ){
343 } elsif ( $val eq 'Default IP' && $type eq 'dnat' ){
344 $result = '-d ' . $redip ;
345 } elsif ( $val eq 'Default IP' && $type eq 'snat' ){
348 foreach my $al ( sort keys %aliases ){
349 if ( $val eq $al && $type eq 'dnat' ){
350 $result = '-d ' . $aliases { $al }{ 'IPT' };
351 } elsif ( $val eq $al && $type eq 'snat' ){
352 $result = $aliases { $al }{ 'IPT' };
365 $minutes = & utcmin
( $val );
366 $ruletime = $minutes + & time_get_utc
( $val );
367 if ( $ruletime < 0 ){ $ruletime += 1440 ;}
368 if ( $ruletime > 1440 ){ $ruletime -= 1440 ;}
369 $time = sprintf " %02d : %02d " , $ruletime / 60 , $ruletime % 60 ;
374 # Calculates the UTCtime from a given time
376 my @localtime = localtime ( time );
377 my @gmtime = gmtime ( time );
378 my $diff = ( $gmtime [ 2 ]* 60 + $gmtime [ 1 ] %60 )-( $localtime [ 2 ]* 60 + $localtime [ 1 ] %60 );
384 my ( $hrs , $min ) = split ( ":" , $ruletime );
385 my $newtime = $hrs * 60 + $min ;
392 open ( FILE
, "< $p2pfile " ) or die "Unable to read $p2pfile " ;
395 my $CMD = "-m ipp2p" ;
396 foreach my $p2pentry ( sort @p2ps ) {
397 my @p2pline = split ( /\;/ , $p2pentry );
398 if ( $fwdfwsettings { 'POLICY' } eq 'MODE1' ) {
400 if ( " $p2pline [2]" eq "on" ) {
401 $P2PSTRING = " $P2PSTRING -- $p2pline [1]" ;
405 if ( " $p2pline [2]" eq "off" ) {
406 $P2PSTRING = " $P2PSTRING -- $p2pline [1]" ;
412 run
( " $IPTABLES -A FORWARDFW $CMD $P2PSTRING -j $DO " );
417 my $base = shift ; #source of checking ($configfwdfw{$key}[x] or groupkey
419 my $type = shift ; #src or tgt
426 my $key = & General
:: findhasharraykey
( $hash );
427 if ( $base eq 'src_addr' || $base eq 'tgt_addr' ){
428 if (& General
:: validmac
( $base2 )){
429 $ $hash { $key }[ 0 ] = "-m mac --mac-source $base2 " ;
431 $ $hash { $key }[ 0 ] = $base2 ;
433 } elsif ( $base eq 'std_net_src' || $base eq 'std_net_tgt' || $base eq 'Standard Network' ){
434 $ $hash { $key }[ 0 ]=& fwlib
:: get_std_net_ip
( $base2 , $con );
435 } elsif ( $base eq 'cust_net_src' || $base eq 'cust_net_tgt' || $base eq 'Custom Network' ){
436 $ $hash { $key }[ 0 ]=& fwlib
:: get_net_ip
( $base2 );
437 } elsif ( $base eq 'cust_host_src' || $base eq 'cust_host_tgt' || $base eq 'Custom Host' ){
438 $ $hash { $key }[ 0 ]=& fwlib
:: get_host_ip
( $base2 , $type );
439 } elsif ( $base eq 'ovpn_net_src' || $base eq 'ovpn_net_tgt' || $base eq 'OpenVPN static network' ){
440 $ $hash { $key }[ 0 ]=& fwlib
:: get_ovpn_net_ip
( $base2 , 1 );
441 } elsif ( $base eq 'ovpn_host_src' || $base eq 'ovpn_host_tgt' || $base eq 'OpenVPN static host' ){
442 $ $hash { $key }[ 0 ]=& fwlib
:: get_ovpn_host_ip
( $base2 , 33 );
443 } elsif ( $base eq 'ovpn_n2n_src' || $base eq 'ovpn_n2n_tgt' || $base eq 'OpenVPN N-2-N' ){
444 $ $hash { $key }[ 0 ]=& fwlib
:: get_ovpn_n2n_ip
( $base2 , 11 );
445 } elsif ( $base eq 'ipsec_net_src' || $base eq 'ipsec_net_tgt' || $base eq 'IpSec Network' ){
446 $ $hash { $key }[ 0 ]=& fwlib
:: get_ipsec_net_ip
( $base2 , 11 );
447 } elsif ( $base eq 'ipfire_src' ){
448 if ( $base2 eq 'GREEN' ){
449 $ $hash { $key }[ 0 ]= $defaultNetworks { 'GREEN_ADDRESS' };
451 if ( $base2 eq 'BLUE' ){
452 $ $hash { $key }[ 0 ]= $defaultNetworks { 'BLUE_ADDRESS' };
454 if ( $base2 eq 'ORANGE' ){
455 $ $hash { $key }[ 0 ]= $defaultNetworks { 'ORANGE_ADDRESS' };
458 $ $hash { $key }[ 0 ]= '0.0.0.0/0' ;
460 if ( $base2 eq 'RED' || $base2 eq 'RED1' ){
461 open ( FILE
, "/var/ipfire/red/local-ipaddress" );
462 $ $hash { $key }[ 0 ]= < FILE
>;
465 foreach my $alias ( sort keys %aliases ){
466 if ( $base2 eq $alias ){
467 $ $hash { $key }[ 0 ]= $aliases { $alias }{ 'IPT' };
477 #check AH,GRE,ESP or ICMP
478 if ($ $hash { $key }[ 7 ] ne 'ON' && $ $hash { $key }[ 11 ] ne 'ON' ){
479 return "$ $hash { $key }[8]" ;
481 if ($ $hash { $key }[ 7 ] eq 'ON' || $ $hash { $key }[ 11 ] eq 'ON' ){
482 #check if servicegroup or service
483 if ($ $hash { $key }[ 14 ] eq 'cust_srv' ){
484 return & fwlib
:: get_srv_prot
($ $hash { $key }[ 15 ]);
485 } elsif ($ $hash { $key }[ 14 ] eq 'cust_srvgrp' ){
486 return & fwlib
:: get_srvgrp_prot
($ $hash { $key }[ 15 ]);
487 } elsif (($ $hash { $key }[ 10 ] ne '' || $ $hash { $key }[ 15 ] ne '' ) && $ $hash { $key }[ 8 ] eq '' ){ #when ports are used and prot set to "all"
489 } elsif (($ $hash { $key }[ 10 ] ne '' || $ $hash { $key }[ 15 ] ne '' ) && ($ $hash { $key }[ 8 ] eq 'TCP' || $ $hash { $key }[ 8 ] eq 'UDP' )){ #when ports are used and prot set to "tcp" or "udp"
490 return "$ $hash { $key }[8]" ;
491 } elsif (($ $hash { $key }[ 10 ] eq '' && $ $hash { $key }[ 15 ] eq '' ) && $ $hash { $key }[ 8 ] ne 'ICMP' ){ #when ports are NOT used and prot NOT set to "ICMP"
492 return "$ $hash { $key }[8]" ;
494 return "$ $hash { $key }[8]" ;
498 if ( $SRC_TGT eq '' && $ $hash { $key }[ 31 ] eq 'dnat' && $ $hash { $key }[ 11 ] eq '' && $ $hash { $key }[ 12 ] ne '' ){
499 return "$ $hash { $key }[8]" ;
507 #Get manual defined Ports from SOURCE
508 if ($ $hash { $key }[ 7 ] eq 'ON' && $SRC_TGT eq 'SRC' ){
509 if ($ $hash { $key }[ 10 ] ne '' ){
510 $ $hash { $key }[ 10 ] =~ s/\|/,/g ;
511 if ( index ($ $hash { $key }[ 10 ], "," ) > 0 ){
512 return "-m multiport --sport $ $hash { $key }[10] " ;
514 if ($ $hash { $key }[ 28 ] ne 'ON' || ($ $hash { $key }[ 28 ] eq 'ON' && $ $hash { $key }[ 31 ] eq 'snat' ) ||($ $hash { $key }[ 28 ] eq 'ON' && $ $hash { $key }[ 31 ] eq 'dnat' ) ){
515 return "--sport $ $hash { $key }[10] " ;
517 return ":$ $hash { $key }[10]" ;
521 #Get manual ports from TARGET
522 } elsif ($ $hash { $key }[ 11 ] eq 'ON' && $SRC_TGT eq '' ){
523 if ($ $hash { $key }[ 14 ] eq 'TGT_PORT' ){
524 if ($ $hash { $key }[ 15 ] ne '' ){
525 $ $hash { $key }[ 15 ] =~ s/\|/,/g ;
526 if ( index ($ $hash { $key }[ 15 ], "," ) > 0 ){
527 return "-m multiport --dport $ $hash { $key }[15] " ;
529 if ($ $hash { $key }[ 28 ] ne 'ON' || ($ $hash { $key }[ 28 ] eq 'ON' && $ $hash { $key }[ 31 ] eq 'snat' ) ){
530 return "--dport $ $hash { $key }[15] " ;
532 $ $hash { $key }[ 15 ] =~ s/\:/-/g ;
533 return ":$ $hash { $key }[15]" ;
537 #Get ports defined in custom Service (firewall-groups)
538 } elsif ($ $hash { $key }[ 14 ] eq 'cust_srv' ){
539 if ( $prot ne 'ICMP' ){
540 if ($ $hash { $key }[ 31 ] eq 'dnat' && $ $hash { $key }[ 28 ] eq 'ON' ){
541 my $ports =& fwlib
:: get_srv_port
($ $hash { $key }[ 15 ], 1 , $prot );
545 return "--dport " .& fwlib
:: get_srv_port
($ $hash { $key }[ 15 ], 1 , $prot );
547 } elsif ( $prot eq 'ICMP' && $ $hash { $key }[ 11 ] eq 'ON' ){ #When PROT is ICMP and "use targetport is checked, this is an icmp-service
548 return "--icmp-type " .& fwlib
:: get_srv_port
($ $hash { $key }[ 15 ], 3 , $prot );
550 #Get ports from services which are used in custom servicegroups (firewall-groups)
551 } elsif ($ $hash { $key }[ 14 ] eq 'cust_srvgrp' ){
552 if ( $prot ne 'ICMP' ){
553 return & fwlib
:: get_srvgrp_port
($ $hash { $key }[ 15 ], $prot );
555 elsif ( $prot eq 'ICMP' ){
556 return & fwlib
:: get_srvgrp_port
($ $hash { $key }[ 15 ], $prot );
561 if ($ $hash { $key }[ 7 ] ne 'ON' && $ $hash { $key }[ 11 ] ne 'ON' && $SRC_TGT eq '' ){
562 if ($ $hash { $key }[ 9 ] ne '' && $ $hash { $key }[ 9 ] ne 'All ICMP-Types' ){
563 return "--icmp-type $ $hash { $key }[9] " ;
564 } elsif ($ $hash { $key }[ 9 ] eq 'All ICMP-Types' ){