]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/fwhosts.cgi
Firewall: appended check of maximum ports per protocol. portranges 100:200 count...
[people/teissler/ipfire-2.x.git] / html / cgi-bin / fwhosts.cgi
index 92c2d38b9475200665121d3a7e95d5e795c2d603..bc9ca85d4cf9487094ca5ada912652e9755faea4 100755 (executable)
@@ -46,6 +46,8 @@ my %ownnet=();
 my %ipsecsettings=();
 my %fwfwd=();
 my %fwinp=();
+my %ovpnsettings=();
+
 
 my $errormessage;
 my $hint;
@@ -58,8 +60,11 @@ my $configccdhost    = "${General::swroot}/ovpn/ovpnconfig";
 my $configipsec                = "${General::swroot}/vpn/config";
 my $configsrv          = "${General::swroot}/fwhosts/customservices";
 my $configsrvgrp       = "${General::swroot}/fwhosts/customservicegrp";
-my $fwconfigfwd                = "${General::swroot}/forward/config";
-my $fwconfiginp                = "${General::swroot}/forward/input";
+my $fwconfigfwd                = "${General::swroot}/firewall/config";
+my $fwconfiginp                = "${General::swroot}/firewall/input";
+my $configovpn         = "${General::swroot}/ovpn/settings";
+my $tdcolor='';
+my $configipsecrw      = "${General::swroot}/vpn/settings";
 
 unless (-e $confignet)    { system("touch $confignet"); }
 unless (-e $confighost)   { system("touch $confighost"); }
@@ -70,6 +75,10 @@ unless (-e $configsrvgrp) { system("touch $configsrvgrp"); }
 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
 &General::readhash("${General::swroot}/ethernet/settings", \%ownnet);
+&General::readhash("$configovpn", \%ovpnsettings);
+&General::readhasharray("$configipsec", \%ipsecconf);
+&General::readhash("$configipsecrw", \%ipsecsettings);
+
 &Header::getcgihash(\%fwhostsettings);
 
 &Header::showhttpheaders();
@@ -79,27 +88,32 @@ unless (-e $configsrvgrp) { system("touch $configsrvgrp"); }
 #### JAVA SCRIPT ####
 print<<END;
 <script>
+       var PROTOCOLS_WITH_PORTS = ["TCP", "UDP"];
+       var update_protocol = function() {
+               var protocol = \$("#protocol").val();
+
+               if (protocol === undefined)
+                       return;
+
+               // Check if we are dealing with a protocol, that knows ports.
+               if (\$.inArray(protocol, PROTOCOLS_WITH_PORTS) >= 0) {
+                       \$("#PORT").show();
+                       \$("#PROTOKOLL").hide();
+               } else {
+                       \$("#PORT").hide();
+                       \$("#PROTOKOLL").show();
+               }
+       };
+
        \$(document).ready(function() {
-               // Automatically select radio buttons when corresponding
-               // dropdown menu changes.
-               \$("select").change(function() {
-                       var id = \$(this).attr("name");
-                       //When using SNAT or DNAT, check "USE NAT" Checkbox
-                       if ( id === 'snat' || id === 'dnat') {
-                               \$('#USE_NAT').prop('checked', true);
-                       }
-                       \$('#' + id).prop("checked", true);
-               });
+               var protocol = \$("#protocol").val();
+               \$("#protocol").change(update_protocol);
+               update_protocol();
        });
 </script>
 END
 
 ## ACTION ####
-if ($fwhostsettings{'ACTION'} eq $Lang::tr{'fwdfw reread'})
-{
-       &reread_rules;
-       &showmenu;
-}
 # Update
 if ($fwhostsettings{'ACTION'} eq 'updatenet' )
 {
@@ -168,6 +182,13 @@ if ($fwhostsettings{'ACTION'} eq 'updateservice')
                        $fwhostsettings{'ICMP_TYPES'}='BLANK';
                }
                my $key1 = &General::findhasharraykey(\%customservice);
