Firewall: Added new feature: Now protocols can be added to servicegroups (GRE,AH,ESP,IPIP,IPV6)

This commit is contained in:
Alexander Marx
2013-12-06 08:47:11 +01:00
parent 342a91ae25
commit 82b837cff8
3 changed files with 50 additions and 13 deletions

View File

@@ -90,7 +90,10 @@ sub get_srvgrp_prot
$udp=1;
}elsif(&get_srv_prot($customservicegrp{$key}[2]) eq 'ICMP'){
$icmp=1;
}
}else{
#Protocols used in servicegroups
push (@ips,$customservicegrp{$key}[2]);
}
}
}
if ($tcp eq '1'){push (@ips,'TCP');}

View File

@@ -252,6 +252,9 @@ sub buildrules
#print rules to console
foreach my $DPROT (@DPROT){
$DPORT = &get_port($hash,$key,$DPROT);
if ($DPROT ne 'TCP' && $DPROT ne 'UDP' && $DPROT ne 'ICMP' ){
$DPORT='';
}
$PROT=$DPROT;
$PROT="-p $PROT" if ($PROT ne '' && $PROT ne ' ');
foreach my $a (sort keys %sourcehash){
@@ -333,6 +336,9 @@ sub buildrules
$DPORT = &get_port($hash,$key,$DPROT);
$PROT=$DPROT;
$PROT="-p $PROT" if ($PROT ne '' && $PROT ne ' ');
if ($DPROT ne 'TCP' && $DPROT ne'UDP' && $DPROT ne 'ICMP' ){
$DPORT='';
}
foreach my $a (sort keys %sourcehash){
foreach my $b (sort keys %targethash){
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'){