aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rwxr-xr-xconfig/snort/snort.inc13
-rw-r--r--config/snort/snort_post_install.php21
2 files changed, 31 insertions, 3 deletions
diff --git a/config/snort/snort.inc b/config/snort/snort.inc
index bec163d7..16574e77 100755
--- a/config/snort/snort.inc
+++ b/config/snort/snort.inc
@@ -814,7 +814,9 @@ function snort_snortloglimit_install_cron($should_install=TRUE) {
if ($should_install && snort_cron_job_exists("/usr/local/pkg/snort/snort_check_cron_misc.inc", TRUE, "*/5"))
return;
- // Else install the new or updated cron job
+ // Else install the new or updated cron job by removing the
+ // existing job first, then installing the new or updated job.
+ install_cron_job("snort_check_cron_misc.inc", false);
install_cron_job("/usr/bin/nice -n20 /usr/local/bin/php -f /usr/local/pkg/snort/snort_check_cron_misc.inc", $should_install, "*/5");
}
@@ -921,7 +923,9 @@ function snort_rm_blocked_install_cron($should_install) {
// Else install the new or updated cron job
if ($should_install) {
- 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");
+ // Remove the existing job first, then install the new or updated job
+ install_cron_job("snort2c", false);
+ install_cron_job($command, true, $snort_rm_blocked_min, $snort_rm_blocked_hr, $snort_rm_blocked_mday, $snort_rm_blocked_month, $snort_rm_blocked_wday, "root");
}
}
@@ -1009,8 +1013,11 @@ function snort_rules_up_install_cron($should_install) {
return;
// Else install the new or updated cron job
- if ($should_install)
+ if ($should_install) {
+ // Remove the existing job first, then install the new or updated job
+ install_cron_job("snort_check_for_rule_updates.php", false);
install_cron_job($command, $should_install, $snort_rules_up_min, $snort_rules_up_hr, $snort_rules_up_mday, $snort_rules_up_month, $snort_rules_up_wday, "root");
+ }
}
/* Only run when all ifaces needed to sync. Expects filesystem rw */
diff --git a/config/snort/snort_post_install.php b/config/snort/snort_post_install.php
index 57e92ce5..bbe7e3e2 100644
--- a/config/snort/snort_post_install.php
+++ b/config/snort/snort_post_install.php
@@ -115,6 +115,27 @@ if ($pkgid >= 0) {
/* Define a default Dashboard Widget Container for Snort */
$snort_widget_container = "snort_alerts-container:col2:close";
+/*********************************************************/
+/* START OF BUG FIX CODE */
+/* */
+/* Remove any Snort cron tasks that may have been left */
+/* from a previous uninstall due to a bug that saved */
+/* edited cron tasks as new ones while still leaving */
+/* the original task. Correct cron task entries will */
+/* be recreated below if saved settings are detected. */
+/*********************************************************/
+$cron_count = 0;
+while (snort_cron_job_exists("snort2c", FALSE)) {
+ install_cron_job("snort2c", false);
+ $cron_count++;
+}
+if ($cron_count > 0)
+ log_error(gettext("[Snort] Removed {$cron_count} duplicate 'remove_blocked_hosts' cron task(s)."));
+
+/*********************************************************/
+/* END OF BUG FIX CODE */
+/*********************************************************/
+
/* remake saved settings */
if ($config['installedpackages']['snortglobal']['forcekeepsettings'] == 'on') {
log_error(gettext("[Snort] Saved settings detected... rebuilding installation with saved settings..."));