diff options
author | bmeeks8 <bmeeks8@bellsouth.net> | 2013-02-01 08:32:58 -0500 |
---|---|---|
committer | bmeeks8 <bmeeks8@bellsouth.net> | 2013-02-01 08:32:58 -0500 |
commit | c84ef2aac594ebe04e2f8eabf1b3407bb4c79d2e (patch) | |
tree | 104d31fc28e6f338ac89105bc2f767416f03447d /config/snort/snort.inc | |
parent | 459737cee3b9e740b0a7a18433daac2280119362 (diff) | |
download | pfsense-packages-c84ef2aac594ebe04e2f8eabf1b3407bb4c79d2e.tar.gz pfsense-packages-c84ef2aac594ebe04e2f8eabf1b3407bb4c79d2e.tar.bz2 pfsense-packages-c84ef2aac594ebe04e2f8eabf1b3407bb4c79d2e.zip |
Make sure we update ['disabled'] flag in rule map when
commenting/un-commenting rule.
Diffstat (limited to 'config/snort/snort.inc')
-rwxr-xr-x | config/snort/snort.inc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/config/snort/snort.inc b/config/snort/snort.inc index 24242bcd..17c3a19a 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -1197,9 +1197,11 @@ function snort_find_flowbit_required_rules(&$all_rules, &$unchecked_flowbits) { if ($rule2['disabled'] == 0) /* If not disabled, just return the rule text "as is" */ $required_flowbits_rules[$k1][$k2]['rule'] = ltrim($rule2['rule']); - else + else { /* If rule is disabled, remove leading '#' to enable it */ $required_flowbits_rules[$k1][$k2]['rule'] = ltrim(substr($rule2['rule'], strpos($rule2['rule'], "#") + 1)); + $required_flowbits_rules[$k1][$k2]['disabled'] = 1; + } } } } @@ -1335,8 +1337,10 @@ function snort_load_vrt_policy($policy) { $vrt_policy_rules[$k1][$k2] = $arulem2; /* Enable the policy rule if disabled */ - if ($arulem2['disabled'] == 1) + if ($arulem2['disabled'] == 1) { $vrt_policy_rules[$k1][$k2]['rule'] = ltrim(substr($arulem2['rule'], strpos($arulem2['rule'], "#") + 1)); + $vrt_policy_rules[$k1][$k2]['disabled'] = 0; + } } } } @@ -1441,8 +1445,10 @@ function snort_modify_sids(&$rule_map, $snortcfg) { if (!empty($enablesid)) { foreach ($rule_map as $k1 => $rulem) { foreach ($rulem as $k2 => $v) { - if (in_array($k2, $enablesid) && $v['disabled'] == 1) + if (in_array($k2, $enablesid) && $v['disabled'] == 1) { $rule_map[$k1][$k2]['rule'] = ltrim($v['rule'], " \t#"); + $rule_map[$k1][$k2]['disabled'] = 0; + } } } } @@ -1806,7 +1812,7 @@ function snort_filter_preproc_rules($snortcfg, &$active_rules) { /* This function checks the $active_rules array */ /* for rule options dependent upon preprocessors. */ /* Rules with rule options dependent upon any */ - /* non-enabled preprocessors are disabled to */ + /* non-enabled preprocessors are disabled to stop */ /* start-up errors from unknown rule options. */ /* */ /* $snortcfg -> config parameters array for */ @@ -1849,6 +1855,8 @@ function snort_filter_preproc_rules($snortcfg, &$active_rules) { ***************************************************/ foreach ($active_rules as $k1 => $rulem) { foreach ($rulem as $k2 => $v) { + if ($v['disabled'] == 0) + continue; foreach ($rule_opts_preprocs as $opt => $preproc) { $pcre = "/\s*\b" . $opt . "/i"; if (($snortcfg[$preproc] != 'on') && preg_match($pcre, $v['rule'])) { |