aboutsummaryrefslogtreecommitdiffstats
path: root/config/suricata/suricata_uninstall.php
diff options
context:
space:
mode:
authorbmeeks8 <bmeeks8@bellsouth.net>2014-02-28 20:21:17 -0500
committerbmeeks8 <bmeeks8@bellsouth.net>2014-02-28 20:21:17 -0500
commitf0fd2cb8f5b76369a28467c93cc1c5b7c331191a (patch)
treecb0753d0df12fba4005757f2ed9cf4ed7733bef1 /config/suricata/suricata_uninstall.php
parent0594cd5b8ba84362a091d1dc93352c62605a33ab (diff)
downloadpfsense-packages-f0fd2cb8f5b76369a28467c93cc1c5b7c331191a.tar.gz
pfsense-packages-f0fd2cb8f5b76369a28467c93cc1c5b7c331191a.tar.bz2
pfsense-packages-f0fd2cb8f5b76369a28467c93cc1c5b7c331191a.zip
Add built-in Dashboard Widget for Suricata and make it persistent.
Diffstat (limited to 'config/suricata/suricata_uninstall.php')
-rw-r--r--config/suricata/suricata_uninstall.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/config/suricata/suricata_uninstall.php b/config/suricata/suricata_uninstall.php
index 0a7f8d5a..b8ea6097 100644
--- a/config/suricata/suricata_uninstall.php
+++ b/config/suricata/suricata_uninstall.php
@@ -76,6 +76,31 @@ if ($config['installedpackages']['suricata']['config'][0]['clearlogs'] == 'on')
mwexec("/bin/rm -rf /usr/local/pkg/suricata");
mwexec("/bin/rm -rf /usr/local/www/suricata");
+/* Remove our associated Dashboard widget config and files. */
+/* If "save settings" is enabled, then save old widget */
+/* container settings so we can restore them later. */
+$widgets = $config['widgets']['sequence'];
+if (!empty($widgets)) {
+ $widgetlist = explode(",", $widgets);
+ foreach ($widgetlist as $key => $widget) {
+ if (strstr($widget, "suricata_alerts-container")) {
+ if ($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] == 'on') {
+ $config['installedpackages']['suricata']['config'][0]['dashboard_widget'] = $widget;
+ if ($config['widgets']['widget_suricata_display_lines']) {
+ $config['installedpackages']['suricata']['config'][0]['dashboard_widget_rows'] = $config['widgets']['widget_suricata_display_lines'];
+ unset($config['widgets']['widget_suricata_display_lines']);
+ }
+ }
+ unset($widgetlist[$key]);
+ }
+ }
+ $config['widgets']['sequence'] = implode(",", $widgetlist);
+ write_config();
+}
+@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");
+
/* Keep this as a last step */
if ($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] != 'on') {
log_error(gettext("Not saving settings... all Suricata configuration info and logs deleted..."));