+               #find out short ICMP-TYPE
+               &General::readhasharray("${General::swroot}/fwhosts/icmp-types", \%icmptypes);
+               foreach my $key (keys %icmptypes){
+                       if ("$icmptypes{$key}[0] ($icmptypes{$key}[1])" eq $fwhostsettings{'ICMP_TYPES'}){
+                                       $fwhostsettings{'ICMP_TYPES'}=$icmptypes{$key}[0];
+                       }
+               }
                foreach my $i (0 .. 4) { $customservice{$key1}[$i] = "";}
                $customservice{$key1}[0] = $fwhostsettings{'SRV_NAME'};
                $customservice{$key1}[1] = $fwhostsettings{'SRV_PORT'};
@@ -211,17 +232,24 @@ if ($fwhostsettings{'ACTION'} eq 'updateservice')
                if($count gt 0 && $fwhostsettings{'oldsrvprot'} ne $fwhostsettings{'PROT'} ){
                        $needrules='on';
                }
+               if($count gt 0 && $fwhostsettings{'oldsrvicmp'} ne $fwhostsettings{'ICMP'} ){
+                       $needrules='on';
+               }
                $fwhostsettings{'SRV_NAME'}     = '';
                $fwhostsettings{'SRV_PORT'}     = '';
                $fwhostsettings{'PROT'}         = '';
+               $fwhostsettings{'ICMP'}         = '';
+               $fwhostsettings{'oldsrvicmp'} = '';
        }else{
                $fwhostsettings{'SRV_NAME'}     = $fwhostsettings{'oldsrvname'};
                $fwhostsettings{'SRV_PORT'}     = $fwhostsettings{'oldsrvport'};
                $fwhostsettings{'PROT'}         = $fwhostsettings{'oldsrvprot'};
+               $fwhostsettings{'ICMP'}         = $fwhostsettings{'oldsrvicmp'};
                $fwhostsettings{'updatesrv'}= 'on';
        }
+       $fwhostsettings{'updatesrv'} = '';
        if($needrules eq 'on'){
-               &rules;
+               &General::firewall_config_changed();
        }
        &addservice;
 }
@@ -383,7 +411,7 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
                        $fwhostsettings{'NETREMARK'}='';
                        #check if an edited net affected groups and need to reload rules
                        if ($needrules eq 'on'){
-                               &rules;
+                               &General::firewall_config_changed();
                        }
                        &addnet;
                        &viewtablenet;
@@ -519,7 +547,7 @@ if ($fwhostsettings{'ACTION'} eq 'savehost')
                         $fwhostsettings{'HOSTREMARK'}='';
                        #check if we need to update rules while host was edited
                        if($needrules eq 'on'){
-                               &rules;
+                               &General::firewall_config_changed();
                        }
                        &addhost;
                        &viewtablehost;
@@ -694,7 +722,7 @@ if ($fwhostsettings{'ACTION'} eq 'savegrp')
                #check if ruleupdate is needed
                if($count > 0 )
                {
-                       &rules;
+                       &General::firewall_config_changed();
                }
                &addgrp;
                &viewtablegrp;
@@ -712,7 +740,8 @@ if ($fwhostsettings{'ACTION'} eq 'saveservice')
                        }
                }
        }
