diff options
author | Ermal <eri@pfsense.org> | 2012-07-22 14:30:38 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2012-07-22 14:30:38 +0000 |
commit | b5787668a4dbf9f22ffeb4a2ab9b39fec2a9184b (patch) | |
tree | efc0755f92449e6305be5cc1b04eeb1213dd3002 /config/snort/snort_check_for_rule_updates.php | |
parent | 43a1843df119d61e23a2026f3f7723461c83b043 (diff) | |
download | pfsense-packages-b5787668a4dbf9f22ffeb4a2ab9b39fec2a9184b.tar.gz pfsense-packages-b5787668a4dbf9f22ffeb4a2ab9b39fec2a9184b.tar.bz2 pfsense-packages-b5787668a4dbf9f22ffeb4a2ab9b39fec2a9184b.zip |
Keep a copy of the so rules for each instance to enable only selected ones
Diffstat (limited to 'config/snort/snort_check_for_rule_updates.php')
-rw-r--r-- | config/snort/snort_check_for_rule_updates.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/config/snort/snort_check_for_rule_updates.php b/config/snort/snort_check_for_rule_updates.php index 112682d2..6221b38f 100644 --- a/config/snort/snort_check_for_rule_updates.php +++ b/config/snort/snort_check_for_rule_updates.php @@ -301,9 +301,16 @@ function snort_apply_customizations($snortcfg, $if_real) { else { update_status(gettext("Your set of configured rules are being copied...")); log_error(gettext("Your set of configured rules are being copied...")); - $files = explode("||", $snortcfg['rulesets']); - foreach ($files as $file) - @copy("{$snortdir}/rules/{$file}", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/rules/{$file}"); + $enabled_rulesets_array = explode("||", $snortcfg['rulesets']); + foreach($enabled_rulesets_array as $enabled_item) { + @copy("{$snortdir}/rules/{$file}", "{$rule_dir}/rules/{$file}"); + if (substr($enabled_item, 0, 5) == "snort" && substr($enabled_item, -9) == ".so.rules") { + $slib = substr($enabled_item, 6, -6); + if (file_exists("/usr/local/lib/snort/dynamicrules/{$slib}")) + @copy("/usr/local/lib/snort/dynamicrules/{$slib}", "{$snort_dirs['dynamicrules']}/{$slib}"); + + } + } @copy("{$snortdir}/classification.config", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/classification.config"); @copy("{$snortdir}/gen-msg.map", "{$snortdir}/snort_{$snortcfg['uuid']}_{$if_real}/gen-msg.map"); |