aboutsummaryrefslogtreecommitdiffstats
path: root/config/suricata/suricata_post_install.php
diff options
context:
space:
mode:
Diffstat (limited to 'config/suricata/suricata_post_install.php')
-rw-r--r--config/suricata/suricata_post_install.php33
1 files changed, 30 insertions, 3 deletions
diff --git a/config/suricata/suricata_post_install.php b/config/suricata/suricata_post_install.php
index f4a66b0b..61d37130 100644
--- a/config/suricata/suricata_post_install.php
+++ b/config/suricata/suricata_post_install.php
@@ -112,6 +112,10 @@ safe_mkdir(SURICATALOGDIR);
safe_mkdir(SURICATA_SID_MODS_PATH);
safe_mkdir(SURICATA_IPREP_PATH);
+// Make sure config variable is an array
+if (!is_array($config['installedpackages']['suricata']['config'][0]))
+ $config['installedpackages']['suricata']['config'][0] = array();
+
// Download the latest GeoIP DB updates and create cron task if the feature is not disabled
if ($config['installedpackages']['suricata']['config'][0]['autogeoipupdate'] != 'off') {
log_error(gettext("[Suricata] Installing free GeoIP country database files..."));
@@ -123,8 +127,31 @@ if ($config['installedpackages']['suricata']['config'][0]['autogeoipupdate'] !=
if ($config['installedpackages']['suricata']['config'][0]['et_iqrisk_enable'] == 'on') {
log_error(gettext("[Suricata] Installing Emerging Threats IQRisk IP List..."));
include("/usr/local/pkg/suricata/suricata_etiqrisk_update.php");
- install_cron_job("/usr/bin/nice -n20 /usr/local/bin/php -f /usr/local/pkg/suricata/suricata_etiqrisk_update.php", TRUE, 0, 0, "*", "*", "*", "root");
+ 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') {
@@ -254,8 +281,8 @@ if (empty($config['installedpackages']['suricata']['config'][0]['forcekeepsettin
conf_mount_ro();
// Update Suricata package version in configuration
-$config['installedpackages']['suricata']['config'][0]['suricata_config_ver'] = "2.1";
-write_config("Suricata pkg v2.1: post-install configuration saved.");
+$config['installedpackages']['suricata']['config'][0]['suricata_config_ver'] = "2.1.4";
+write_config("Suricata pkg v2.1.4: post-install configuration saved.");
// Done with post-install, so clear flag
unset($g['suricata_postinstall']);