From 63151a3f2241f14677df474bc61d9b51469d84ea Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Thu, 13 Aug 2015 19:15:29 -0400 Subject: Remove unneeded duplicate code to simplify things. --- config/snort/snort.inc | 5 ----- config/snort/snort_check_for_rule_updates.php | 17 ++++++----------- config/snort/snort_defs.inc | 3 +-- 3 files changed, 7 insertions(+), 18 deletions(-) (limited to 'config/snort') diff --git a/config/snort/snort.inc b/config/snort/snort.inc index 62002b24..fb8cd9d8 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -45,11 +45,6 @@ ini_set("memory_limit", "384M"); // Explicitly declare this as global so it works through function call includes global $g, $config, $rebuild_rules; -// Grab the Snort binary version programmatically, but if that fails use a safe default -$snortver = array(); -$snortbindir = SNORT_PBI_BINDIR; -exec("{$snortbindir}snort -V 2>&1 |/usr/bin/grep Version | /usr/bin/cut -c20-26", $snortver); - /* Rebuild Rules Flag -- if "true", rebuild enforcing rules and flowbit-rules files */ $rebuild_rules = false; diff --git a/config/snort/snort_check_for_rule_updates.php b/config/snort/snort_check_for_rule_updates.php index 0c4543cd..123661e4 100755 --- a/config/snort/snort_check_for_rule_updates.php +++ b/config/snort/snort_check_for_rule_updates.php @@ -64,19 +64,14 @@ $openappid_detectors = $config['installedpackages']['snortglobal']['openappid_de /* Working directory for downloaded rules tarballs and extraction */ $tmpfname = "{$g['tmp_path']}/snort_rules_up"; -/* Grab the Snort binary version programmatically and use it to construct */ -/* the proper Snort VRT rules tarball and md5 filenames. Fallback to a */ -/* default in the event we fail. */ -$snortver = array(); -exec("{$snortbindir}snort -V 2>&1 |/usr/bin/grep Version | /usr/bin/cut -c20-26", $snortver); -// Save the version with decimal delimiters for use in extracting the rules -$snort_version = $snortver[0]; -if (empty($snort_version)) - $snort_version = SNORT_BIN_VERSION; +/* Use the Snort binary version to construct the proper Snort VRT */ +/* rules tarball and md5 filenames. Save the version with decimal */ +/* delimiters for use in extracting the rules. */ +$snort_version = SNORT_BIN_VERSION; // Create a collapsed version string for use in the tarball filename -$snortver[0] = str_replace(".", "", $snortver[0]); -$snort_filename = "snortrules-snapshot-{$snortver[0]}.tar.gz"; +$snortver = str_replace(".", "", SNORT_BIN_VERSION); +$snort_filename = "snortrules-snapshot-{$snortver}.tar.gz"; $snort_filename_md5 = "{$snort_filename}.md5"; $snort_rule_url = VRT_DNLD_URL; diff --git a/config/snort/snort_defs.inc b/config/snort/snort_defs.inc index aa2d640d..ac09db44 100644 --- a/config/snort/snort_defs.inc +++ b/config/snort/snort_defs.inc @@ -49,13 +49,12 @@ if (!defined("SNORTLOGDIR")) define("SNORTLOGDIR", "{$g['varlog_path']}/snort"); if (!defined("SNORT_BIN_VERSION")) { // Grab the Snort binary version programmatically - $snortver = array(); $snortbindir = SNORT_PBI_BINDIR; $snortver = exec_command("{$snortbindir}/snort -V 2>&1 |/usr/bin/grep Version | /usr/bin/cut -c20-26"); if (!empty($snortver)) define("SNORT_BIN_VERSION", $snortver); else - define("SNORT_BIN_VERSION", ""); + define("SNORT_BIN_VERSION", "2.9.7.5"); } if (!defined("SNORT_SID_MODS_PATH")) define('SNORT_SID_MODS_PATH', "{$g['vardb_path']}/snort/sidmods/"); -- cgit v1.2.3