aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorrobiscool <robrob2626@yahoo.com>2011-05-10 07:50:22 -0700
committerrobiscool <robrob2626@yahoo.com>2011-05-10 07:54:02 -0700
commit93d9d427d22f6d9d15e7edaaada2d6850686a060 (patch)
tree8566e33b4f5aad185f60e45cdc79baa905087a47 /config
parent1767a26f91ffe441474ea5f2f3676206eacc468b (diff)
downloadpfsense-packages-93d9d427d22f6d9d15e7edaaada2d6850686a060.tar.gz
pfsense-packages-93d9d427d22f6d9d15e7edaaada2d6850686a060.tar.bz2
pfsense-packages-93d9d427d22f6d9d15e7edaaada2d6850686a060.zip
snort-dev, add interfaces edit tab, update code
Diffstat (limited to 'config')
-rw-r--r--config/snort-dev/base_file.php131
-rw-r--r--config/snort-dev/javascript/snort_globalsend.js22
-rw-r--r--config/snort-dev/snort_alerts.php5
-rw-r--r--config/snort-dev/snort_blocked.php5
-rw-r--r--config/snort-dev/snort_head.inc101
-rw-r--r--config/snort-dev/snort_headbase.inc10
-rw-r--r--config/snort-dev/snort_interfaces.php38
-rw-r--r--config/snort-dev/snort_interfaces_edit.php455
-rw-r--r--config/snort-dev/snort_interfaces_global.php13
-rw-r--r--config/snort-dev/snort_interfaces_suppress_edit.php13
-rw-r--r--config/snort-dev/snort_interfaces_whitelist_edit.php11
-rw-r--r--config/snort-dev/snort_json_post.php81
-rw-r--r--config/snort-dev/snort_new.inc9
-rw-r--r--config/snort-dev/testing.php58
-rw-r--r--config/snort/snort_interfaces_edit.php1
15 files changed, 812 insertions, 141 deletions
diff --git a/config/snort-dev/base_file.php b/config/snort-dev/base_file.php
new file mode 100644
index 00000000..003c0b63
--- /dev/null
+++ b/config/snort-dev/base_file.php
@@ -0,0 +1,131 @@
+<?php
+/* $Id$ */
+/*
+ snort_interfaces.php
+ part of m0n0wall (http://m0n0.ch/wall)
+
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ Copyright (C) 2008-2009 Robert Zelaya.
+ 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/snort/snort_new.inc");
+require_once("/usr/local/pkg/snort/snort_gui.inc");
+
+// set page vars
+
+$uuid = $_GET['uuid'];
+if (isset($_POST['uuid']))
+$uuid = $_POST['uuid'];
+
+if ($uuid == '') {
+ echo 'error: no uuid';
+ exit(0);
+}
+
+
+$a_list = snortSql_fetchAllSettings('snortDBrules', 'Snortrules', 'uuid', $uuid);
+
+
+
+
+
+ $pgtitle = "Services: Snort: Interface Edit:";
+ include("/usr/local/pkg/snort/snort_head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+
+<div id="loadingWaiting">
+ <p class="loadingWaitingMessage"><img src="./images/loading.gif" /> <br>Please Wait...</p>
+</div>
+
+<?php include("fbegin.inc"); ?>
+<!-- hack to fix the hardcoed fbegin link in header -->
+<div id="header-left2">
+<a href="../index.php" id="status-link2">
+<img src="./images/transparent.gif" border="0"></img>
+</a>
+</div>
+
+<div class="body2"><!-- hack to fix the hardcoed fbegin link in header -->
+<div id="header-left2"><a href="../index.php" id="status-link2"><img src="./images/transparent.gif" border="0"></img></a></div>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+
+ <div class="newtabmenu" style="margin: 1px 0px; width: 775px;"><!-- Tabbed bar code-->
+ <ul class="newtabmenu">
+ <li><a href="/snort/snort_interfaces.php"><span>Snort Interfaces</span></a></li>
+ <li class="newtabmenu_active"><a href="/snort/snort_interfaces_global.php"><span>Global Settings</span></a></li>
+ <li><a href="/snort/snort_download_updates.php"><span>Updates</span></a></li>
+ <li><a href="/snort/snort_alerts.php"><span>Alerts</span></a></li>
+ <li><a href="/snort/snort_blocked.php"><span>Blocked</span></a></li>
+ <li><a href="/snort/snort_interfaces_whitelist.php"><span>Whitelists</span></a></li>
+ <li><a href="/snort/snort_interfaces_suppress.php"><span>Suppress</span></a></li>
+ <li><a href="/snort/snort_help_info.php"><span>Help</span></a></li>
+ </li>
+ </ul>
+ </div>
+
+ </td>
+ </tr>
+ <tr>
+ <td id="tdbggrey">
+ <table width="100%" border="0" cellpadding="10px" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <!-- START MAIN AREA -->
+
+ <form id="iform" >
+ <input type="hidden" name="snortSaveSettings" value="1" /> <!-- what to do, save -->
+ <input type="hidden" name="dbTable" value="SnortSettings" /> <!-- what db-->
+ <input type="hidden" name="ifaceTab" value="snort_interfaces_global" /> <!-- what interface tab -->
+
+
+ </form>
+ <!-- STOP MAIN AREA -->
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</div>
+
+
+<!-- footer do not touch below -->
+<?php
+include("fend.inc");
+echo $snort_custom_rnd_box;
+?>
+
+
+</body>
+</html>
diff --git a/config/snort-dev/javascript/snort_globalsend.js b/config/snort-dev/javascript/snort_globalsend.js
index a23f78c9..9147cc25 100644
--- a/config/snort-dev/javascript/snort_globalsend.js
+++ b/config/snort-dev/javascript/snort_globalsend.js
@@ -212,10 +212,18 @@ function showRequest(formData, jqForm, options) {
function showResponse(data, responseText, statusText, xhr, $form) {
- function hideLoading() {
- jQuery("#loadingWaiting").hide();
+ function snortUnhideTabsCall() {
+ // unhide tabs for iface edit
+ if (data.snortUnhideTabs == 'true')
+ {
+ jQuery('.hide_newtabmenu').show();
+ }
};
+ function hideLoading() {
+ jQuery("#loadingWaiting").hide();
+ };
+
// START of fill call to user
if (responseText == 'success') {
@@ -231,20 +239,24 @@ function showResponse(data, responseText, statusText, xhr, $form) {
}
// succsess display
- if (data.snortgeneralsettings == 'success' || data.snortdelete == 'success' || data.snortreset == 'success') {
+ if (data.snortgeneralsettings == 'success' || data.snortdelete == 'success' || data.snortreset == 'success')
+ {
var appendElem = jQuery('<br> <span>success...<span>');
appendElem.appendTo('.loadingWaitingMessage');
- // remove display
+ // After Save Calls display
function finnish() {
+ snortUnhideTabsCall();
hideLoading();
appendElem.remove();
updatestarted = 1;
};
setTimeout(finnish, 2000);
+
if (data.snortreset) {location.reload();}; // hard refresh
- };
+ }
+
// END of fill call to user
}else{
diff --git a/config/snort-dev/snort_alerts.php b/config/snort-dev/snort_alerts.php
index f3aedbcb..dc385e6d 100644
--- a/config/snort-dev/snort_alerts.php
+++ b/config/snort-dev/snort_alerts.php
@@ -129,8 +129,9 @@ $arefresh_on = ($generalSettings['arefresh'] == 'on' ? 'checked' : '');
<span class="vexpl">Limit entries to view. <strong>Default 250</strong>.</span>
<input type="hidden" name="snortSaveSettings" value="1" /> <!-- what to do, save -->
- <input type="hidden" name="dbTable" value="SnortSettings" /> <!-- what db-->
- <input type="hidden" name="ifaceTab" value="snort_alerts_blocked" /> <!-- what interface tab -->
+ <input type="hidden" name="dbName" value="snortDB" /> <!-- what db -->
+ <input type="hidden" name="dbTable" value="SnortSettings" /> <!-- what db table -->
+ <input type="hidden" name="ifaceTab" value="snort_alerts" /> <!-- what interface tab -->
</form>
</td>
diff --git a/config/snort-dev/snort_blocked.php b/config/snort-dev/snort_blocked.php
index eafadb71..c5400298 100644
--- a/config/snort-dev/snort_blocked.php
+++ b/config/snort-dev/snort_blocked.php
@@ -130,8 +130,9 @@ $brefresh_on = ($generalSettings['brefresh'] == 'on' ? 'checked' : '');
<span class="vexpl">Limit entries to view. <strong>Default 500</strong>.</span>
<input type="hidden" name="snortSaveSettings" value="1" /> <!-- what to do, save -->
- <input type="hidden" name="dbTable" value="SnortSettings" /> <!-- what db-->
- <input type="hidden" name="ifaceTab" value="snort_alerts_blocked" /> <!-- what interface tab -->
+ <input type="hidden" name="dbName" value="snortDB" /> <!-- what db -->
+ <input type="hidden" name="dbTable" value="SnortSettings" /> <!-- what db table -->
+ <input type="hidden" name="ifaceTab" value="snort_blocked" /> <!-- what interface tab -->
</form>
</td>
diff --git a/config/snort-dev/snort_head.inc b/config/snort-dev/snort_head.inc
index 6e58cc1e..8f9bf9b4 100644
--- a/config/snort-dev/snort_head.inc
+++ b/config/snort-dev/snort_head.inc
@@ -1,69 +1,104 @@
<?php
+/*
+ pfSense_MODULE: header
+*/
+
/*
* if user has selected a custom template, use it.
* otherwise default to pfsense tempalte
*/
-if($config['theme'] <> "")
+if (($g["disablethemeselection"] === true) && !empty($g["default_theme"]) && (is_dir($g["www_path"].'/themes/'.$g["default_theme"])))
+ $g['theme'] = $g["default_theme"];
+elseif($config['theme'] <> "" && (is_dir($g["www_path"].'/themes/'.$config['theme'])))
$g['theme'] = $config['theme'];
else
$g['theme'] = "pfsense";
-
-$apple_ua = array("iPhone","iPod");
-foreach($apple_ua as $useragent)
+
+/*
+ * If this device is an apple ipod/iphone
+ * switch the theme to one that works with it.
+ */
+$lowres_ua = array("iPhone","iPod", "iPad", "Android");
+foreach($lowres_ua as $useragent)
if(strstr($_SERVER['HTTP_USER_AGENT'], $useragent))
- $g['theme'] = "pfsense";
+ $g['theme'] = empty($g['theme_lowres']) ? "pfsense" : $g['theme_lowres'];
+
+$pagetitle = gentitle( $pgtitle );
+
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
- <title><?=gentitle($pgtitle);?></title>
+ <title><?php echo($config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pagetitle); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <link rel=”apple-touch-icon” href=”/themes/<?php echo $g['theme']; ?>/apple-touch-icon.png”/>
+ <link rel="apple-touch-icon" href="/themes/<?php echo $g['theme']; ?>/apple-touch-icon.png"/>
+
<!-- snort custom javascript and css -->
-<?php include('/usr/local/pkg/snort/snort_headbase.inc'); ?>
-<!-- remove Only used to test conflicts -->
+<?php include('/usr/local/pkg/snort/snort_headbase.inc'); ?>
- <?php
- if (strpos($_SERVER["SCRIPT_FILENAME"], "wizard.php") !== false &&
- file_exists("{$g['www_path']}/themes/{$g['theme']}/wizard.css")):
- ?>
- <link rel="stylesheet" href="/themes/<?php echo $g['theme']; ?>/wizard.css" media="all" />
+<!-- remove Only used to test conflicts -->
+
+
+ <?php if (strpos($_SERVER["SCRIPT_FILENAME"], "wizard.php") !== false &&
+ file_exists("{$g['www_path']}/themes/{$g['theme']}/wizard.css")): ?>
+ <?php echo "<style type=\"text/css\" src=\"/themes/{$g['theme']}/wizard.css\"></style>"; ?>
<?php else: ?>
- <link rel="stylesheet" href="/themes/<?php echo $g['theme']; ?>/all.css" media="all" />
+ <link rel="stylesheet" href="/themes/<?php echo $g['theme']; ?>/all.css" media="all" />
<?php endif; ?>
- <link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" />
- <script type="text/javascript">var theme = "<?php echo $g['theme']; ?>"</script>
- <script type="text/javascript" src="/themes/<?php echo $g['theme']; ?>/loader.js"></script>
-
-<?
+ <link rel="stylesheet" type="text/css" href="/niftycssCode.css">
+ <link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print">
+ <link rel="stylesheet" type="text/css" href="/themes/<?=$g['theme']?>/new_tab_menu.css" media="all">
+ <script type="text/javascript" src="/javascript/niftyjsCode.js"></script>
+ <script type="text/javascript">
+ var theme = "<?php echo $g['theme']; ?>";
+ </script>
+ <?php echo "\t<script type=\"text/javascript\" src=\"/themes/{$g['theme']}/loader.js\"></script>\n"; ?>
+<?php
+ if($_GET['enablefirebuglite']) {
+ echo "\t<script type=\"text/javascript\" src=\"/javascript/pi.js\"></script>\n";
+ echo "\t<script type=\"text/javascript\" src=\"/javascript/firebug-lite.js\"></script>\n";
+ }
+ echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/prototype.js\"></script>\n";
+ echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/scriptaculous.js\"></script>\n";
+ echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/effects.js\"></script>\n";
+ echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/dragdrop.js\"></script>\n";
+ if(file_exists("{$g['www_path']}/javascript/global.js"))
+ echo "\t<script type=\"text/javascript\" src=\"/javascript/global.js\"></script>\n";
/*
* Find all javascript files that need to be included
* for this page ... from the arrays ... :)
* Coded by: Erik Kristensen
*/
- $dir = trim(basename($_SERVER["SCRIPT_FILENAME"]), '.php');
- $path = "/usr/local/www/javascript/" . $dir . "/";
+ $dir = trim(basename($_SERVER["SCRIPT_FILENAME"], '.php'));
+ $path = "{$g['www_path']}/javascript/" . $dir . "/";
if (is_dir($path)) {
if ($dh = opendir($path)) {
while (($file = readdir($dh)) !== false) {
- if (is_dir($file)) continue;
- echo "\t".'<script type="text/javascript" src="/javascript/'.$dir.'/'.$file.'"></script>'."\n";
+ if (is_dir($file))
+ continue;
+ echo "\t<script type=\"text/javascript\" src=\"/javascript/{$dir}/{$file}\"></script>\n";
}
closedir($dh);
}
}
- if ($oSajax):
-?>
- <script language="javascript" type="text/javascript">
- <?php $oSajax->sajax_show_javascript(); ?>
- </script>
-<? endif; ?>
+if (!isset($closehead))
+ echo "</head>";
+
+/* If this page is being remotely managed then do not allow the loading of the contents. */
+if($config['remote_managed_pages']['item']) {
+ foreach($config['remote_managed_pages']['item'] as $rmp) {
+ if($rmp == $_SERVER['SCRIPT_NAME']) {
+ include("fbegin.inc");
+ print_info_box_np("This page is currently being managed by a remote machine.");
+ include("fend.inc");
+ exit;
+ }
+ }
+}
-<?php if (!isset($closehead)){ ?>
-</head>
-<?php } ?>
+?>
diff --git a/config/snort-dev/snort_headbase.inc b/config/snort-dev/snort_headbase.inc
index 59a531bd..8176b4bf 100644
--- a/config/snort-dev/snort_headbase.inc
+++ b/config/snort-dev/snort_headbase.inc
@@ -10,15 +10,15 @@
<?php
-echo "\t<script type=\"text/javascript\" src=\"./javascript/jquery-1.6.min.js\"></script>\n";
+//echo "\t<script type=\"text/javascript\" src=\"./javascript/jquery-1.6.min.js\"></script>\n";
-echo "\t<script type=\"text/javascript\" src=\"./javascript/jquery.form.js\"></script>\n";
+//echo "\t<script type=\"text/javascript\" src=\"./javascript/jquery.form.js\"></script>\n";
-echo "\t<link href=\"./css/jquery.bubblepopup.v2.3.1.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
-echo "\t<script src=\"./javascript/jquery.bubblepopup.v2.3.1.min.js\" type=\"text/javascript\"></script>\n";
+//echo "\t<link href=\"./css/jquery.bubblepopup.v2.3.1.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
+//echo "\t<script src=\"./javascript/jquery.bubblepopup.v2.3.1.min.js\" type=\"text/javascript\"></script>\n";
-echo "\t<script type=\"text/javascript\" src=\"./javascript/snort_globalsend.js\"></script>\n";
+//echo "\t<script type=\"text/javascript\" src=\"./javascript/snort_globalsend.js\"></script>\n";
?>
diff --git a/config/snort-dev/snort_interfaces.php b/config/snort-dev/snort_interfaces.php
index dd5bb75b..fba6c028 100644
--- a/config/snort-dev/snort_interfaces.php
+++ b/config/snort-dev/snort_interfaces.php
@@ -120,12 +120,12 @@ $a_interfaces = snortSql_fetchAllInterfaceRules('Snortrules', 'snortDBrules');
<td class="listt">
<a href="?act=toggle&id=0"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="13" height="13" border="0" title="click to toggle start/stop snortsam"></a>
</td>
- <td class="listbg" onClick="fr_toggle(0)" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">DISABLED</td>
- <td class="listr" onClick="fr_toggle(0)" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">MASTER</td>
- <td class="listr" onClick="fr_toggle(0)" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">3526</td>
- <td class="listr" onClick="fr_toggle(0)" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">ENABLED</td>
- <td class="listr" onClick="fr_toggle(0)" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">DISABLED</td>
- <td class="listbg3" onClick="fr_toggle(0)" ondblclick="document.location='snort_interfaces_edit.php?id=0';"><font color="#ffffff">Mster IPs&nbsp;</td>
+ <td class="listbg" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">DISABLED</td>
+ <td class="listr" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">MASTER</td>
+ <td class="listr" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">3526</td>
+ <td class="listr" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">ENABLED</td>
+ <td class="listr" id="frd0" ondblclick="document.location='snort_interfaces_edit.php?id=0';">DISABLED</td>
+ <td class="listbg3" ondblclick="document.location='snort_interfaces_edit.php?id=0';"><font color="#ffffff">Mster IPs&nbsp;</td>
<td></td>
<td>
<a href="snort_interfaces_edit.php?id=0"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="edit rule"></a>
@@ -202,15 +202,15 @@ $a_interfaces = snortSql_fetchAllInterfaceRules('Snortrules', 'snortDBrules');
<a href=\"?act=toggle&id=0\"><img src=\"/themes/{$g['theme']}/images/icons/icon_pass.gif\" width=\"13\" height=\"13\" border=\"0\" title=\"click to toggle start/stop snort\"></a>
</td>
- <td class=\"listbg\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id={$list['uuid']}';\">{$ifaceStat}</td>
- <td class=\"listr\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id={$list['uuid']}';\">{$list['interface']}</td>
- <td class=\"listr\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id={$list['uuid']}';\">{$list['performance']}</td>
- <td class=\"listr\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id={$list['uuid']}';\">{$blockStat}</td>
- <td class=\"listr\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id={$list['uuid']}';\">{$logStat}</td>
- <td class=\"listbg3\" onClick=\"fr_toggle(0)\" ondblclick=\"document.location='snort_interfaces_edit.php?id={$list['uuid']}';\"><font color=\"#ffffff\">{$list['descr']}</td>
+ <td class=\"listbg\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?uuid={$list['uuid']}';\">{$ifaceStat}</td>
+ <td class=\"listr\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?uuid={$list['uuid']}';\">{$list['interface']}</td>
+ <td class=\"listr\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?uuid={$list['uuid']}';\">{$list['performance']}</td>
+ <td class=\"listr\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?uuid={$list['uuid']}';\">{$blockStat}</td>
+ <td class=\"listr\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?uuid={$list['uuid']}';\">{$logStat}</td>
+ <td class=\"listbg3\" ondblclick=\"document.location='snort_interfaces_edit.php?uuid={$list['uuid']}';\"><font color=\"#ffffff\">{$list['descr']}</td>
<td></td>
<td>
- <a href=\"snort_interfaces_edit.php?id={$list['uuid']}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"edit rule\"></a>
+ <a href=\"snort_interfaces_edit.php?uuid={$list['uuid']}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"edit rule\"></a>
";
echo '
</td>
@@ -243,12 +243,12 @@ $a_interfaces = snortSql_fetchAllInterfaceRules('Snortrules', 'snortDBrules');
echo "
<a href=\"?act=toggle&id=0\"><img src=\"/themes/{$g['theme']}/images/icons/icon_pass.gif\" width=\"13\" height=\"13\" border=\"0\" title=\"click to toggle start/stop barnyard2\"></a>
</td>
- <td class=\"listbg\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">{$barnyard2Stat}</td>
- <td class=\"listr\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">{$list['interface']}</td>
- <td class=\"listr\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">{$list['uuid']}_{$list['interface']}</td>
- <td class=\"listr\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">unified2</td>
- <td class=\"listr\" onClick=\"fr_toggle(0)\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">{$barnyard2Stat}</td>
- <td class=\"listbg3\" onClick=\"fr_toggle(0)\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\"><font color=\"#ffffff\">Mster IPs&nbsp;</td>
+ <td class=\"listbg\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">{$barnyard2Stat}</td>
+ <td class=\"listr\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">{$list['interface']}</td>
+ <td class=\"listr\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">{$list['uuid']}_{$list['interface']}</td>
+ <td class=\"listr\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">unified2</td>
+ <td class=\"listr\" id=\"frd0\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\">{$barnyard2Stat}</td>
+ <td class=\"listbg3\" ondblclick=\"document.location='snort_interfaces_edit.php?id=0';\"><font color=\"#ffffff\">Mster IPs&nbsp;</td>
<td></td>
<td>
<img id=\"icon_x_{$list['uuid']}\" class=\"icon_click icon_x\" src=\"/themes/{$g['theme']}/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"delete rule\">
diff --git a/config/snort-dev/snort_interfaces_edit.php b/config/snort-dev/snort_interfaces_edit.php
new file mode 100644
index 00000000..223e7b1e
--- /dev/null
+++ b/config/snort-dev/snort_interfaces_edit.php
@@ -0,0 +1,455 @@
+<?php
+/* $Id$ */
+/*
+ snort_interfaces.php
+ part of m0n0wall (http://m0n0.ch/wall)
+
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ Copyright (C) 2008-2009 Robert Zelaya.
+ 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/snort/snort_new.inc");
+require_once("/usr/local/pkg/snort/snort_gui.inc");
+
+// set page vars
+
+$uuid = $_GET['uuid'];
+if (isset($_POST['uuid']))
+$uuid = $_POST['uuid'];
+
+if ($uuid == '') {
+ echo 'error: no uuid';
+ exit(0);
+}
+
+
+
+$a_list = snortSql_fetchAllSettings('snortDBrules', 'Snortrules', 'uuid', $uuid);
+
+ if (!is_array($a_list))
+ {
+ $a_list = array();
+ }
+
+$a_whitelist = snortSql_fetchAllWhitelistTypes('SnortWhitelist', 'SnortWhitelistips');
+
+ if (!is_array($a_whitelist))
+ {
+ $a_whitelist = array();
+ }
+
+$a_suppresslist = snortSql_fetchAllWhitelistTypes('SnortSuppress', '');
+
+if (!is_array($a_suppresslist))
+{
+ $a_suppresslist = array();
+}
+
+
+ $pgtitle = "Services: Snort: Interface Edit:";
+ include("/usr/local/pkg/snort/snort_head.inc");
+
+?>
+
+<!-- START page custom script -->
+<script language="JavaScript">
+
+// start a jQuery sand box
+jQuery(document).ready(function() {
+
+ // START disable option for snort_interfaces_edit.php
+ endis = !(jQuery('input[name=enable]:checked').val());
+
+ disableInputs=new Array(
+ "descr",
+ "performance",
+ "blockoffenders7",
+ "alertsystemlog",
+ "externallistname",
+ "homelistname",
+ "suppresslistname",
+ "tcpdumplog",
+ "snortunifiedlog",
+ "configpassthru"
+ );
+ <?php
+
+ if ($a_list['interface'] != '')
+ {
+ echo '
+ jQuery(\'[name=interface]\').attr(\'disabled\', \'true\');
+ ';
+ }
+
+ // disable tabs if nothing in database
+ if ($a_list['uuid'] == '')
+ {
+ echo '
+ jQuery(\'.hide_newtabmenu\').hide();
+ ';
+ }
+
+ ?>
+
+ if (endis)
+ {
+ for (var i = 0; i < disableInputs.length; i++)
+ {
+ jQuery('[name=' + disableInputs[i] + ']').attr('disabled', 'true');
+ }
+ }
+
+ jQuery("input[name=enable]").live('click', function() {
+
+ endis = !(jQuery('input[name=enable]:checked').val());
+
+ if (endis)
+ {
+ for (var i = 0; i < disableInputs.length; i++)
+ {
+ jQuery('[name=' + disableInputs[i] + ']').attr('disabled', 'true');
+ }
+ }else{
+ for (var i = 0; i < disableInputs.length; i++)
+ {
+ jQuery('[name=' + disableInputs[i] + ']').removeAttr('disabled');
+ }
+ }
+
+
+ });
+ // STOP disable option for snort_interfaces_edit.php
+
+
+}); // end of on ready
+
+</script>
+
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+
+<div id="loadingWaiting">
+ <p class="loadingWaitingMessage"><img src="./images/loading.gif" /> <br>Please Wait...</p>
+</div>
+
+<?php include("fbegin.inc"); ?>
+<!-- hack to fix the hardcoed fbegin link in header -->
+<div id="header-left2">
+<a href="../index.php" id="status-link2">
+<img src="./images/transparent.gif" border="0"></img>
+</a>
+</div>
+
+<div class="body2"><!-- hack to fix the hardcoed fbegin link in header -->
+<div id="header-left2"><a href="../index.php" id="status-link2"><img src="./images/transparent.gif" border="0"></img></a></div>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+ <div class="newtabmenu" style="margin: 1px 0px; width: 775px;"><!-- Tabbed bar code-->
+ <ul class="newtabmenu">
+ <li><a href="/snort/snort_interfaces.php"><span>Snort Interfaces</span></a></li>
+ <li class="newtabmenu_active"><a href="/snort/snort_interfaces_edit.php?uuid=<?=$uuid;?>"><span>If Settings</span></a></li>
+ <li class="hide_newtabmenu"><a href="/snort/snort_rulesets.php?uuid=<?=$uuid;?>"><span>Categories</span></a></li>
+ <li class="hide_newtabmenu"><a href="/snort/snort_rules.php?uuid=<?=$uuid;?>"><span>Rules</span></a></li>
+ <li class="hide_newtabmenu"><a href="/snort/snort_define_servers.php?uuid=<?=$uuid;?>"><span>Servers</span></a></li>
+ <li class="hide_newtabmenu"><a href="/snort/snort_preprocessors.php?uuid=<?=$uuid;?>"><span>Preprocessors</span></a></li>
+ <li class="hide_newtabmenu"><a href="/snort/snort_barnyard.php?uuid=<?=$uuid;?>"><span>Barnyard2</span></a></li>
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td id="tdbggrey">
+ <table width="100%" border="0" cellpadding="10px" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <!-- START MAIN AREA -->
+
+ <form id="iform" name="iform" >
+ <input type="hidden" name="snortSaveSettings" value="1" /> <!-- what to do, save -->
+ <input type="hidden" name="dbName" value="snortDBrules" /> <!-- what db-->
+ <input type="hidden" name="dbTable" value="Snortrules" /> <!-- what db table-->
+ <input type="hidden" name="ifaceTab" value="snort_interfaces_edit" /> <!-- what interface tab -->
+
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">General Settings</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq2">Interface</td>
+ <td width="22%" valign="top" class="vtable">
+ &nbsp;
+ <input name="enable" type="checkbox" value="on" <?=$ifaceEnabled = $a_list['enable'] == 'on' || $a_list['enable'] == '' ? 'checked' : '';?> ">
+ &nbsp;&nbsp;<span class="vexpl">Enable or Disable</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq2">Interface</td>
+ <td width="78%" class="vtable">
+ <select name="interface" class="formfld">
+
+ <?php
+ /* add group interfaces */
+ /* needs to be watched, dont know if new interfces will work */
+ if (is_array($config['ifgroups']['ifgroupentry']))
+ foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
+ if (have_ruleint_access($ifgen['ifname']))
+ $interfaces[$ifgen['ifname']] = $ifgen['ifname'];
+ $ifdescs = get_configured_interface_with_descr();
+ foreach ($ifdescs as $ifent => $ifdesc)
+ if(have_ruleint_access($ifent))
+ $interfaces[$ifent] = $ifdesc;
+ if ($config['l2tp']['mode'] == "server")
+ if(have_ruleint_access("l2tp"))
+ $interfaces['l2tp'] = "L2TP VPN";
+ if ($config['pptpd']['mode'] == "server")
+ if(have_ruleint_access("pptp"))
+ $interfaces['pptp'] = "PPTP VPN";
+
+ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
+ $interfaces['pppoe'] = "PPPoE VPN";
+ /* add ipsec interfaces */
+ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
+ if(have_ruleint_access("enc0"))
+ $interfaces["enc0"] = "IPsec";
+ /* add openvpn/tun interfaces */
+ if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
+ $interfaces["openvpn"] = "OpenVPN";
+ $selected_interfaces = explode(",", $pconfig['interface']);
+ foreach ($interfaces as $iface => $ifacename)
+ {
+ echo "\n" . "<option value=\"$iface\"";
+ if ($a_list['interface'] == strtolower($ifacename)){echo " selected ";}
+ echo '>' . $ifacename . '</option>' . "\r";
+ }
+ ?>
+ </select>
+ <br>
+ <span class="vexpl">Choose which interface this rule applies to.<br>
+ Hint: in most cases, you'll want to use WAN here.</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq2">Description</td>
+ <td width="78%" class="vtable">
+ <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=$a_list['descr']?>">
+ <br>
+ <span class="vexpl">You may enter a description here for your reference (not parsed).</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell2">Memory Performance</td>
+ <td width="78%" class="vtable">
+ <select name="performance" class="formfld" id="performance">
+
+ <?php
+ $memoryPerfList = array('ac-bnfa' => 'AC-BNFA', 'lowmem' => 'LOWMEM', 'aclowmem-std' => 'AC-STD', 'ac' => 'AC', 'ac-banded' => 'AC-BANDED', 'ac-sparsebands' => 'AC-SPARSEBANDS', 'acs' => 'ACS');
+ snortDropDownList($memoryPerfList, $a_list['performance']);
+ ?>
+
+ </select>
+ <br>
+ <span class="vexpl">Lowmem and ac-bnfa are recommended for low end systems, Ac: high memory, best performance, ac-std: moderate
+ memory,high performance, acs: small memory, moderateperformance, ac-banded: small memory,moderate performance, ac-sparsebands: small memory, high performance.</span>
+ <br>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Choose the networks snort should inspect and whitelist.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell2">Home net</td>
+ <td width="78%" class="vtable">
+ <select name="homelistname" class="formfld" id="homelistname">
+
+ <?php
+ /* find homelist names and filter by type */
+ $selected = '';
+ if ($a_list['homelistname'] == 'default'){$selected = 'selected';}
+ echo "\n" . '<option value="default" ' . $selected . ' >default</option>' . "\r";
+ foreach ($a_whitelist as $value)
+ {
+ $selected = '';
+ if ($value['filename'] == $a_list['homelistname']){$selected = 'selected';};
+ if ($value['snortlisttype'] == 'netlist') // filter
+ {
+
+ echo "\n" . '<option value="' . $value['filename'] . '" ' . $selected . ' >' . $value['filename'] . '</option>' . "\r";
+
+ }
+ }
+ ?>
+
+ </select>
+ <br>
+ <span class="vexpl">Choose the home net you will like this rule to use. &nbsp;<span class="red">Note:</span>&nbsp;Default homenet adds only local networks.
+ <br>
+ <span class="red">Hint:</span>&nbsp;Most users add a list offriendly ips that the firewall cant see.</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell2">External net</td>
+ <td width="78%" class="vtable">
+ <select name="externallistname" class="formfld" id="externallistname">
+
+ <?php
+ /* find externallist names and filter by type */
+ $selected = '';
+ if ($a_list['externallistname'] == 'default'){$selected = 'selected';}
+ echo "\n" . '<option value="default" ' . $selected . ' >default</option>' . "\r";
+ foreach ($a_whitelist as $value)
+ {
+ $selected = '';
+ if ($value['filename'] == $a_list['externallistname']){$selected = 'selected';}
+ if ($value['snortlisttype'] == 'netlist') // filter
+ {
+
+ echo "\n" . '<option value="' . $value['filename'] . '" ' . $selected . ' >' . $value['filename'] . '</option>' . "\r";
+
+ }
+ }
+ ?>
+
+ </select>
+ <br>
+ <span class="vexpl">Choose the external net you will like this rule to use.&nbsp;<span class="red">Note:</span>&nbsp;Default external net, networks that are not home net.
+ <br>
+ <span class="red">Hint:</span>&nbsp;Most users should leave this setting at default.</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell2">Block offenders</td>
+ <td width="78%" class="vtable">
+ <input name="blockoffenders7" type="checkbox" value="on" <?=$ifaceEnabled = $a_list['blockoffenders7'] == 'on' ? 'checked' : '';?> >
+ <br>
+ <span class="vexpl">Checking this option will automatically block hosts that generate a Snort alerts with SnortSam.</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell2">Suppression and filtering</td>
+ <td width="78%" class="vtable">
+ <select name="suppresslistname" class="formfld" id="suppresslistname">
+
+ <?php
+ /* find suppresslist names and filter by type */
+ $selected = '';
+ if ($a_list['suppresslistname'] == 'default'){$selected = 'selected';}
+
+ echo "\n" . '<option value="default" ' . $selected . ' >default</option>' . "\r";
+
+ foreach ($a_suppresslist as $value)
+ {
+ $selected = '';
+ if ($value['filename'] == $a_list['suppresslistname']){$selected = 'selected';}
+
+ echo "\n" . '<option value="' . $value['filename'] . '" ' . $selected . ' >' . $value['filename'] . '</option>' . "\r";
+ }
+ ?>
+
+ </select>
+ <br>
+ <span class="vexpl">Choose the suppression or filtering file you will like this rule to use.&nbsp;<span class="red">
+ Note:</span>&nbsp;Default option disables suppression and filtering.</span>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Choose the types of logs snort should create.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell2">Send alerts to mainSystem logs</td>
+ <td width="78%" class="vtable">
+ <input name="alertsystemlog" type="checkbox" value="on" <?=$ifaceEnabled = $a_list['alertsystemlog'] == 'on' ? 'checked' : '';?> >
+ <br>
+ <span class="vexpl">Snort will send Alerts to the Pfsense system logs.</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell2">Log to a Tcpdump file</td>
+ <td width="78%" class="vtable">
+ <input name="tcpdumplog" type="checkbox" value="on" <?=$ifaceEnabled = $a_list['tcpdumplog'] == 'on' ? 'checked' : '';?> >
+ <br>
+ <span class="vexpl">Snort will log packets to a tcpdump-formatted file. The file then can be analyzed by an application such as Wireshark which understands pcap file formats.
+ <span class="red"><strong>WARNING:</strong></span> File may become large.</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell2">Log Alerts to a snort unified2 file</td>
+ <td width="78%" class="vtable">
+ <input name="snortunifiedlog" type="checkbox" value="on" <?=$ifaceEnabled = $a_list['snortunifiedlog'] == 'on' ? 'checked' : '';?> >
+ <br>
+ <span class="vexpl">Snort will log Alerts to a file in the UNIFIED2 format. This is a requirement for barnyard2.</span>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Arguments here will be automatically inserted into the snort configuration.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell2">Advanced configuration pass through</td>
+ <td width="78%" class="vtable">
+ <textarea wrap="off" name="configpassthru" cols="75" rows="12" id="configpassthru" class="formpre2"><?=base64_decode($a_list['configpassthru']); ?></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top"></td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save">
+ <input name="Submit2" type="submit" class="formbtn" value="Start" onClick="enable_change(true)">
+ <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
+ <input name="uuid" type="hidden" value="<?=$uuid; ?>" >
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <span class="vexpl"><span class="red"><strong>Note:</strong></span>
+ Please save your settings before you click start.</span>
+ </td>
+ </tr>
+ </table>
+ </form>
+
+ <!-- STOP MAIN AREA -->
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</div>
+
+
+<!-- footer do not touch below -->
+<?php
+include("fend.inc");
+echo $snort_custom_rnd_box;
+?>
+
+
+</body>
+</html>
diff --git a/config/snort-dev/snort_interfaces_global.php b/config/snort-dev/snort_interfaces_global.php
index 46b902de..c391f10c 100644
--- a/config/snort-dev/snort_interfaces_global.php
+++ b/config/snort-dev/snort_interfaces_global.php
@@ -153,8 +153,6 @@ jQuery(document).ready(function(){
<div class="body2"><!-- hack to fix the hardcoed fbegin link in header -->
<div id="header-left2"><a href="../index.php" id="status-link2"><img src="./images/transparent.gif" border="0"></img></a></div>
-<form id="iform" >
-
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
@@ -183,8 +181,10 @@ jQuery(document).ready(function(){
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<!-- START MAIN AREA -->
+ <form id="iform" >
<input type="hidden" name="snortSaveSettings" value="1" /> <!-- what to do, save -->
- <input type="hidden" name="dbTable" value="SnortSettings" /> <!-- what db-->
+ <input type="hidden" name="dbName" value="snortDB" /> <!-- what db -->
+ <input type="hidden" name="dbTable" value="SnortSettings" /> <!-- what db table -->
<input type="hidden" name="ifaceTab" value="snort_interfaces_global" /> <!-- what interface tab -->
<tr id="maintable" data-options='{"pagetable":"SnortSettings"}'> <!-- db to lookup -->
@@ -365,23 +365,22 @@ jQuery(document).ready(function(){
<td width="30%" class="vtable">
<input name="Submit" type="submit" class="formbtn" value="Save">
<input id="cancel" type="button" class="formbtn" value="Cancel">
- </form>
</td>
</tr>
+ </form>
+ <form id="iform2" >
<tr>
<td width="22%" valign="top" class="vncell2">
- <form id="iform2" >
<input name="Reset" type="submit" class="formbtn" value="Reset" onclick="return confirm('Do you really want to remove all your settings ? All Snort Settings will be reset !')" >
<input type="hidden" name="reset_snortgeneralsettings" value="1" />
<span class="vexpl red"><strong>&nbsp;WARNING:</strong><br> This will reset all global and interface settings.</span>
- </form>
</td>
<td class="vtable">
<span class="vexpl red"><strong>Note:</strong></span><br>
<span class="vexpl">Changing any settings on this page will affect all interfaces. Please, double check if your oink code is correct and the type of snort.org account you hold.</span>
</td>
</tr>
-
+ </form>
<!-- STOP MAIN AREA -->
</table>
diff --git a/config/snort-dev/snort_interfaces_suppress_edit.php b/config/snort-dev/snort_interfaces_suppress_edit.php
index aa3c9905..28bb7868 100644
--- a/config/snort-dev/snort_interfaces_suppress_edit.php
+++ b/config/snort-dev/snort_interfaces_suppress_edit.php
@@ -120,12 +120,13 @@ if ($a_list == '')
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<!-- START MAIN AREA -->
- <!-- table point -->
- <input name="snortSaveSuppresslist" type="hidden" value="1" />
- <input name="ifaceTab" type="hidden" value="snort_interfaces_suppress_edit" />
- <input name="dbTable" type="hidden" value="SnortSuppress" />
- <input name="date" type="hidden" value="<?=$a_list['date'];?>" />
- <input name="uuid" type="hidden" value="<?=$a_list['uuid'];?>" />
+ <!-- table point -->
+ <input name="snortSaveSuppresslist" type="hidden" value="1" />
+ <input name="ifaceTab" type="hidden" value="snort_interfaces_suppress_edit" />
+ <input type="hidden" name="dbName" value="snortDB" /> <!-- what db -->
+ <input type="hidden" name="dbTable" value="SnortSuppress" /> <!-- what db table -->
+ <input name="date" type="hidden" value="<?=$a_list['date'];?>" />
+ <input name="uuid" type="hidden" value="<?=$a_list['uuid'];?>" />
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
diff --git a/config/snort-dev/snort_interfaces_whitelist_edit.php b/config/snort-dev/snort_interfaces_whitelist_edit.php
index eb6d2edb..0e426159 100644
--- a/config/snort-dev/snort_interfaces_whitelist_edit.php
+++ b/config/snort-dev/snort_interfaces_whitelist_edit.php
@@ -143,11 +143,12 @@ $vpnips_on = ($vpnips_chk == 'on' ? 'checked' : '');
<!-- START MAIN AREA -->
<!-- table point -->
- <input name="snortSaveWhitelist" type="hidden" value="1" />
- <input name="ifaceTab" type="hidden" value="snort_interfaces_whitelist_edit" />
- <input name="dbTable" type="hidden" value="SnortWhitelist" />
- <input name="date" type="hidden" value="<?=$a_list['date'];?>" />
- <input name="uuid" type="hidden" value="<?=$a_list['uuid'];?>" />
+ <input name="snortSaveWhitelist" type="hidden" value="1" />
+ <input name="ifaceTab" type="hidden" value="snort_interfaces_whitelist_edit" />
+ <input type="hidden" name="dbName" value="snortDB" /> <!-- what db -->
+ <input type="hidden" name="dbTable" value="SnortWhitelist" /> <!-- what db table -->
+ <input name="date" type="hidden" value="<?=$a_list['date'];?>" />
+ <input name="uuid" type="hidden" value="<?=$a_list['uuid'];?>" />
<tr>
<td colspan="2" valign="top" class="listtopic">Add the name and description of the file.</td>
diff --git a/config/snort-dev/snort_json_post.php b/config/snort-dev/snort_json_post.php
index 6ae100b1..8aa5b8ea 100644
--- a/config/snort-dev/snort_json_post.php
+++ b/config/snort-dev/snort_json_post.php
@@ -65,8 +65,9 @@ if ($_POST['RMlistDelRow'] == 1)
// general settings save
if ($_POST['snortSaveSettings'] == 1)
{
-
- if ($_POST['dbTable'] == 'SnortSettings')
+
+ // Save general settings
+ if ($_POST['dbTable'] == 'SnortSettings')
{
if ($_POST['ifaceTab'] == 'snort_interfaces_global')
@@ -76,13 +77,18 @@ if ($_POST['snortSaveSettings'] == 1)
}
- if ($_POST['ifaceTab'] == 'snort_alerts_blocked')
+ if ($_POST['ifaceTab'] == 'snort_alerts')
{
- if (isset($_POST['alertnumber']))
- $_POST['arefresh'] = ($_POST['arefresh'] == '' ? off : $_POST['arefresh']);
+ if (!isset($_POST['arefresh']))
+ $_POST['arefresh'] = ($_POST['arefresh'] == '' ? off : $_POST['arefresh']);
+
+ }
+
+ if ($_POST['ifaceTab'] == 'snort_blocked')
+ {
- if (isset($_POST['blertnumber']))
+ if (!isset($_POST['brefresh']))
$_POST['brefresh'] = ($_POST['brefresh'] == '' ? off : $_POST['brefresh']);
}
@@ -99,14 +105,64 @@ if ($_POST['snortSaveSettings'] == 1)
//return true;
conf_mount_rw();
- snortSql_updateSettings($_POST, 'id', '1');
+ snortSql_updateSettings($_POST['dbName'], $_POST, 'id', '1');
conf_mount_ro();
} // end of dbTable SnortSettings
-
+
+ // Save rules settings
+ if ($_POST['dbTable'] == 'Snortrules')
+ {
+
+ if ($_POST['ifaceTab'] == 'snort_interfaces_edit')
+ {
+
+ if (!isset($_POST['enable']))
+ $_POST['enable'] = ($_POST['enable'] == '' ? off : $_POST['enable']);
+
+ if (!isset($_POST['blockoffenders7']))
+ $_POST['blockoffenders7'] = ($_POST['blockoffenders7'] == '' ? off : $_POST['blockoffenders7']);
+
+ if (!isset($_POST['alertsystemlog']))
+ $_POST['alertsystemlog'] = ($_POST['alertsystemlog'] == '' ? off : $_POST['alertsystemlog']);
+
+ if (!isset($_POST['tcpdumplog']))
+ $_POST['tcpdumplog'] = ($_POST['tcpdumplog'] == '' ? off : $_POST['tcpdumplog']);
+
+ if (!isset($_POST['snortunifiedlog']))
+ $_POST['snortunifiedlog'] = ($_POST['snortunifiedlog'] == '' ? off : $_POST['snortunifiedlog']);
+
+ // convert textbox to base64
+ $_POST['configpassthru'] = base64_encode($_POST['configpassthru']);
+
+ }
+
+ // unhide tabs Json
+ if ($_POST['ifaceTab'] == 'snort_interfaces_edit')
+ {
+ $snortUnhideTabs = ', "snortUnhideTabs": "true"';
+ }
+
+ // unset POSTs that are markers not in db
+ unset($_POST['snortSaveSettings']);
+ unset($_POST['ifaceTab']);
+
+ // update date on every save
+ $_POST['date'] = date(U);
+
+
+ //print_r($_POST);
+ //return true;
+
+ conf_mount_rw();
+ snortSql_updateSettings($_POST['dbName'], $_POST, 'uuid', $_POST['uuid']);
+ conf_mount_ro();
+
+ } // end of dbTable Snortrules
+
echo '
{
- "snortgeneralsettings": "success"
+ "snortgeneralsettings": "success"' . $snortUnhideTabs . '
}
';
return true;
@@ -136,7 +192,7 @@ if ($_POST['snortSaveSuppresslist'] == 1)
$_POST['suppresspassthru'] = base64_encode($_POST['suppresspassthru']);
//conf_mount_rw();
- snortSql_updateSettings($_POST, 'uuid', $_POST['uuid']);
+ snortSql_updateSettings($_POST['dbName'], $_POST, 'uuid', $_POST['uuid']);
//conf_mount_ro();
echo '
@@ -181,8 +237,11 @@ if ($_POST['snortSaveWhitelist'] == 1)
$genSettings['date'] = date(U);
+ //print_r($_POST);
+ //return true;
+
//conf_mount_rw();
- snortSql_updateSettings($genSettings, 'uuid', $genSettings['uuid']);
+ snortSql_updateSettings($_POST['dbName'], $genSettings, 'uuid', $genSettings['uuid']);
if ($_POST['list'] != '')
{
snortSql_updateWhitelistIps($_POST['dbTable'], $_POST['list'], $genSettings['filename']);
diff --git a/config/snort-dev/snort_new.inc b/config/snort-dev/snort_new.inc
index 5530a854..b16ec6fc 100644
--- a/config/snort-dev/snort_new.inc
+++ b/config/snort-dev/snort_new.inc
@@ -78,13 +78,14 @@ function snortSql_fetchAllSettingsList($table, $listFilename)
}
// Update settings to database
-function snortSql_updateSettings($settings, $type, $id_uuid) {
+function snortSql_updateSettings($dbname, $settings, $type, $id_uuid) {
- $db = '/usr/local/pkg/snort/snortDB';
+ $db = "/usr/local/pkg/snort/$dbname";
$mydb = sqlite_open("$db");
$table = $settings['dbTable'];
// unset POSTs that are markers not in db
+ unset($settings['dbName']);
unset($settings['dbTable']);
// START add new row if not set
@@ -176,7 +177,7 @@ function snortSql_fetchAllWhitelistTypes($table, $table2)
$result = sqlite_query($db,
- "SELECT description, filename, uuid, id FROM {$table} where id > 0;
+ "SELECT * FROM {$table} where id > 0;
");
$chktable = sqlite_fetch_all($result, SQLITE_ASSOC);
@@ -204,6 +205,8 @@ function snortSql_fetchAllWhitelistTypes($table, $table2)
$final2['uuid'] = $value['uuid'];
$final2['filename'] = $value['filename'];
$final2['description'] = $value['description'];
+ $final2['snortlisttype'] = $value['snortlisttype'];
+
$final2['list'] = $chktable2;
diff --git a/config/snort-dev/testing.php b/config/snort-dev/testing.php
index 20411304..f36a9edd 100644
--- a/config/snort-dev/testing.php
+++ b/config/snort-dev/testing.php
@@ -1,52 +1,26 @@
<?php
-//require_once("/usr/local/pkg/snort/snort_new.inc");
-
-
-// fetch db Settings NONE Json
-function snortSql_fetchAllSettings($dbrule, $table, $type, $id_uuid)
-{
-
- if ($table == '')
- {
- return false;
- }
-
- $db = sqlite_open("/usr/local/pkg/snort/$dbrule");
-
- if ($type == 'id')
- {
- $result = sqlite_query($db,
- "SELECT * FROM {$table} where id = '{$id_uuid}';
- ");
- }
-
- if ($type == 'uuid')
- {
- $result = sqlite_query($db,
- "SELECT * FROM {$table} where uuid = '{$id_uuid}';
- ");
- }
-
- $chktable = sqlite_fetch_array($result, SQLITE_ASSOC);
-
- sqlite_close($db);
-
- return $chktable;
-
-
-} // end func
-
-
-
-$generalSettings = snortSql_fetchAllSettings('snortDB', 'SnortWhitelist', 'uuid', '2565656');
+require_once("/usr/local/pkg/snort/snort_new.inc");
+
+// set page vars
+
+$a_whitelist = snortSql_fetchAllWhitelistTypes('SnortWhitelist', 'SnortWhitelistips');
+
+$a_suppresslist = snortSql_fetchAllWhitelistTypes('SnortSuppress', '');
+
+//$a_whitelist = snortSql_fetchAllSettings('snortDBrules', 'Snortrules', 'uuid', '42770');
echo '<pre>' . "\n\n";
- print_r($generalSettings);
+ print_r($a_suppresst);
+
+ //foreach ($a_whitelist as $value)
+ //{
+ //echo $value['filename'] . "\n";
+ //}
echo "\n" . '</pre>';
-
+
?>
diff --git a/config/snort/snort_interfaces_edit.php b/config/snort/snort_interfaces_edit.php
index 6b3b3a55..5ac9c186 100644
--- a/config/snort/snort_interfaces_edit.php
+++ b/config/snort/snort_interfaces_edit.php
@@ -428,7 +428,6 @@ echo "
document.iform.performance.disabled = endis;
document.iform.blockoffenders7.disabled = endis;
document.iform.alertsystemlog.disabled = endis;
- document.iform.whitelistname.disabled = endis;
document.iform.externallistname.disabled = endis;
document.iform.homelistname.disabled = endis;
document.iform.suppresslistname.disabled = endis;