From a7cf5cb9cc27188f899a4388f9ce0f7209a022c2 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Wed, 4 Feb 2015 15:54:35 -0500 Subject: Fix duplicated cron task bug when saving new time interval. --- config/suricata/suricata_post_install.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'config/suricata/suricata_post_install.php') diff --git a/config/suricata/suricata_post_install.php b/config/suricata/suricata_post_install.php index 070cf095..b2e7c674 100644 --- a/config/suricata/suricata_post_install.php +++ b/config/suricata/suricata_post_install.php @@ -130,6 +130,29 @@ if ($config['installedpackages']['suricata']['config'][0]['et_iqrisk_enable'] == install_cron_job("/usr/bin/nice -n20 /usr/local/bin/php -f /usr/local/pkg/suricata/suricata_etiqrisk_update.php", TRUE, 0, "*/6", "*", "*", "*", "root"); } +/*********************************************************/ +/* START OF BUG FIX CODE */ +/* */ +/* Remove any Suricata 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; +$suri_pf_table = SURICATA_PF_TABLE; +while (suricata_cron_job_exists($suri_pf_table, FALSE)) { + install_cron_job($suri_pf_table, false); + $cron_count++; +} +if ($cron_count > 0) + log_error(gettext("[Suricata] Removed {$cron_count} duplicate 'remove_blocked_hosts' cron task(s).")); + +/*********************************************************/ +/* END OF BUG FIX CODE */ +/*********************************************************/ + // remake saved settings if previously flagged if ($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] == 'on') { log_error(gettext("[Suricata] Saved settings detected... rebuilding installation with saved settings...")); -- cgit v1.2.3