]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/ids.cgi
IDS Rules wieder aktiviert
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / ids.cgi
index 59148884512286674965fadbc3a71c8170358a43..16a94451181c92967ba3efaba0d7dade4bf01b9d 100644 (file)
@@ -52,7 +52,7 @@ $snortsettings{'INSTALLMD5'} = '';
 &Header::getcgihash(\%snortsettings, {'wantfile' => 1, 'filevar' => 'FH'});
 
 ####################### Added for snort rules control #################################
-my $snortrulepath;
+my $snortrulepath; # change to "/etc/snort/rules" - maniac
 my @snortconfig;
 my $restartsnortrequired = 0;
 my %snortrules;
@@ -75,9 +75,14 @@ if (-e "/etc/snort/snort.conf") {
 
        # Loop over each line
        foreach my $line (@snortconfig) {
-               # Trim the line
+       # Trim the line
                chomp $line;
 
+ #   my @rules = `ls $snortrulepath`;     With this loop the rule might be display with correct rulepath set
+ #     foreach my $line (@rules) {
+ #     # Trim the line
+ #             chomp $line;
+
                # Check for a line with .rules
                if ($line =~ /\.rules$/) {
                        # Parse out rule file name
@@ -466,10 +471,10 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
                        my $rulechecked = '';
 
                        # Check if reached half-way through rule file rules to start new column
-                       if ($ruledisplaycnt > $rulecnt) {
+               if ($ruledisplaycnt > $rulecnt) {
                                print "</TABLE></TD><TD VALIGN='TOP'><TABLE>";
                                $ruledisplaycnt = 0;
-                       }
+               }
 
                        # Check if rule file is enabled
                        if ($snortrules{$rulefile}{"State"} eq 'Enabled') {
@@ -477,7 +482,7 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
                        }
 
                        # Create rule file link, vars array, and display flag
-                       my $rulefilelink = "?RULEFILE=$rulefile";
+               my $rulefilelink = "?RULEFILE=$rulefile";
                        my $rulefiletoclose = '';
                        my @queryvars = ();
                        my $displayrulefilerules = 0;
@@ -485,12 +490,12 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
                        # Check for passed in query string
                        if ($ENV{'QUERY_STRING'}) {
                                # Split out vars
-                               @queryvars = split(/\&/, $ENV{'QUERY_STRING'});
+                       @queryvars = split(/\&/, $ENV{'QUERY_STRING'});
 
                                # Loop over values
                                foreach $value (@queryvars) {
                                        # Split out var pairs
-                                       ($var, $linkedrulefile) = split(/=/, $value);
+                               ($var, $linkedrulefile) = split(/=/, $value);
 
                                        # Check if var is 'RULEFILE'
                                        if ($var eq 'RULEFILE') {
@@ -508,7 +513,6 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
                                        }
                                }
                        }
-
                        # Strip out extra & & ? from rulefilelink
                        $rulefilelink =~ s/^\?\&/\?/i;
 
@@ -583,20 +587,21 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
 
        print "</TD></TR></TABLE></TD></TR></TABLE>";
        print <<END
-<table width='100%'>
-<tr>
+  <table width='100%'>
+  <tr>
        <td width='33%'>&nbsp;</td>
        <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'update'}' /></td>
        <td width='33%'>
                &nbsp; <!-- space for future online help link -->
        </td>
-</tr>
-</table>
-</form>
+  </tr>
+  </table>
+  </form>
 END
 ;
        &Header::closebox();
 }
+
 #######################  End added for snort rules control  #################################
 &Header::closebigbox();
 &Header::closepage();