aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort/snort_check_for_rule_updates.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-07-09 12:57:00 -0400
committerjim-p <jimp@pfsense.org>2012-07-09 12:57:00 -0400
commit958efd439784459a5848fb05afe1560c4db285d7 (patch)
tree1e836cb827156bba4cc12ad37fc21294f138e7f8 /config/snort/snort_check_for_rule_updates.php
parent4e8dd82f957006899f1babb2e521b8fd3cdcd2ce (diff)
downloadpfsense-packages-958efd439784459a5848fb05afe1560c4db285d7.tar.gz
pfsense-packages-958efd439784459a5848fb05afe1560c4db285d7.tar.bz2
pfsense-packages-958efd439784459a5848fb05afe1560c4db285d7.zip
globals for these do not work properly at bootup. Might be causing unintended overwrites/deletions. Revert "s//usr/local/etc/snort/snortdir/ to unify its reference and location. Trim some unused functions in the way"
This reverts commit 40cace16a452cd841a6b3626c44ff0d0b655956f.
Diffstat (limited to 'config/snort/snort_check_for_rule_updates.php')
-rw-r--r--config/snort/snort_check_for_rule_updates.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/config/snort/snort_check_for_rule_updates.php b/config/snort/snort_check_for_rule_updates.php
index 00a93ad5..b8d86ff8 100644
--- a/config/snort/snort_check_for_rule_updates.php
+++ b/config/snort/snort_check_for_rule_updates.php
@@ -32,12 +32,13 @@ require_once("functions.inc");
require_once("service-utils.inc");
require_once("/usr/local/pkg/snort/snort.inc");
-global $snort_gui_include, $snortdir;
+global $snort_gui_include;
if (!isset($snort_gui_include))
$pkg_interface = "console";
-$tmpfname = "{$snortdir}/tmp/snort_rules_up";
+$tmpfname = "/usr/local/etc/snort/tmp/snort_rules_up";
+$snortdir = "/usr/local/etc/snort";
$snort_filename_md5 = "{$snort_rules_file}.md5";
$snort_filename = "{$snort_rules_file}";
$emergingthreats_filename_md5 = "emerging.rules.tar.gz.md5";
@@ -51,8 +52,8 @@ $emergingthreats = $config['installedpackages']['snortglobal']['emergingthreats'
/* Start of code */
conf_mount_rw();
-if (!is_dir($tmpfname))
- exec("/bin/mkdir -p {$tmpfname}");
+if (!is_dir('/usr/local/etc/snort/tmp'))
+ exec('/bin/mkdir -p /usr/local/etc/snort/tmp');
/* Set user agent to Mozilla */
ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)');
@@ -158,7 +159,7 @@ if ($snortdownload == 'on') {
/* extract snort.org rules and add prefix to all snort.org files*/
exec("/bin/rm -r {$snortdir}/rules/*");
exec("/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C {$snortdir} rules/");
- chdir ("{$snortdir}/rules");
+ chdir ("/usr/local/etc/snort/rules");
exec('/usr/local/bin/perl /usr/local/bin/snort_rename.pl s/^/snort_/ *.rules');
/* extract so rules */
@@ -240,15 +241,15 @@ if ($snortdownload == 'on') {
/* XXX: Convert this to sed? */
/* make shure default rules are in the right format */
- exec("/usr/local/bin/perl -pi -e 's/#alert/# alert/g' {$snortdir}/rules/*.rules");
- exec("/usr/local/bin/perl -pi -e 's/##alert/# alert/g' {$snortdir}/rules/*.rules");
- exec("/usr/local/bin/perl -pi -e 's/## alert/# alert/g' {$snortdir}/rules/*.rules");
+ exec("/usr/local/bin/perl -pi -e 's/#alert/# alert/g' /usr/local/etc/snort/rules/*.rules");
+ exec("/usr/local/bin/perl -pi -e 's/##alert/# alert/g' /usr/local/etc/snort/rules/*.rules");
+ exec("/usr/local/bin/perl -pi -e 's/## alert/# alert/g' /usr/local/etc/snort/rules/*.rules");
/* create a msg-map for snort */
update_status(gettext("Updating Alert Messages..."));
exec("/usr/local/bin/perl /usr/local/bin/create-sidmap.pl {$snortdir}/rules > {$snortdir}/sid-msg.map");
- if (file_exists("{$tmpfname}/{$snort_filename_md5}")) {
+ if (file_exists("{$tmpfname}/$snort_filename_md5")) {
update_status(gettext("Copying md5 sig to snort directory..."));
exec("/bin/cp {$tmpfname}/$snort_filename_md5 {$snortdir}/$snort_filename_md5");
}
@@ -313,7 +314,7 @@ path = /bin:/usr/bin:/usr/local/bin
update_files = \.rules$|\.config$|\.conf$|\.txt$|\.map$
-url = dir://{$snortdir}/rules
+url = dir:///usr/local/etc/snort/rules
{$selected_sid_on_sections}