From 0506fcd915a0a174eadf77c822135fdc4c7d168d Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Wed, 30 Apr 2014 14:46:08 -0400 Subject: Fix multiple cron jobs bug when updating rm_blocked interval. --- config/snort/snort.inc | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/config/snort/snort.inc b/config/snort/snort.inc index f4fd93b9..677b387e 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -54,7 +54,7 @@ if (empty($snort_version)) $snort_version = "2.9.6.0"; /* Used to indicate latest version of this include file has been loaded */ -$pfSense_snort_version = "3.0.7"; +$pfSense_snort_version = "3.0.8"; /* get installed package version for display */ $snort_package_version = "Snort {$config['installedpackages']['package'][get_pkg_id("snort")]['version']}"; @@ -755,8 +755,24 @@ function snort_rm_blocked_install_cron($should_install) { $snort_rm_blocked_expire = "2419200"; } - $command = "/usr/bin/nice -n20 /usr/local/sbin/expiretable -t $snort_rm_blocked_expire snort2c"; - install_cron_job($command, $should_install, $snort_rm_blocked_min, $snort_rm_blocked_hr, $snort_rm_blocked_mday, $snort_rm_blocked_month, $snort_rm_blocked_wday, "root"); + // First remove any existing "expiretable" jobs for Snort. We + // have to remove them because otherwise install_cron_job() will + // think we are installing a different job if the 'expire seconds' + // parameter differs from the old one when we call the function. + $result = array(); + $result = preg_grep('/expiretable\b\s*-t\s*(\d+)\s*snort2c\b/i', file('/etc/crontab')); + if (count($result) > 0) { + foreach($result as $job) { + install_cron_job(trim(substr($job, strpos($job, "/usr/bin/nice"))), FALSE); + } + } + + // Now either install the new or updated cron job, + // or return if "rm_blocked" is disabled + if ($should_install) { + $command = "/usr/bin/nice -n20 /usr/local/sbin/expiretable -t $snort_rm_blocked_expire snort2c"; + install_cron_job($command, $should_install, $snort_rm_blocked_min, $snort_rm_blocked_hr, $snort_rm_blocked_mday, $snort_rm_blocked_month, $snort_rm_blocked_wday, "root"); + } } /* func to install snort update */ -- cgit v1.2.3 From 9a903edc41c8caebfae64243f809633ef070b223 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Wed, 30 Apr 2014 15:26:43 -0400 Subject: Better fix for preventing multiple rm_blocked cron entries. --- config/snort/snort.inc | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/config/snort/snort.inc b/config/snort/snort.inc index 677b387e..c0c5756c 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -755,17 +755,8 @@ function snort_rm_blocked_install_cron($should_install) { $snort_rm_blocked_expire = "2419200"; } - // First remove any existing "expiretable" jobs for Snort. We - // have to remove them because otherwise install_cron_job() will - // think we are installing a different job if the 'expire seconds' - // parameter differs from the old one when we call the function. - $result = array(); - $result = preg_grep('/expiretable\b\s*-t\s*(\d+)\s*snort2c\b/i', file('/etc/crontab')); - if (count($result) > 0) { - foreach($result as $job) { - install_cron_job(trim(substr($job, strpos($job, "/usr/bin/nice"))), FALSE); - } - } + // First remove any existing "expiretable" jobs for Snort. + install_cron_job("snort2c", false); // Now either install the new or updated cron job, // or return if "rm_blocked" is disabled -- cgit v1.2.3 From c2e089749a4abc6dbdd4d5eb4fb23d47cbc42fda Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Wed, 30 Apr 2014 15:42:08 -0400 Subject: Bump Snort package version to 3.0.8 for bug fix. --- config/snort/snort.xml | 4 ++-- config/snort/snort_migrate_config.php | 2 +- config/snort/snort_post_install.php | 2 +- pkg_config.10.xml | 2 +- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/snort/snort.xml b/config/snort/snort.xml index 9d52aa6c..ca99accf 100755 --- a/config/snort/snort.xml +++ b/config/snort/snort.xml @@ -47,7 +47,7 @@ Currently there are no FAQ items provided. Snort 2.9.6.0 - Services:2.9.6.0 pkg v3.0.7 + Services:2.9.6.0 pkg v3.0.8 /usr/local/pkg/snort/snort.inc Snort @@ -269,7 +269,7 @@ diff --git a/config/snort/snort_migrate_config.php b/config/snort/snort_migrate_config.php index b3152d5d..d483ba47 100644 --- a/config/snort/snort_migrate_config.php +++ b/config/snort/snort_migrate_config.php @@ -365,7 +365,7 @@ unset($r); // Write out the new configuration to disk if we changed anything if ($updated_cfg) { - $config['installedpackages']['snortglobal']['snort_config_ver'] = "3.0.7"; + $config['installedpackages']['snortglobal']['snort_config_ver'] = "3.0.8"; log_error("[Snort] Saving configuration settings in new format..."); write_config("Snort pkg: migrate existing settings to new format as part of package upgrade."); log_error("[Snort] Settings successfully migrated to new configuration format..."); diff --git a/config/snort/snort_post_install.php b/config/snort/snort_post_install.php index dbac41ef..8d3c427d 100644 --- a/config/snort/snort_post_install.php +++ b/config/snort/snort_post_install.php @@ -1494,7 +1494,7 @@ if (stristr($config['widgets']['sequence'], "snort_alerts-container") === FALSE) $config['widgets']['sequence'] .= ",{$snort_widget_container}"; /* Update Snort package version in configuration */ -$config['installedpackages']['snortglobal']['snort_config_ver'] = "3.0.7"; +$config['installedpackages']['snortglobal']['snort_config_ver'] = "3.0.8"; write_config("Snort pkg: post-install configuration saved."); /* Done with post-install, so clear flag */ diff --git a/pkg_config.10.xml b/pkg_config.10.xml index b458e02e..ebcd54b7 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -371,7 +371,7 @@ barnyard2_UNSET=ODBC PGSQL PRELUDE;barnyard2_SET=GRE IPV6 MPLS MYSQL PORT_PCAP;snort_SET=TARGETBASED PERFPROFILE SOURCEFIRE FLEXRESP3 GRE IPV6 MPLS NORMALIZER ZLIB;snort_UNSET=PULLEDPORK;perl_SET=THREADS;NOPORTDOCS=true https://packages.pfsense.org/packages/config/snort/snort.xml - 2.9.6.0 pkg v3.0.7 + 2.9.6.0 pkg v3.0.8 2.2 Stable /snort.xml diff --git a/pkg_config.8.xml b/pkg_config.8.xml index b0aa5de8..9d5fe488 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -525,7 +525,7 @@ barnyard2_UNSET=ODBC PGSQL PRELUDE;barnyard2_SET=GRE IPV6 MPLS MYSQL PORT_PCAP BRO;snort_SET=TARGETBASED PERFPROFILE SOURCEFIRE FLEXRESP3 GRE IPV6 MPLS NORMALIZER ZLIB;snort_UNSET=PULLEDPORK;perl_SET=THREADS;NOPORTDOCS=true https://packages.pfsense.org/packages/config/snort/snort.xml - 2.9.6.0 pkg v3.0.7 + 2.9.6.0 pkg v3.0.8 2.0 Stable /snort.xml diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index a1d67317..21b15cc8 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -512,7 +512,7 @@ barnyard2_UNSET=ODBC PGSQL PRELUDE;barnyard2_SET=GRE IPV6 MPLS MYSQL PORT_PCAP;snort_SET=TARGETBASED PERFPROFILE SOURCEFIRE FLEXRESP3 GRE IPV6 MPLS NORMALIZER ZLIB;snort_UNSET=PULLEDPORK;perl_SET=THREADS;NOPORTDOCS=true https://packages.pfsense.org/packages/config/snort/snort.xml - 2.9.6.0 pkg v3.0.7 + 2.9.6.0 pkg v3.0.8 2.0 Stable /snort.xml -- cgit v1.2.3