-       if($ICMP eq ''){$ICMP='BLANK';}
+       if($ICMP eq ''){$ICMP=$fwhostsettings{'ICMP_TYPES'};}
+       if ($fwhostsettings{'PROT'} ne 'ICMP'){$ICMP='';}
        if (!$errormessage){
                my $key = &General::findhasharraykey (\%customservice);
                foreach my $i (0 .. 4) { $customservice{$key}[$i] = "";}
@@ -735,12 +764,34 @@ if ($fwhostsettings{'ACTION'} eq 'saveservicegrp')
        my $prot;
        my $port;
        my $count=0;
+       my $tcpcounter=0;
+       my $udpcounter=0;
        &General::readhasharray("$configsrvgrp", \%customservicegrp );
        &General::readhasharray("$configsrv", \%customservice );
        $errormessage=&checkservicegroup;
+       #Check if we have more than 13 services from one Protocol in the group
+       #iptables can only handle 13 ports/portranges via multiport
+       foreach my $key (keys %customservicegrp){
+               if($customservicegrp{$key}[0] eq $fwhostsettings{'SRVGRP_NAME'}){
+                       foreach my $key1 (keys %customservice){
+                               $tcpcounter++ if $customservice{$key1}[2] eq 'TCP' && $customservicegrp{$key}[2] eq $customservice{$key1}[0];
+                               $tcpcounter++ if $customservice{$key1}[2] eq 'TCP' && $customservicegrp{$key}[2] eq $customservice{$key1}[0] && $customservice{$key1}[1] =~m/:/i;
+                               $udpcounter++ if $customservice{$key1}[2] eq 'UDP' && $customservicegrp{$key}[2] eq $customservice{$key1}[0];
+                               $udpcounter++ if $customservice{$key1}[2] eq 'UDP' && $customservicegrp{$key}[2] eq $customservice{$key1}[0] && $customservice{$key1}[1] =~m/:/i;
+                       }
+               }
+       }
+       if ($tcpcounter > 15){
+               $errormessage=$Lang::tr{'fwhost err maxservicetcp'};
+       }
+       if ($udpcounter > 15){
+               $errormessage=$Lang::tr{'fwhost err maxserviceudp'};
+       }
+       $tcpcounter=0;
+       $udpcounter=0;
        #check remark
        if ($fwhostsettings{'SRVGRP_REMARK'} ne '' && !&validremark($fwhostsettings{'SRVGRP_REMARK'})){
-               $errormessage=$Lang::tr{'fwhost err remark'};
+               $errormessage .= $Lang::tr{'fwhost err remark'};
        }
        if (!$errormessage){
                #on first save, we have to enter a dummy value
@@ -796,7 +847,7 @@ if ($fwhostsettings{'ACTION'} eq 'saveservicegrp')
                $fwhostsettings{'updatesrvgrp'}='on';
        }
        if ($count gt 0){
-               &rules;
+               &General::firewall_config_changed();
        }
        &addservicegrp;
        &viewtableservicegrp;
@@ -911,7 +962,9 @@ if ($fwhostsettings{'ACTION'} eq 'deletegrphost')
                }
        }
        &General::writehasharray("$configgrp", \%customgrp);
-       if ($fwhostsettings{'grpcnt'} > 0){&rules;}
+       if ($fwhostsettings{'grpcnt'} > 0){
+               &General::firewall_config_changed();
+       }
        if ($fwhostsettings{'update'} eq 'on'){
                $fwhostsettings{'remark'}= $grpremark;
                $fwhostsettings{'grp_name'}=$grpname;
@@ -990,7 +1043,7 @@ if ($fwhostsettings{'ACTION'} eq 'delgrpservice')
                }
        }
        &General::writehasharray("$configsrvgrp", \%customservicegrp);
-       &rules;
+       &General::firewall_config_changed();
        if ($fwhostsettings{'updatesrvgrp'} eq 'on'){
                $fwhostsettings{'SRVGRP_NAME'}=$grpname;
                $fwhostsettings{'SRVGRP_REMARK'}=$grpremark;
@@ -1079,11 +1132,7 @@ if($fwhostsettings{'ACTION'} eq '')
        &showmenu;
 }
 ###  FUNCTIONS  ###
