Skip to content

Commit

Permalink
Improve generation of snort configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Oct 9, 2013
1 parent 21fd18d commit 02160ba
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/pf/services/snort.pm
Expand Up @@ -56,10 +56,14 @@ sub generate_snort_conf {

if (exists $Violation_Config{'defaults'}{'snort_rules'}) {
foreach my $rule ( split( /\s*,\s*/, $Violation_Config{'defaults'}{'snort_rules'} ) ) {

#append install_dir if the path doesn't start with /
$rule = "\$RULE_PATH/$rule" if ( $rule !~ /^\// );
push @rules, "include $rule";
if ( $rule !~ /^\// && -e "$install_dir/conf/snort/$rule" || -e $rule ) {
# Append configuration directory if the path doesn't start with /
$rule = "\$RULE_PATH/$rule" if ( $rule !~ /^\// );
push @rules, "include $rule";
}
else {
$logger->warn("Snort rules definition file $rule was not found.");
}
}
}
$tags{'snort_rules'} = join( "\n", @rules );
Expand Down

0 comments on commit 02160ba

Please sign in to comment.