&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;
# 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
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') {
}
# Create rule file link, vars array, and display flag
- my $rulefilelink = "?RULEFILE=$rulefile";
+ my $rulefilelink = "?RULEFILE=$rulefile";
my $rulefiletoclose = '';
my @queryvars = ();
my $displayrulefilerules = 0;
# 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') {
}
}
}
-
# Strip out extra & & ? from rulefilelink
$rulefilelink =~ s/^\?\&/\?/i;
print "</TD></TR></TABLE></TD></TR></TABLE>";
print <<END
-<table width='100%'>
-<tr>
+ <table width='100%'>
+ <tr>
<td width='33%'> </td>
<td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'update'}' /></td>
<td width='33%'>
<!-- 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();