-sub showmenu
-{
-       if (-f "${General::swroot}/forward/reread"){
-               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;'>&nbsp &nbsp $Lang::tr{'fwhost reread'}</td></tr></table></form><br>";
-       }
+sub showmenu {
        &Header::openbox('100%', 'left',$Lang::tr{'fwhost menu'});
        print "$Lang::tr{'fwhost welcome'}";
        print<<END;
@@ -1278,11 +1327,12 @@ sub addservice
                $fwhostsettings{'oldsrvname'} = $fwhostsettings{'SRV_NAME'};
                $fwhostsettings{'oldsrvport'} = $fwhostsettings{'SRV_PORT'};
                $fwhostsettings{'oldsrvprot'} = $fwhostsettings{'PROT'};
+               $fwhostsettings{'oldsrvicmp'} = $fwhostsettings{'ICMP'};
        }
        print<<END;
        <table width='100%' border='0'><form method='post'>
        <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>
-       <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost prot'}:</td><td><select name='PROT'>
+       <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost prot'}:</td><td><select name='PROT' id='protocol' >
 END
        foreach ("TCP","UDP","ICMP")
        {
@@ -1294,19 +1344,22 @@ END
                }
        }
        print<<END;
-       </select></td></tr>
-       <tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost icmptype'}</td><td><select name='ICMP_TYPES'>
+       </select></td></tr></table>
+       <div id='PROTOKOLL' class='noscript'><table width=100%' border='0'><tr><td width='10%' nowrap='nowrap'>$Lang::tr{'fwhost icmptype'}</td><td><select name='ICMP_TYPES'>
 END
        &General::readhasharray("${General::swroot}/fwhosts/icmp-types", \%icmptypes);
-       print"<option>All ICMP-Types</option>";
+       print"<option value='All ICMP-Types'>$Lang::tr{'fwdfw all icmp'}</option>";
        foreach my $key (sort { ncmp($icmptypes{$a}[0],$icmptypes{$b}[0]) }keys %icmptypes){
-               print"<option>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
+               if ($icmptypes{$key}[0] eq $fwhostsettings{'oldsrvicmp'}){
+                       print"<option selected>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
+               }else{
+                       print"<option>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
+               }
        }
-       
        print<<END;
-       </select></td></tr>
-       <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>
-       <tr><td colspan='6'><br><hr></td></tr>
+       </select></td></tr></table></div>
+       <div id='PORT' class='noscript'><table width='100%' border='0'><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></table></div>
+       <table width='100%' border='0'><tr><td colspan='6'><br><hr></td></tr>
        <tr><td colspan='6' align='right'>
 END
        if ($fwhostsettings{'updatesrv'} eq 'on')
@@ -1316,17 +1369,16 @@ END
                <input type='hidden' name='ACTION' value='updateservice'>
                <input type='hidden' name='oldsrvname' value='$fwhostsettings{'oldsrvname'}'>
                <input type='hidden' name='oldsrvport' value='$fwhostsettings{'oldsrvport'}'>
-               <input type='hidden' name='oldsrvprot' value='$fwhostsettings{'oldsrvprot'}'></form>
+               <input type='hidden' name='oldsrvprot' value='$fwhostsettings{'oldsrvprot'}'>
+               <input type='hidden' name='oldsrvicmp' value='$fwhostsettings{'oldsrvicmp'}'>
+               </form>
 END
-               
-       }else{  
+       }else{
                print"<input type='submit' value='$Lang::tr{'save'}' style='min-width:100px;'><input type='hidden' name='ACTION' value='saveservice'></form>";
        }
        print<<END;
        <form style='display:inline;' method='post'><input type='submit' value='$Lang::tr{'fwhost back'}' style='min-width:100px;'></form></td></tr>
        </table></form>
-       
-       
 END
        &Header::closebox();
        &viewtableservice;
@@ -1429,11 +1481,61 @@ END
        }       
 
 }
