From d2600c88e6720a1f6f2dad74bbe8dac60b435d97 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Sat, 20 Sep 2014 16:35:40 -0400 Subject: Ensure defined CONSTANTS are unique to this package. --- config/suricata/suricata_uninstall.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'config/suricata/suricata_uninstall.php') diff --git a/config/suricata/suricata_uninstall.php b/config/suricata/suricata_uninstall.php index 280e2394..c7023ec6 100644 --- a/config/suricata/suricata_uninstall.php +++ b/config/suricata/suricata_uninstall.php @@ -44,10 +44,10 @@ global $config, $g; $suricatadir = SURICATADIR; $suricatalogdir = SURICATALOGDIR; -$sidmodspath = SID_MODS_PATH; -$iprep_path = IPREP_PATH; +$sidmodspath = SURICATA_SID_MODS_PATH; +$iprep_path = SURICATA_IPREP_PATH; $rcdir = RCFILEPREFIX; -$suricata_rules_upd_log = RULES_UPD_LOGFILE; +$suricata_rules_upd_log = SURICATA_RULES_UPD_LOGFILE; $suri_pf_table = SURICATA_PF_TABLE; log_error(gettext("[Suricata] Suricata package uninstall in progress...")); -- cgit v1.2.3 From b1d0505eef8c0d30e20adb2d514f7f135acc5e9d Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Sat, 20 Sep 2014 17:46:01 -0400 Subject: Replace '/bin/rm' calls with rmdir_recursive() function. --- config/suricata/suricata_uninstall.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'config/suricata/suricata_uninstall.php') diff --git a/config/suricata/suricata_uninstall.php b/config/suricata/suricata_uninstall.php index c7023ec6..e55a43b2 100644 --- a/config/suricata/suricata_uninstall.php +++ b/config/suricata/suricata_uninstall.php @@ -81,15 +81,15 @@ install_cron_job("{$suri_pf_table}" , false); if ($config['installedpackages']['suricata']['config'][0]['clearlogs'] == 'on') { log_error(gettext("[Suricata] Clearing all Suricata-related log files...")); @unlink("{$suricata_rules_upd_log}"); - mwexec("/bin/rm -rf {$suricatalogdir}"); + rmdir_recursive("{$suricatalogdir}"); } // Mount filesystem read-write to remove our files conf_mount_rw(); /* Remove the Suricata GUI app directories */ -mwexec("/bin/rm -rf /usr/local/pkg/suricata"); -mwexec("/bin/rm -rf /usr/local/www/suricata"); +rmdir_recursive("/usr/local/pkg/suricata"); +rmdir_recursive("/usr/local/www/suricata"); /* Remove our associated Dashboard widget config and files. */ /* If "save settings" is enabled, then save old widget */ @@ -125,9 +125,9 @@ if ($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] ! unset($config['installedpackages']['suricata']); unset($config['installedpackages']['suricatasync']); @unlink("{$suricata_rules_upd_log}"); - mwexec("/bin/rm -rf {$suricatalogdir}"); - mwexec("/bin/rm -rf {$sidmodspath}"); - mwexec("/bin/rm -rf {$iprep_path}"); + rmdir_recursive("{$suricatalogdir}"); + rmdir_recursive("{$sidmodspath}"); + rmdir_recursive("{$iprep_path}"); log_error(gettext("[Suricata] The package has been removed from this system...")); } -- cgit v1.2.3 From 16e975b4421e04052b7f87d6d65690ca4c57119f Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Sat, 20 Sep 2014 18:03:43 -0400 Subject: Replace calls to @unlink with unlink_if_exists(). --- config/suricata/suricata_uninstall.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'config/suricata/suricata_uninstall.php') diff --git a/config/suricata/suricata_uninstall.php b/config/suricata/suricata_uninstall.php index e55a43b2..817c9ebd 100644 --- a/config/suricata/suricata_uninstall.php +++ b/config/suricata/suricata_uninstall.php @@ -80,7 +80,7 @@ install_cron_job("{$suri_pf_table}" , false); /* See if we are to keep Suricata log files on uninstall */ if ($config['installedpackages']['suricata']['config'][0]['clearlogs'] == 'on') { log_error(gettext("[Suricata] Clearing all Suricata-related log files...")); - @unlink("{$suricata_rules_upd_log}"); + unlink_if_exists("{$suricata_rules_upd_log}"); rmdir_recursive("{$suricatalogdir}"); } @@ -112,9 +112,9 @@ if (!empty($widgets)) { $config['widgets']['sequence'] = implode(",", $widgetlist); write_config("Suricata pkg: remove Suricata Dashboard Widget on package deinstall."); } -@unlink("/usr/local/www/widgets/include/widget-suricata.inc"); -@unlink("/usr/local/www/widgets/widgets/suricata_alerts.widget.php"); -@unlink("/usr/local/www/widgets/javascript/suricata_alerts.js"); +unlink_if_exists("/usr/local/www/widgets/include/widget-suricata.inc"); +unlink_if_exists("/usr/local/www/widgets/widgets/suricata_alerts.widget.php"); +unlink_if_exists("/usr/local/www/widgets/javascript/suricata_alerts.js"); // Finished with filesystem mods so remount it read-only conf_mount_ro(); @@ -124,7 +124,7 @@ if ($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] ! log_error(gettext("Not saving settings... all Suricata configuration info and logs deleted...")); unset($config['installedpackages']['suricata']); unset($config['installedpackages']['suricatasync']); - @unlink("{$suricata_rules_upd_log}"); + unlink_if_exists("{$suricata_rules_upd_log}"); rmdir_recursive("{$suricatalogdir}"); rmdir_recursive("{$sidmodspath}"); rmdir_recursive("{$iprep_path}"); -- cgit v1.2.3 From a5fe716ec4129a1908b7c51fd778ecf9e26327f3 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 10 Oct 2014 16:00:39 -0400 Subject: Only call conf_mount_rw() when required and remove /var/db/suricata dir. --- config/suricata/suricata_uninstall.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'config/suricata/suricata_uninstall.php') diff --git a/config/suricata/suricata_uninstall.php b/config/suricata/suricata_uninstall.php index 817c9ebd..e1db7767 100644 --- a/config/suricata/suricata_uninstall.php +++ b/config/suricata/suricata_uninstall.php @@ -49,6 +49,7 @@ $iprep_path = SURICATA_IPREP_PATH; $rcdir = RCFILEPREFIX; $suricata_rules_upd_log = SURICATA_RULES_UPD_LOGFILE; $suri_pf_table = SURICATA_PF_TABLE; +$mounted_rw = FALSE; log_error(gettext("[Suricata] Suricata package uninstall in progress...")); @@ -84,8 +85,14 @@ if ($config['installedpackages']['suricata']['config'][0]['clearlogs'] == 'on') rmdir_recursive("{$suricatalogdir}"); } -// Mount filesystem read-write to remove our files -conf_mount_rw(); +/**************************************************/ +/* If not already, set Suricata conf partition to */ +/* read-write so we can make changes there */ +/**************************************************/ +if (!is_subsystem_dirty('mount')) { + conf_mount_rw(); + $mounted_rw = TRUE; +} /* Remove the Suricata GUI app directories */ rmdir_recursive("/usr/local/pkg/suricata"); @@ -110,14 +117,17 @@ if (!empty($widgets)) { } } $config['widgets']['sequence'] = implode(",", $widgetlist); - write_config("Suricata pkg: remove Suricata Dashboard Widget on package deinstall."); } unlink_if_exists("/usr/local/www/widgets/include/widget-suricata.inc"); unlink_if_exists("/usr/local/www/widgets/widgets/suricata_alerts.widget.php"); unlink_if_exists("/usr/local/www/widgets/javascript/suricata_alerts.js"); -// Finished with filesystem mods so remount it read-only -conf_mount_ro(); +/*******************************************************/ +/* We're finished with conf partition mods, return to */ +/* read-only if we changed it */ +/*******************************************************/ +if ($mounted_rw == TRUE) + conf_mount_ro(); /* Keep this as a last step */ if ($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] != 'on') { @@ -126,8 +136,7 @@ if ($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] ! unset($config['installedpackages']['suricatasync']); unlink_if_exists("{$suricata_rules_upd_log}"); rmdir_recursive("{$suricatalogdir}"); - rmdir_recursive("{$sidmodspath}"); - rmdir_recursive("{$iprep_path}"); + rmdir_recursive("{$g['vardb_path']}/suricata"); log_error(gettext("[Suricata] The package has been removed from this system...")); } -- cgit v1.2.3 From fc40dad910de4e7e3a42cd9593088a2f905def0c Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Mon, 13 Oct 2014 00:43:59 -0400 Subject: Remove leftover unused directory during package uninstall. --- config/suricata/suricata_uninstall.php | 1 + 1 file changed, 1 insertion(+) (limited to 'config/suricata/suricata_uninstall.php') diff --git a/config/suricata/suricata_uninstall.php b/config/suricata/suricata_uninstall.php index e1db7767..239b535a 100644 --- a/config/suricata/suricata_uninstall.php +++ b/config/suricata/suricata_uninstall.php @@ -97,6 +97,7 @@ if (!is_subsystem_dirty('mount')) { /* Remove the Suricata GUI app directories */ rmdir_recursive("/usr/local/pkg/suricata"); rmdir_recursive("/usr/local/www/suricata"); +rmdir_recursive("/usr/local/etc/suricata"); /* Remove our associated Dashboard widget config and files. */ /* If "save settings" is enabled, then save old widget */ -- cgit v1.2.3 From 95b568faae3d838eeb29e8ea2a46e32e4c1afa0b Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Wed, 26 Nov 2014 15:39:07 -0500 Subject: Add GUI support for new GeoIP rule options. --- config/suricata/suricata_uninstall.php | 1 + 1 file changed, 1 insertion(+) (limited to 'config/suricata/suricata_uninstall.php') diff --git a/config/suricata/suricata_uninstall.php b/config/suricata/suricata_uninstall.php index 239b535a..b8928d17 100644 --- a/config/suricata/suricata_uninstall.php +++ b/config/suricata/suricata_uninstall.php @@ -77,6 +77,7 @@ unlink_if_exists("{$g['varrun_path']}/barnyard2_*.pid"); install_cron_job("suricata_check_for_rule_updates.php", false); install_cron_job("suricata_check_cron_misc.inc", false); install_cron_job("{$suri_pf_table}" , false); +install_cron_job("suricata_geoipupdate.php" , false); /* See if we are to keep Suricata log files on uninstall */ if ($config['installedpackages']['suricata']['config'][0]['clearlogs'] == 'on') { -- cgit v1.2.3 From 94aafa5bcef07d85b2fdc820457594ce047f425e Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 5 Dec 2014 00:03:31 -0500 Subject: Add support for IP REPUTATION to GUI code. --- config/suricata/suricata_uninstall.php | 1 + 1 file changed, 1 insertion(+) (limited to 'config/suricata/suricata_uninstall.php') diff --git a/config/suricata/suricata_uninstall.php b/config/suricata/suricata_uninstall.php index b8928d17..c8048a1c 100644 --- a/config/suricata/suricata_uninstall.php +++ b/config/suricata/suricata_uninstall.php @@ -78,6 +78,7 @@ install_cron_job("suricata_check_for_rule_updates.php", false); install_cron_job("suricata_check_cron_misc.inc", false); install_cron_job("{$suri_pf_table}" , false); install_cron_job("suricata_geoipupdate.php" , false); +install_cron_job("suricata_etiqrisk_update.php", false); /* See if we are to keep Suricata log files on uninstall */ if ($config['installedpackages']['suricata']['config'][0]['clearlogs'] == 'on') { -- cgit v1.2.3