. * Copyright (C) 2003-2004 Manuel Kasper . * Copyright (C) 2006 Scott Ullrich * Copyright (C) 2009 Robert Zelaya Sr. Developer * Copyright (C) 2012 Ermal Luci * All rights reserved. * * Adapted for Suricata by: * Copyright (C) 2014 Bill Meeks * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ require_once("guiconfig.inc"); require_once("/usr/local/pkg/suricata/suricata.inc"); if (!is_array($config['installedpackages']['suricata']['rule'])) $config['installedpackages']['suricata']['rule'] = array(); if (!is_array($config['installedpackages']['suricata']['suppress'])) $config['installedpackages']['suricata']['suppress'] = array(); if (!is_array($config['installedpackages']['suricata']['suppress']['item'])) $config['installedpackages']['suricata']['suppress']['item'] = array(); $a_suppress = &$config['installedpackages']['suricata']['suppress']['item']; $id_gen = count($config['installedpackages']['suricata']['suppress']['item']); function suricata_suppresslist_used($supplist) { /****************************************************************/ /* This function tests if the passed Suppress List is currently */ /* assigned to an interface. It returns TRUE if the list is */ /* in use. */ /* */ /* Returns: TRUE if list is in use, else FALSE */ /****************************************************************/ global $config; $suricataconf = $config['installedpackages']['suricata']['rule']; if (empty($suricataconf)) return false; foreach ($suricataconf as $value) { if ($value['suppresslistname'] == $supplist) return true; } return false; } function suricata_find_suppresslist_interface($supplist) { /****************************************************************/ /* This function finds the first (if more than one) interface */ /* configured to use the passed Suppress List and returns the */ /* index of the interface in the ['rule'] config array. */ /* */ /* Returns: index of interface in ['rule'] config array or */ /* FALSE if no interface found. */ /****************************************************************/ global $config; $suricataconf = $config['installedpackages']['suricata']['rule']; if (empty($suricataconf)) return false; foreach ($suricataconf as $rule => $value) { if ($value['suppresslistname'] == $supplist) return $rule; } return false; } if ($_POST['del'] && is_numericint($_POST['list_id'])) { if ($a_suppress[$_POST['list_id']]) { // make sure list is not being referenced by any Suricata-configured interface if (suricata_suppresslist_used($a_suppress[$_POST['list_id']]['name'])) { $input_errors[] = gettext("ERROR -- Suppress List is currently assigned to an interface and cannot be removed!"); } else { unset($a_suppress[$_POST['list_id']]); write_config("Suricata pkg: deleted SUPPRESS LIST."); conf_mount_rw(); sync_suricata_package_config(); conf_mount_ro(); header("Location: /suricata/suricata_suppress.php"); exit; } } } $pgtitle = gettext("Suricata: Suppression Lists"); include_once("head.inc"); ?> ' . $pgtitle . '

';} if ($input_errors) { print_input_errors($input_errors); } ?>
"; } else $icon = ""; ?>
   
"> "/> "/> ');" src="/themes//images/icons/icon_x.gif" width="17" height="17" border="0" title=""/>  
  ">





" . gettext("You must first unassign the Suppress List on the Interface Edit tab."); ?>