+sub getcolor
+{
+               my $c=shift;
+               #Check if IP is part of OpenVPN N2N subnet
+               foreach my $key (sort keys %ccdhost){
+                       if ($ccdhost{$key}[3] eq 'net'){
+                               my ($a,$b) = split("/",$ccdhost{$key}[11]);
+                               if (&General::IpInSubnet($c,$a,$b)){
+                                       $tdcolor="style='color:$Header::colourovpn ;'";
+                                       return $tdcolor;
+                               }
+                       }
+               }
+               #Check if IP is part of OpenVPN dynamic subnet
+               my ($a,$b) = split("/",$ovpnsettings{'DOVPN_SUBNET'});
+               if (&General::IpInSubnet($c,$a,$b)){
+                       $tdcolor="style='color: $Header::colourovpn;'";
+                       return $tdcolor;
+               }
+               #Check if IP is part of OpenVPN static subnet
+               foreach my $key (sort keys %ccdnet){
+                       my ($a,$b) = split("/",$ccdnet{$key}[1]);
+                       $b =&General::iporsubtodec($b);
+                       if (&General::IpInSubnet($c,$a,$b)){
+                               $tdcolor="style='color: $Header::colourovpn;'";
+                               return $tdcolor;
+                       }
+               }
+               #Check if IP is part of IPsec RW network
+               if ($ipsecsettings{'RW_NET'} ne ''){
+                       my ($a,$b) = split("/",$ipsecsettings{'RW_NET'});
+                       $b=&General::iporsubtodec($b);
+                       if (&General::IpInSubnet($c,$a,$b)){
+                               $tdcolor="style='color: $Header::colourvpn;'";
+                               return $tdcolor;
+                       }
+               }
+               #Check if IP is part of a IPsec N2N network
+               foreach my $key (sort keys %ipsecconf){
+                       my ($a,$b) = split("/",$ipsecconf{$key}[11]);
+                       if (&General::IpInSubnet($c,$a,$b)){
+                               $tdcolor="style='color: $Header::colourvpn;'";
+                               return $tdcolor;
+                       }
+               }
+               $tdcolor='';
+               return $tdcolor;
+}
 sub viewtablehost
 {
        if (! -z $confighost){
                &Header::openbox('100%', 'left', $Lang::tr{'fwhost cust addr'});
                &General::readhasharray("$confighost", \%customhost);
+               &General::readhasharray("$configccdnet", \%ccdnet);
+               &General::readhasharray("$configccdhost", \%ccdhost);
                if (!keys %customhost) 
                { 
                        print "<center><b>$Lang::tr{'fwhost empty'}</b>"; 
@@ -1451,7 +1553,7 @@ END
                        else{            print" <tr bgcolor='$color{'color20'}'>";}
                        my ($ip,$sub)=split(/\//,$customhost{$key}[2]);
                        $customhost{$key}[4]=~s/\s+//g;
-                       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>";
+                       print"<td width='20%'>$customhost{$key}[0]</td><td width='20%' align='center' ".&getcolor($ip).">".&Header::colorize($ip)."</td><td width='50%' align='left'>$customhost{$key}[3]</td><td align='center'>$customhost{$key}[4]x</td>";
                        print<<END;
                        <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='edithost' />
@@ -1494,7 +1596,7 @@ sub viewtablegrp
        { 
                print "<center><b>$Lang::tr{'fwhost err emptytable'}</b>";
        }else{
-               foreach my $key (sort { ncmp($customgrp{$a}[0],$customgrp{$b}[0]) } sort { ncmp ($customgrp{$a}[2],$customgrp{$b}[2]) } keys %customgrp){
+               foreach my $key (sort { ncmp($customgrp{$a}[0],$customgrp{$b}[0]) } sort { ncmp($customgrp{$a}[2],$customgrp{$b}[2]) } keys %customgrp){
                        $count++;
                        if ($helper ne $customgrp{$key}[0]){
                                $delflag='0';
@@ -1511,7 +1613,7 @@ sub viewtablegrp
                                if ($customgrp{$key}[2] eq "none"){$customgrp{$key}[2]=$Lang::tr{'fwhost err emptytable'};}
                                $grpname=$customgrp{$key}[0];
                                $remark="$customgrp{$key}[1]";
-                               if($count gt 2){ print"</table>";}
+                               if($count gt 1){ print"</table>";}
                                print "<br><b><u>$grpname</u></b>&nbsp; &nbsp;";
                                print " <b>$Lang::tr{'remark'}:</b>&nbsp $remark &nbsp " if ($remark ne '');
                                print "<b>$Lang::tr{'used'}:</b> $customgrp{$key}[4]x";
@@ -1543,7 +1645,7 @@ sub viewtablegrp
                        }else{
                                my ($colip,$colsub) = split("/",$ip);
                                $ip="$colip/".&General::subtocidr($colsub) if ($colsub);
-                               print"<td align='center'>".&Header::colorize($ip)."</td><td align='center'>$customgrp{$key}[3]</td><td width='1%'><form method='post'>";
+                               print"<td align='center' ".&getcolor($colip).">".&Header::colorize($ip)."</td><td align='center'>$customgrp{$key}[3]</td><td width='1%'><form method='post'>";
                        }
                        if ($delflag > '1' && $ip ne ''){
                                print"<input type='image' src='/images/delete.gif' align='middle' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} />";
@@ -1554,7 +1656,6 @@ sub viewtablegrp
                        $number++;
                }
                print"</table>";
-               
        }
        &Header::closebox();
 }
@@ -1580,14 +1681,15 @@ END
                        print<<END;
                        <td>$customservice{$key}[0]</td><td align='center'>$customservice{$key}[2]</td><td align='center'>$customservice{$key}[1]</td><td align='center'>
 END
-                       if($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
-               
+                       if($customservice{$key}[3] eq 'All ICMP-Types'){print $Lang::tr{'fwdfw all icmp'};}
+                       elsif($customservice{$key}[3] ne 'BLANK'){print $customservice{$key}[3];}
                        print<<END;
                        </td><td align='center'>$customservice{$key}[4]x</td>
                        <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' />
                        <input type='hidden' name='SRV_NAME' value='$customservice{$key}[0]' />
                        <input type='hidden' name='SRV_PORT' value='$customservice{$key}[1]' />
-                       <input type='hidden' name='PROT' value='$customservice{$key}[2]' /></form></td>
+                       <input type='hidden' name='PROT' value='$customservice{$key}[2]' />
+                       <input type='hidden' name='ICMP' value='$customservice{$key}[3]' /></form></td>
 END
                        if ($customservice{$key}[4] eq '0')
                        {
@@ -1661,7 +1763,7 @@ sub viewtableservicegrp
                                }
                        }
                        print"<td align='center'>$port</td><td align='center'>$protocol</td><td width='1%'><form method='post'>";
-                       if ($number gt '1'){
+                       if ($delflag gt '1'){
                                print"<input type='image' src='/images/delete.gif' align='middle' alt=$Lang::tr{'delete'} title=$Lang::tr{'delete'} />";
                        }
                        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>";
@@ -1778,6 +1880,7 @@ sub get_name
                return "$network" if ($val eq $defaultNetworks{$network}{'NAME'});
        }       
 }
+
 sub deletefromgrp
 {
        my $target=shift;
@@ -1993,24 +2096,8 @@ sub getipforgroup
                }
        }
 }
-sub rules
-{
-       if (!-f "${General::swroot}/fwhosts/reread"){
-               system("touch ${General::swroot}/fwhosts/reread");
-               system("touch ${General::swroot}/forward/reread");
-       }
-}
-sub reread_rules
-{
-       system ("/usr/local/bin/forwardfwctrl");
-       if ( -f "${General::swroot}/fwhosts/reread"){
-               system("rm ${General::swroot}/fwhosts/reread");
-               system("rm ${General::swroot}/forward/reread");
-       }
-       
-}
-sub decrease
-{
+
+sub decrease {
        my $grp=$_[0];
        &General::readhasharray("$confignet", \%customnetwork);
        &General::readhasharray("$confighost", \%customhost);