From 080fb922c15c959be4f0bd101d0cf3f529f0e866 Mon Sep 17 00:00:00 2001
From: bmeeks8
Date: Mon, 13 May 2013 16:58:53 -0400
Subject: Snort Pkg 2.5.8 Update - bug fixes and new features
---
config/snort/snort_interfaces_edit.php | 284 ++++++++++++++++++++-------------
1 file changed, 174 insertions(+), 110 deletions(-)
(limited to 'config/snort/snort_interfaces_edit.php')
diff --git a/config/snort/snort_interfaces_edit.php b/config/snort/snort_interfaces_edit.php
index 8d7b9c06..71cdc185 100755
--- a/config/snort/snort_interfaces_edit.php
+++ b/config/snort/snort_interfaces_edit.php
@@ -76,10 +76,6 @@ if (isset($_GET['dup']))
unset($id);
if ($_POST["Submit"]) {
- if ($_POST['descr'] == '' && $pconfig['descr'] == '') {
- $input_errors[] = "Please enter a description for your reference.";
- }
-
if (!$_POST['interface'])
$input_errors[] = "Interface is mandatory";
@@ -89,7 +85,19 @@ if ($_POST["Submit"]) {
$natent['interface'] = $_POST['interface'];
$natent['enable'] = $_POST['enable'] ? 'on' : 'off';
$natent['uuid'] = $pconfig['uuid'];
- if ($_POST['descr']) $natent['descr'] = $_POST['descr']; else unset($natent['descr']);
+
+ /* See if the HOME_NET, EXTERNAL_NET, WHITELIST or SUPPRESS LIST values were changed */
+ $snort_reload = false;
+ if ($_POST['homelistname'] && ($_POST['homelistname'] <> $natent['homelistname']))
+ $snort_reload = true;
+ if ($_POST['externallistname'] && ($_POST['externallistname'] <> $natent['externallistname']))
+ $snort_reload = true;
+ if ($_POST['suppresslistname'] && ($_POST['suppresslistname'] <> $natent['suppresslistname']))
+ $snort_reload = true;
+ if ($_POST['whitelistname'] && ($_POST['whitelistname'] <> $natent['whitelistname']))
+ $snort_reload = true;
+
+ if ($_POST['descr']) $natent['descr'] = $_POST['descr']; else $natent['descr'] = strtoupper($natent['interface']);
if ($_POST['performance']) $natent['performance'] = $_POST['performance']; else unset($natent['performance']);
/* if post = on use on off or rewrite the conf */
if ($_POST['blockoffenders7'] == "on") $natent['blockoffenders7'] = 'on'; else $natent['blockoffenders7'] = 'off';
@@ -128,6 +136,15 @@ if ($_POST["Submit"]) {
/* Update snort.conf and snort.sh files for this interface */
sync_snort_package_config();
+ /*******************************************************/
+ /* Signal Snort to reload configuration if we changed */
+ /* HOME_NET, the Whitelist, EXTERNAL_NET or Suppress */
+ /* list values. The function only signals a running */
+ /* Snort instance to safely reload these parameters. */
+ /*******************************************************/
+ if ($snort_reload == true)
+ snort_reload_config($natent, $if_real);
+
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
@@ -148,29 +165,6 @@ include_once("head.inc");
-
' . $pgtitle . '
';}?>
|
-
+
|
@@ -244,8 +238,7 @@ function enable_change(enable_change) {
-
|
+
|
@@ -256,7 +249,7 @@ function enable_change(enable_change) {
- onClick="enable_change(false)">
+ onClick="enable_change(false)">
|
@@ -264,7 +257,7 @@ function enable_change(enable_change) {
- onClick="enable_blockoffenders()">
+ onClick="enable_blockoffenders()">
|
@@ -272,11 +265,11 @@ function enable_change(enable_change) {
|
>
-
+
|
- |
+ |
';
}
?>
-
-
+
+
|
@@ -308,7 +301,8 @@ function enable_change(enable_change) {
>
=htmlspecialchars($ifacename2);?>
-
+
+
>
-
-
+
+ " .
+ gettext("Most of this is already done at the firewall/filter level, so it is usually safe to check this box."); ?>
|
|
+ "Snort should inspect and whitelist."); ?>
- |
+ |
+
- default";
- /* find whitelist names and filter by type */
- if (is_array($snortglob['whitelist']['item'])) {
- foreach ($snortglob['whitelist']['item'] as $value) {
- $ilistname = $value['name'];
- if ($ilistname == $pconfig['homelistname'])
- echo "';
+ default";
+ /* find whitelist names and filter by type */
+ if (is_array($snortglob['whitelist']['item'])) {
+ foreach ($snortglob['whitelist']['item'] as $value) {
+ $ilistname = $value['name'];
+ if ($ilistname == $pconfig['homelistname'])
+ echo "';
+ }
}
- }
- ?>
-
-
-
|
+ ?>
+
+ "/>
+
+
+
+
+
+
- |
+ |
- default";
- /* find whitelist names and filter by type */
- if (is_array($snortglob['whitelist']['item'])) {
- foreach ($snortglob['whitelist']['item'] as $value) {
- $ilistname = $value['name'];
- if ($ilistname == $pconfig['externallistname'])
- echo "';
+ default";
+ /* find whitelist names and filter by type */
+ if (is_array($snortglob['whitelist']['item'])) {
+ foreach ($snortglob['whitelist']['item'] as $value) {
+ $ilistname = $value['name'];
+ if ($ilistname == $pconfig['externallistname'])
+ echo "';
+ }
}
- }
- ?>
-
-
-
|
+ ?>
+
+
+
+
+
|
- default\n";
- if (is_array($snortglob['whitelist']['item'])) {
- foreach ($snortglob['whitelist']['item'] as $value) {
- if ($value['name'] == $pconfig['whitelistname'])
- echo "';
+ default\n";
+ if (is_array($snortglob['whitelist']['item'])) {
+ foreach ($snortglob['whitelist']['item'] as $value) {
+ if ($value['name'] == $pconfig['whitelistname'])
+ echo "';
+ }
}
- }
- ?>
-
-
-
+ ?>
+
+ "/>
+
+
+
|
@@ -424,10 +431,14 @@ function enable_change(enable_change) {
}
}
?>
-
+
+ "/>
+
+ "want this interface to use."); ?>
" .
+ gettext("Default option disables suppression and filtering."); ?>
+
|
-
|
|
-
-
+ | "/>
+
|
|
-
-
+ | " .
+ gettext("Please save your settings before you attempt to start Snort."); ?>
|
@@ -458,8 +469,61 @@ function enable_change(enable_change) {
--
cgit v1.2.3
From 1ef295d754f838935412ddefc8d5fa00c51bcc1c Mon Sep 17 00:00:00 2001
From: Marcello Coutinho
Date: Tue, 14 May 2013 00:38:49 -0300
Subject: snort - (re)include two level menu and change start stop icons to
toggle status as well show current snort status
---
config/snort/snort_interfaces_edit.php | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
(limited to 'config/snort/snort_interfaces_edit.php')
diff --git a/config/snort/snort_interfaces_edit.php b/config/snort/snort_interfaces_edit.php
index 71cdc185..36bc628d 100755
--- a/config/snort/snort_interfaces_edit.php
+++ b/config/snort/snort_interfaces_edit.php
@@ -182,15 +182,27 @@ include_once("head.inc");
|
';
+ echo '';
+ $tab_array = array();
+ $menu_iface=($if_friendly?substr($if_friendly,0,5)." ":"Iface ");
+ $tab_array[] = array($menu_iface . gettext("Settings"), true, "/snort/snort_interfaces_edit.php?id={$id}");
+ $tab_array[] = array($menu_iface . gettext("Categories"), false, "/snort/snort_rulesets.php?id={$id}");
+ $tab_array[] = array($menu_iface . gettext("Rules"), false, "/snort/snort_rules.php?id={$id}");
+ $tab_array[] = array($menu_iface . gettext("Variables"), false, "/snort/snort_define_servers.php?id={$id}");
+ $tab_array[] = array($menu_iface . gettext("Preprocessors"), false, "/snort/snort_preprocessors.php?id={$id}");
+ $tab_array[] = array($menu_iface . gettext("Barnyard2"), false, "/snort/snort_barnyard.php?id={$id}");
+ display_top_tabs($tab_array);
?>
|
--
cgit v1.2.3
From f4e899011f9312f79d7f5448ebb99ec59590537d Mon Sep 17 00:00:00 2001
From: bmeeks8
Date: Thu, 16 May 2013 19:47:54 -0400
Subject: Add error trapping for Snort interface adds and deletes.
---
config/snort/snort_interfaces_edit.php | 46 +++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 14 deletions(-)
(limited to 'config/snort/snort_interfaces_edit.php')
diff --git a/config/snort/snort_interfaces_edit.php b/config/snort/snort_interfaces_edit.php
index 36bc628d..0010ec40 100755
--- a/config/snort/snort_interfaces_edit.php
+++ b/config/snort/snort_interfaces_edit.php
@@ -57,10 +57,21 @@ if (empty($snortglob['rule'][$id]['uuid'])) {
}
else {
$pconfig['uuid'] = $a_rule[$id]['uuid'];
+ $pconfig['descr'] = $a_rule[$id]['descr'];
$rebuild_rules = "off";
}
$snort_uuid = $pconfig['uuid'];
+// Get the physical configured interfaces on the firewall
+if (function_exists('get_configured_interface_with_descr'))
+ $interfaces = get_configured_interface_with_descr();
+else {
+ $interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
+ for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
+ $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
+}
+
+// See if interface is already configured, and use its values
if (isset($id) && $a_rule[$id]) {
/* old options */
$pconfig = $a_rule[$id];
@@ -68,8 +79,24 @@ if (isset($id) && $a_rule[$id]) {
$pconfig['configpassthru'] = base64_decode($pconfig['configpassthru']);
if (empty($pconfig['uuid']))
$pconfig['uuid'] = $snort_uuid;
- if (!$pconfig['interface'])
- $pconfig['interface'] = "wan";
+}
+// Must be a new interface, so try to pick next available physical interface to use
+elseif (isset($id) && !isset($a_rule[$id])) {
+ $ifaces = get_configured_interface_list();
+ $ifrules = array();
+ foreach($a_rule as $r)
+ $ifrules[] = $r['interface'];
+ foreach ($ifaces as $i) {
+ if (!in_array($i, $ifrules)) {
+ $pconfig['interface'] = $i;
+ break;
+ }
+ }
+ if (count($ifrules) == count($ifaces)) {
+ $input_errors[] = "No more available interfaces to configure for Snort!";
+ $interfaces = array();
+ $pconfig = array();
+ }
}
if (isset($_GET['dup']))
@@ -228,19 +255,11 @@ include_once("head.inc");
'WAN', 'lan' => 'LAN');
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
- $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
- }
- }
foreach ($interfaces as $iface => $ifacename): ?>
-
+
|
@@ -248,8 +267,7 @@ include_once("head.inc");
|
+ class="formfld" id="descr" size="40" value="=htmlspecialchars($pconfig['descr']); ?>">
|
--
cgit v1.2.3
From e8f8b0ab273baa1d772ec914c51e242c3ff22f56 Mon Sep 17 00:00:00 2001
From: bmeeks8
Date: Wed, 22 May 2013 12:20:35 -0400
Subject: Fix various HTML style issues to tidy up GUI.
---
config/snort/snort_interfaces_edit.php | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
(limited to 'config/snort/snort_interfaces_edit.php')
diff --git a/config/snort/snort_interfaces_edit.php b/config/snort/snort_interfaces_edit.php
index 0010ec40..08d7d2ba 100755
--- a/config/snort/snort_interfaces_edit.php
+++ b/config/snort/snort_interfaces_edit.php
@@ -207,7 +207,7 @@ include_once("head.inc");
|