From b71f5bf2a4b6cad4085f5a57cce44684e031a825 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Thu, 9 Oct 2014 18:00:55 -0400 Subject: Forgot to remove reverted code & handle nanoBSD installs better. --- config/snort/snort.inc | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'config') diff --git a/config/snort/snort.inc b/config/snort/snort.inc index 8837bf99..4b1adc90 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -3110,6 +3110,7 @@ function snort_deinstall() { $snortlogdir = SNORTLOGDIR; $rcdir = RCFILEPREFIX; $snort_rules_upd_log = SNORT_RULES_UPD_LOGFILE; + $mounted_rw = FALSE; log_error(gettext("[Snort] Snort package uninstall in progress...")); @@ -3141,27 +3142,6 @@ function snort_deinstall() { // Delete any leftover barnyard2 PID files in /var/run unlink_if_exists("{$g['varrun_path']}/barnyard2_*.pid"); - /* Remove our custom entries from config */ - $is_dirty = FALSE; - $pkg_serv = &$config['installedpackages']['service']; - if (!is_array($pkg_serv)) - $pkg_serv = array(); - foreach ($pkg_serv as $key => $service) { - if (strpos($service['name'], "snort_") !== FALSE) { - unset($pkg_serv[$key]); - unlink_if_exists("{$g['varrun_path']}/snort_{$service['uuid']}.disabled"); - $is_dirty = TRUE; - continue; - } - if (strpos($service['name'], "barnyard2_") !== FALSE) { - unset($pkg_serv[$key]); - unlink_if_exists("{$g['varrun_path']}/barnyard2_{$service['uuid']}.disabled"); - $is_dirty = TRUE; - } - } - if ($is_dirty) - write_config("Snort pkg: removed all snort interface services."); - /* Remove all the existing Snort cron jobs. */ if (snort_cron_job_exists("snort2c", FALSE)) install_cron_job("snort2c", false); @@ -3186,7 +3166,6 @@ function snort_deinstall() { } } $config['widgets']['sequence'] = implode(",", $widgetlist); - write_config("Snort pkg: remove Snort Dashboard Widget on package deinstall."); } /* See if we are to clear blocked hosts on uninstall */ @@ -3202,6 +3181,15 @@ function snort_deinstall() { rmdir_recursive($snortlogdir); } + /**********************************************************/ + /* If not already, set Snort conf partition to read-write */ + /* so we can make changes there */ + /**********************************************************/ + if (!is_subsystem_dirty('mount')) { + conf_mount_rw(); + $mounted_rw = TRUE; + } + /**********************************************************/ /* Test for existence of the snort directory in the PBI */ /* path. If not present, then a package "delete" */ @@ -3231,6 +3219,13 @@ function snort_deinstall() { rmdir_recursive("{$g['vardb_path']}/snort"); log_error(gettext("[Snort] The package has been removed from this system...")); } + + /**********************************************************/ + /* We're finished with conf partition mods, return to */ + /* read-only if we changed it */ + /**********************************************************/ + if ($mounted_rw == TRUE) + conf_mount_ro(); } function snort_prepare_rule_files($snortcfg, $snortcfgdir) { -- cgit v1.2.3