aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobiscool <robrob2626@yahoo.com>2010-04-27 23:15:56 -0700
committerrobiscool <robrob2626@yahoo.com>2010-04-27 23:16:44 -0700
commit20ded7753eba0d96560e715a0b07c38e6dbf8a07 (patch)
treed6e51be135db4c1f9ce79a296360f2037f64bb2d
parent0e246330ee7178450c588901a4ae362c6e21aa9e (diff)
downloadpfsense-packages-20ded7753eba0d96560e715a0b07c38e6dbf8a07.tar.gz
pfsense-packages-20ded7753eba0d96560e715a0b07c38e6dbf8a07.tar.bz2
pfsense-packages-20ded7753eba0d96560e715a0b07c38e6dbf8a07.zip
snort, add suppress tab, fix javascript on pfsense 2.0
-rw-r--r--config/snort/javascript/row_helper.js69
-rw-r--r--config/snort/snort.inc119
-rw-r--r--config/snort/snort.xml10
-rw-r--r--config/snort/snort_alerts.php1
-rw-r--r--config/snort/snort_barnyard.php2
-rw-r--r--config/snort/snort_blocked.php1
-rw-r--r--config/snort/snort_define_servers.php2
-rw-r--r--config/snort/snort_download_rules.php2
-rw-r--r--config/snort/snort_help_info.php1
-rw-r--r--config/snort/snort_interfaces.php3
-rw-r--r--config/snort/snort_interfaces_edit.php70
-rw-r--r--config/snort/snort_interfaces_global.php1
-rw-r--r--config/snort/snort_interfaces_suppress.php170
-rw-r--r--config/snort/snort_interfaces_suppress_edit.php324
-rw-r--r--config/snort/snort_interfaces_whitelist.php9
-rw-r--r--config/snort/snort_interfaces_whitelist_edit.php78
-rw-r--r--config/snort/snort_preprocessors.php2
17 files changed, 818 insertions, 46 deletions
diff --git a/config/snort/javascript/row_helper.js b/config/snort/javascript/row_helper.js
new file mode 100644
index 00000000..aaf6df37
--- /dev/null
+++ b/config/snort/javascript/row_helper.js
@@ -0,0 +1,69 @@
+// Global Variables
+var rowname = new Array(99);
+var rowtype = new Array(99);
+var newrow = new Array(99);
+var rowsize = new Array(99);
+
+for (i = 0; i < 99; i++) {
+ rowname[i] = '';
+ rowtype[i] = '';
+ newrow[i] = '';
+ rowsize[i] = '25';
+}
+
+var field_counter_js = 0;
+var loaded = 0;
+var is_streaming_progress_bar = 0;
+var temp_streaming_text = "";
+
+var addRowTo = (function() {
+ return (function (tableId) {
+ var d, tbody, tr, td, bgc, i, ii, j;
+ d = document;
+ tbody = d.getElementById(tableId).getElementsByTagName("tbody").item(0);
+ tr = d.createElement("tr");
+ totalrows++;
+ for (i = 0; i < field_counter_js; i++) {
+ td = d.createElement("td");
+ if(rowtype[i] == 'textbox') {
+ td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input size='" + rowsize[i] + "' name='" + rowname[i] + totalrows + "'></input> ";
+ } else if(rowtype[i] == 'select') {
+ td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><select size='" + rowsize[i] + "' name='" + rowname[i] + totalrows + "'><option value=\"32\" selected>32</option><option value=\"31\" >31</option><option value=\"30\" >30</option><option value=\"29\" >29</option><option value=\"28\" >28</option><option value=\"27\" >27</option><option value=\"26\" >26</option><option value=\"25\" >25</option><option value=\"24\" >24</option><option value=\"23\" >23</option><option value=\"22\" >22</option><option value=\"21\" >21</option><option value=\"20\" >20</option><option value=\"19\" >19</option><option value=\"18\" >18</option><option value=\"17\" >17</option><option value=\"16\" >16</option><option value=\"15\" >15</option><option value=\"14\" >14</option><option value=\"13\" >13</option><option value=\"12\" >12</option><option value=\"11\" >11</option><option value=\"10\" >10</option><option value=\"9\" >9</option><option value=\"8\" >8</option><option value=\"7\" >7</option><option value=\"6\" >6</option><option value=\"5\" >5</option><option value=\"4\" >4</option><option value=\"3\" >3</option><option value=\"2\" >2</option><option value=\"1\" >1</option></select> ";
+ } else {
+ td.innerHTML="<INPUT type='hidden' value='" + totalrows +"' name='" + rowname[i] + "_row-" + totalrows + "'></input><input type='checkbox' name='" + rowname[i] + totalrows + "'></input> ";
+ }
+ tr.appendChild(td);
+ }
+ td = d.createElement("td");
+ td.rowSpan = "1";
+
+ td.innerHTML = '<input type="image" src="/themes/' + theme + '/images/icons/icon_x.gif" onclick="removeRow(this); return false;" value="Delete">';
+ tr.appendChild(td);
+ tbody.appendChild(tr);
+ });
+})();
+
+function removeRow(el) {
+ var cel;
+ while (el && el.nodeName.toLowerCase() != "tr")
+ el = el.parentNode;
+
+ if (el && el.parentNode) {
+ cel = el.getElementsByTagName("td").item(0);
+ el.parentNode.removeChild(el);
+ }
+}
+
+function find_unique_field_name(field_name) {
+ // loop through field_name and strip off -NUMBER
+ var last_found_dash = 0;
+ for (var i = 0; i < field_name.length; i++) {
+ // is this a dash, if so, update
+ // last_found_dash
+ if (field_name.substr(i,1) == "-" )
+ last_found_dash = i;
+ }
+ if (last_found_dash < 1)
+ return field_name;
+ return(field_name.substr(0,last_found_dash));
+}
diff --git a/config/snort/snort.inc b/config/snort/snort.inc
index dbad74e8..ea5554cc 100644
--- a/config/snort/snort.inc
+++ b/config/snort/snort.inc
@@ -48,7 +48,7 @@ if ($pfsense_ver_chk == '1.2.3-RELEASE')
/* tell me my theme */
$pfsense_theme_is = $config['theme'];
-/* func builds custom whitelests */
+/* func builds custom white lists */
function find_whitelist_key($find_wlist_number) {
global $config, $g;
@@ -63,6 +63,21 @@ function find_whitelist_key($find_wlist_number) {
}
}
+/* func builds custom suppress lists */
+function find_suppress_key($find_slist_number) {
+ global $config, $g;
+
+ $suppresslist_array = $config['installedpackages']['snortglobal']['suppress']['item'];
+ $s_key = -1;
+
+ foreach ($suppresslist_array as $value2) {
+ $s_key += 1;
+ if ($config['installedpackages']['snortglobal']['suppress']['item'][$s_key]['uuid'] == $find_slist_number) {
+ return $s_key;
+ }
+ }
+}
+
/* func builds custom whitelests */
function build_base_whitelist($build_netlist, $wanip, $wangw, $wandns, $vips, $vpns, $userwips) {
global $config, $g;
@@ -599,6 +614,7 @@ function snort_postinstall()
exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort/javascript/mootools.js');
exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort/javascript/sortableTable.js');
exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort/javascript/tabs.js');
+ exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort/javascript/row_helper.js');
/* install barnyard2 for 2.0 and 1.2.3 */
chdir ("/usr/local/bin/");
@@ -944,18 +960,13 @@ function sync_snort_package()
exec('/usr/sbin/chown -R snort:snort /usr/local/lib/snort');
exec('/usr/sbin/chown snort:snort /tmp/snort*');
exec('/usr/sbin/chown snort:snort /var/db/whitelist');
- exec('/bin/chmod 770 /usr/local/lib/snort');
- exec('/bin/chmod 770 /var/log/snort');
- exec('/bin/chmod 770 /var/log/snort/run');
- exec('/bin/chmod 770 /var/log/snort/barnyard2');
- exec('/bin/chmod 660 /var/log/snort/alert');
- exec('/bin/chmod 660 /var/db/whitelist');
- exec('/bin/chmod -R 660 /usr/local/etc/snort/*');
- exec('/bin/chmod -R 660 /tmp/snort*');
- exec('/bin/chmod -R 660 /var/run/snort*');
- exec('/bin/chmod -R 660 /var/snort/run/*');
- exec('/bin/chmod 770 /usr/local/etc/snort/');
- exec('/bin/chmod 770 /usr/local/etc/whitelist/');
+
+ exec('/bin/chmod 770 /var/db/whitelist');
+ exec('/bin/chmod 770 /var/run/snort*');
+ exec('/bin/chmod 770 /tmp/snort*');
+ exec('/bin/chmod -R 770 /var/log/snort');
+ exec('/bin/chmod -R 770 /usr/local/lib/snort');
+ exec('/bin/chmod -R 770 /usr/local/etc/snort/');
conf_mount_ro();
}
@@ -997,6 +1008,11 @@ if ($id != '' && $if_real != '') //new
create_snort_whitelist($id, $if_real);
}
+ /* only build threshold when needed */
+ if ($config['installedpackages']['snortglobal']['rule'][$id]['suppresslistname'] != 'default'){
+ create_snort_suppress($id, $if_real);
+ }
+
/* create snort bootup file snort.sh only create once */
create_snort_sh();
@@ -1051,6 +1067,11 @@ function sync_snort_package_empty()
if ($config['installedpackages']['snortglobal']['rule'][$id]['blockoffenders7'] == 'on'){
create_snort_whitelist($id, $if_real);
}
+
+ /* only build threshold when needed */
+ if ($config['installedpackages']['snortglobal']['rule'][$id]['suppresslistname'] != 'default'){
+ create_snort_suppress($id, $if_real);
+ }
/* create barnyard2 configuration file */
$snortbarnyardlog_info_chk = $config['installedpackages']['snortglobal']['rule'][$id]['barnyard_enable'];
@@ -1106,7 +1127,12 @@ function sync_snort_package_config()
if ($config['installedpackages']['snortglobal']['rule'][$id]['blockoffenders7'] == 'on'){
create_snort_whitelist($id, $if_real);
}
-
+
+ /* only build threshold when needed */
+ if ($config['installedpackages']['snortglobal']['rule'][$id]['suppresslistname'] != 'default'){
+ create_snort_suppress($id, $if_real);
+ }
+
/* create barnyard2 configuration file */
$snortbarnyardlog_info_chk = $config['installedpackages']['snortglobal']['rule'][$id]['barnyard_enable'];
if ($snortbarnyardlog_info_chk == 'on')
@@ -1126,6 +1152,48 @@ function sync_snort_package_config()
/* Start of main config files */
/* Start of main config files */
+/* create threshold file */
+/* TODO: other func should mirror this code */
+function create_snort_suppress($id, $if_real) {
+
+ global $config, $g;
+ conf_mount_rw();
+
+ /* make sure dir is there */
+ if (!file_exists('/usr/local/etc/snort/suppress/')) {
+ exec('/bin/mkdir -p /usr/local/etc/snort/suppress/');
+ }
+
+ if ($config['installedpackages']['snortglobal']['rule'][$id]['suppresslistname'] != 'default') {
+
+ preg_match('/([0-9]+)$/', $config['installedpackages']['snortglobal']['rule'][$id]['suppresslistname'], $slist_num_wrt);
+
+ $whitelist_key_s = find_suppress_key($slist_num_wrt[0]);
+
+ /* file name */
+ $suppress_file_name = $config['installedpackages']['snortglobal']['suppress']['item'][$whitelist_key_s]['name'];
+
+ /* Message */
+ $s_data .= '# This file is auto generated by the snort package. Please do not edit this file by hand.' . "\n\n";
+
+ /* user added arguments */
+ $s_data .= str_replace("\r", "", base64_decode($config['installedpackages']['snortglobal']['suppress']['item'][$whitelist_key_s]['suppresspassthru']));
+
+ /* open snort's whitelist for writing */
+ $suppresslist_w = fopen("/usr/local/etc/snort/suppress/$suppress_file_name", "w");
+ if(!$suppresslist_w) {
+ log_error("Could not open /usr/local/etc/snort/suppress/$suppress_file_name for writing.");
+ return;
+ }
+
+ fwrite($suppresslist_w, $s_data);
+ fclose($suppresslist_w);
+ conf_mount_ro();
+
+ }
+
+}
+
function create_snort_whitelist($id, $if_real) {
global $config, $g;
@@ -1465,6 +1533,13 @@ function create_barnyard2_conf($id, $if_real, $snort_uuid) {
{
exec("/bin//usr/bin/touch /usr/local/etc/snort/snort_{$snort_uuid}_{$if_real}/barnyard2.conf");
}
+
+ if(!file_exists("/usr/local/etc/snort/snort_{$snort_uuid}_{$if_real}/barnyard2.waldo"))
+ {
+ exec("/bin//usr/bin/touch /usr/local/etc/snort/snort_{$snort_uuid}_{$if_real}/barnyard2.waldo");
+ exec("/usr/sbin/chown snort:snort /usr/local/etc/snort/snort_{$snort_uuid}_{$if_real}/barnyard2.waldo");
+ exec("/bin/chmod 770 /usr/local/etc/snort/snort_{$snort_uuid}_{$if_real}/barnyard2.waldo");
+ }
$barnyard2_conf_text = generate_barnyard2_conf($id, $if_real, $snort_uuid);
$bconf = fopen("/usr/local/etc/snort/snort_{$snort_uuid}_{$if_real}/barnyard2.conf", "w");
@@ -1752,7 +1827,7 @@ $snortunifiedlog_info_chk = $config['installedpackages']['snortglobal']['rule'][
if ($snortunifiedlog_info_chk == on)
$snortunifiedlog_type = "output unified2: filename snort_{$snort_uuid}_{$if_real}.u2, limit 128";
-/* define spoink (DISABLED)*/
+/* define spoink */
$spoink_info_chk = $config['installedpackages']['snortglobal']['rule'][$id]['blockoffenders7'];
if ($spoink_info_chk == on) {
@@ -1767,6 +1842,18 @@ if ($spoink_info_chk == on) {
$spoink_type = "output alert_pf: /usr/local/etc/snort/whitelist/$spoink_whitelist_name,snort2c";
}
+
+/* define threshold file */
+$threshold_info_chk = $config['installedpackages']['snortglobal']['rule'][$id]['suppresslistname'];
+if ($threshold_info_chk != 'default') {
+
+ preg_match('/^([a-zA-z0-9]+)/', $config['installedpackages']['snortglobal']['rule'][$id]['suppresslistname'], $slist_name_file2);
+
+ $threshold_name = $slist_name_file2[0];
+
+ $threshold_file_name = "include /usr/local/etc/snort/suppress/$threshold_name";
+
+}
/* define servers and ports snortdefservers */
/* def DNS_SERVSERS */
@@ -2499,7 +2586,7 @@ $spoink_type
include /usr/local/etc/snort/snort_{$snort_uuid}_{$if_real}/reference.config
include /usr/local/etc/snort/snort_{$snort_uuid}_{$if_real}/classification.config
-include /usr/local/etc/snort/snort_{$snort_uuid}_{$if_real}/threshold.conf
+$threshold_file_name
# Snort user pass through configuration
{$snort_config_pass_thru}
diff --git a/config/snort/snort.xml b/config/snort/snort.xml
index d2603aec..7bc4d63a 100644
--- a/config/snort/snort.xml
+++ b/config/snort/snort.xml
@@ -184,6 +184,16 @@
<item>http://www.pfsense.com/packages/config/snort/snort_interfaces_whitelist_edit.php</item>
</additional_files_needed>
<additional_files_needed>
+ <prefix>/usr/local/www/snort/</prefix>
+ <chmod>077</chmod>
+ <item>http://www.pfsense.com/packages/config/snort/snort_interfaces_suppress.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/snort/</prefix>
+ <chmod>077</chmod>
+ <item>http://www.pfsense.com/packages/config/snort/snort_interfaces_suppress_edit.phpp</item>
+ </additional_files_needed>
+ <additional_files_needed>
<prefix>/usr/local/etc/rc.d/</prefix>
<chmod>755</chmod>
<item>http://www.pfsense.com/packages/config/snort/snort.sh</item>
diff --git a/config/snort/snort_alerts.php b/config/snort/snort_alerts.php
index c135187a..c3f0a9dc 100644
--- a/config/snort/snort_alerts.php
+++ b/config/snort/snort_alerts.php
@@ -331,6 +331,7 @@ if ($pconfig['arefresh'] == 'on' || $pconfig['arefresh'] == '')
$tab_array[] = array("Alerts", true, "/snort/snort_alerts.php");
$tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
$tab_array[] = array("Whitelists", false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", false, "/snort/snort_interfaces_suppress.php");
$tab_array[] = array("Help", false, "/snort/snort_help_info.php");
display_top_tabs($tab_array);
?>
diff --git a/config/snort/snort_barnyard.php b/config/snort/snort_barnyard.php
index d88b354c..0c1920ac 100644
--- a/config/snort/snort_barnyard.php
+++ b/config/snort/snort_barnyard.php
@@ -113,6 +113,7 @@ if (isset($id) && $a_nat[$id]) {
$pconfig['whitelistname'] = $a_nat[$id]['whitelistname'];
$pconfig['homelistname'] = $a_nat[$id]['homelistname'];
$pconfig['externallistname'] = $a_nat[$id]['externallistname'];
+ $pconfig['suppresslistname'] = $a_nat[$id]['suppresslistname'];
$pconfig['performance'] = $a_nat[$id]['performance'];
$pconfig['blockoffenders7'] = $a_nat[$id]['blockoffenders7'];
$pconfig['alertsystemlog'] = $a_nat[$id]['alertsystemlog'];
@@ -233,6 +234,7 @@ $d_snortconfdirty_path = "/var/run/snort_conf_{$snort_uuid}_{$if_real}.dirty";
if ($pconfig['whitelistname'] != "") { $natent['whitelistname'] = $pconfig['whitelistname']; }
if ($pconfig['homelistname'] != "") { $natent['homelistname'] = $pconfig['homelistname']; }
if ($pconfig['externallistname'] != "") { $natent['externallistname'] = $pconfig['externallistname']; }
+ if ($pconfig['suppresslistname'] != "") { $natent['suppresslistname'] = $pconfig['suppresslistname']; }
/* post new options */
$natent['barnyard_enable'] = $_POST['barnyard_enable'] ? on : off;
diff --git a/config/snort/snort_blocked.php b/config/snort/snort_blocked.php
index e09e8928..2abe1d1d 100644
--- a/config/snort/snort_blocked.php
+++ b/config/snort/snort_blocked.php
@@ -260,6 +260,7 @@ if ($pconfig['brefresh'] == 'on' || $pconfig['brefresh'] == '')
$tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
$tab_array[] = array("Blocked", true, "/snort/snort_blocked.php");
$tab_array[] = array("Whitelists", false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", false, "/snort/snort_interfaces_suppress.php");
$tab_array[] = array("Help", false, "/snort/snort_help_info.php");
display_top_tabs($tab_array);
?>
diff --git a/config/snort/snort_define_servers.php b/config/snort/snort_define_servers.php
index 974f9cb4..8dfd0bd8 100644
--- a/config/snort/snort_define_servers.php
+++ b/config/snort/snort_define_servers.php
@@ -114,6 +114,7 @@ if (isset($id) && $a_nat[$id]) {
$pconfig['whitelistname'] = $a_nat[$id]['whitelistname'];
$pconfig['homelistname'] = $a_nat[$id]['homelistname'];
$pconfig['externallistname'] = $a_nat[$id]['externallistname'];
+ $pconfig['suppresslistname'] = $a_nat[$id]['suppresslistname'];
$pconfig['descr'] = $a_nat[$id]['descr'];
$pconfig['performance'] = $a_nat[$id]['performance'];
$pconfig['blockoffenders7'] = $a_nat[$id]['blockoffenders7'];
@@ -176,6 +177,7 @@ $d_snortconfdirty_path = "/var/run/snort_conf_{$snort_uuid}_{$if_real}.dirty";
if ($pconfig['whitelistname'] != "") { $natent['whitelistname'] = $pconfig['whitelistname']; }
if ($pconfig['homelistname'] != "") { $natent['homelistname'] = $pconfig['homelistname']; }
if ($pconfig['externallistname'] != "") { $natent['externallistname'] = $pconfig['externallistname']; }
+ if ($pconfig['suppresslistname'] != "") { $natent['suppresslistname'] = $pconfig['suppresslistname']; }
/* post new options */
diff --git a/config/snort/snort_download_rules.php b/config/snort/snort_download_rules.php
index f1970910..6ba3c5df 100644
--- a/config/snort/snort_download_rules.php
+++ b/config/snort/snort_download_rules.php
@@ -143,6 +143,7 @@ echo "<script src=\"/row_toggle.js\" type=\"text/javascript\"></script>\n
$tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
$tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
$tab_array[] = array("Whitelists", false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", false, "/snort/snort_interfaces_suppress.php");
$tab_array[] = array("Help", false, "/snort/snort_help_info.php");
display_top_tabs($tab_array);
@@ -268,6 +269,7 @@ setTimeout($.unblockUI, 2000);
$tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
$tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
$tab_array[] = array("Whitelists", false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", false, "/snort/snort_interfaces_suppress.php");
$tab_array[] = array("Help", false, "/snort/snort_help_info.php");
display_top_tabs($tab_array);
?>
diff --git a/config/snort/snort_help_info.php b/config/snort/snort_help_info.php
index 4c795b6d..62a15e06 100644
--- a/config/snort/snort_help_info.php
+++ b/config/snort/snort_help_info.php
@@ -87,6 +87,7 @@ clear: both;
$tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
$tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
$tab_array[] = array("Whitelists", false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", false, "/snort/snort_interfaces_suppress.php");
$tab_array[] = array("Help", true, "/snort/snort_help_info.php");
display_top_tabs($tab_array);
?>
diff --git a/config/snort/snort_interfaces.php b/config/snort/snort_interfaces.php
index eff63e5f..b644d567 100644
--- a/config/snort/snort_interfaces.php
+++ b/config/snort/snort_interfaces.php
@@ -241,7 +241,7 @@ if ($_GET['act'] == 'toggle' && $_GET['id'] != '')
-$pgtitle = "Services: Snort 2.8.5.3 pkg v. 1.22";
+$pgtitle = "Services: Snort 2.8.5.3 pkg v. 1.21";
include("head.inc");
?>
@@ -329,6 +329,7 @@ padding: 15px 10px 50% 50px;
$tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
$tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
$tab_array[] = array("Whitelists", false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", false, "/snort/snort_interfaces_suppress.php");
$tab_array[] = array("Help", false, "/snort/snort_help_info.php");
display_top_tabs($tab_array);
?>
diff --git a/config/snort/snort_interfaces_edit.php b/config/snort/snort_interfaces_edit.php
index 8cc97a75..aa87ed45 100644
--- a/config/snort/snort_interfaces_edit.php
+++ b/config/snort/snort_interfaces_edit.php
@@ -137,6 +137,7 @@ if (isset($id) && $a_nat[$id]) {
$pconfig['whitelistname'] = $a_nat[$id]['whitelistname'];
$pconfig['homelistname'] = $a_nat[$id]['homelistname'];
$pconfig['externallistname'] = $a_nat[$id]['externallistname'];
+ $pconfig['suppresslistname'] = $a_nat[$id]['suppresslistname'];
$pconfig['snortalertlogtype'] = $a_nat[$id]['snortalertlogtype'];
$pconfig['alertsystemlog'] = $a_nat[$id]['alertsystemlog'];
$pconfig['tcpdumplog'] = $a_nat[$id]['tcpdumplog'];
@@ -238,7 +239,8 @@ if ($_POST["Submit"]) {
if ($_POST['blockoffenders7'] == "on") { $natent['blockoffenders7'] = on; }else{ $natent['blockoffenders7'] = off; } if ($_POST['enable'] == "") { $natent['blockoffenders7'] = $pconfig['blockoffenders7']; }
$natent['whitelistname'] = $_POST['whitelistname'] ? $_POST['whitelistname'] : $pconfig['whitelistname'];
$natent['homelistname'] = $_POST['homelistname'] ? $_POST['homelistname'] : $pconfig['homelistname'];
- $natent['externallistname'] = $_POST['externallistname'] ? $_POST['externallistname'] : $pconfig['externallistname'];
+ $natent['externallistname'] = $_POST['externallistname'] ? $_POST['externallistname'] : $pconfig['externallistname'];
+ $natent['suppresslistname'] = $_POST['suppresslistname'] ? $_POST['suppresslistname'] : $pconfig['suppresslistname'];
$natent['snortalertlogtype'] = $_POST['snortalertlogtype'] ? $_POST['snortalertlogtype'] : $pconfig['snortalertlogtype'];
if ($_POST['alertsystemlog'] == "on") { $natent['alertsystemlog'] = on; }else{ $natent['alertsystemlog'] = off; } if ($_POST['enable'] == "") { $natent['alertsystemlog'] = $pconfig['alertsystemlog']; }
if ($_POST['tcpdumplog'] == "on") { $natent['tcpdumplog'] = on; }else{ $natent['tcpdumplog'] = off; } if ($_POST['enable'] == "") { $natent['tcpdumplog'] = $pconfig['tcpdumplog']; }
@@ -396,6 +398,11 @@ border-top:2px solid #DBAC48;
border-bottom:2px solid #DBAC48;
padding: 15px 10px 85% 50px;
}
+
+.formpre {
+font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
+font-size: 1.1em;
+}
</style>
<noscript><div class="alert" ALIGN=CENTER><img src="/themes/nervecenter/images/icons/icon_alert.gif"/><strong>Please enable JavaScript to view this content</strong></div></noscript>
<script language="JavaScript">
@@ -419,6 +426,10 @@ 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;
document.iform.tcpdumplog.disabled = endis;
document.iform.snortunifiedlog.disabled = endis;
document.iform.configpassthru.disabled = endis;
@@ -515,9 +526,12 @@ if ($a_nat[$id]['interface'] != '') {
<tr>
<td class="tabcont">
<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="vtable">&nbsp;</td>
- <td width="78%" class="vtable">
+ <td width="22%" valign="top" class="vncellreq">Interface</td>
+ <td width="22%" valign="top" class="vtable">&nbsp;
<?php
// <input name="enable" type="checkbox" value="yes" checked onClick="enable_change(false)">
// care with spaces
@@ -528,8 +542,9 @@ if ($a_nat[$id]['interface'] != '') {
echo "
<input name=\"enable\" type=\"checkbox\" value=\"on\" $checked $onclick_enable
- <strong>Enable Interface</strong></td>\n\n";
+ &nbsp;&nbsp;Enable or Disable</td>\n\n";
?>
+ </td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq">Interface</td>
@@ -570,6 +585,9 @@ if ($a_nat[$id]['interface'] != '') {
<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.<br>
</span></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="vncell">Home net</td>
<td width="78%" class="vtable">
@@ -605,7 +623,7 @@ if ($a_nat[$id]['interface'] != '') {
<tr>
<td width="22%" valign="top" class="vncell">External net</td>
<td width="78%" class="vtable">
- <select name="externallistname" class="formfld" id="externallistname">
+ <select name="externallistname" class="formfld" id="externallistname">
<?php
/* find whitelist names and filter by type */
$exlist_select = $config['installedpackages']['snortglobal']['whitelist']['item'];
@@ -671,6 +689,40 @@ if ($a_nat[$id]['interface'] != '') {
<span class="vexpl">Choose the whitelist you will like this rule to use.
</span>&nbsp;<span class="red">Note:</span>&nbsp;Default whitelist adds only local networks.</td>
</tr>
+
+ <tr>
+ <td width="22%" valign="top" class="vncell">Suppression and filtering</td>
+ <td width="78%" class="vtable">
+ <select name="suppresslistname" class="formfld" id="suppresslistname">
+ <?php
+ /* find whitelist names and filter by type, make sure to track by uuid */
+ $slist_select = $config['installedpackages']['snortglobal']['suppress']['item'];
+ $sid = -1;
+ if ($pconfig['suppresslistname'] == 'default'){ $selected = 'selected'; }
+ preg_match('/^([a-zA-z0-9]+)/', $pconfig['suppresslistname'], $slist_sub);
+ echo "<option value=\"default\" $selected>default</option>
+ ";
+ foreach ($slist_select as $value):
+ $sid += 1;
+ $ilistname = $config['installedpackages']['snortglobal']['suppress']['item'][$sid]['name'];
+ $suppress_uuid = $config['installedpackages']['snortglobal']['suppress']['item'][$sid]['uuid'];
+ if ($ilistname == $slist_sub[0]){
+ echo "<option value=\"$ilistname $suppress_uuid\" selected>";
+ }else{
+ echo "<option value=\"$ilistname $suppress_uuid\">";
+ }
+ echo htmlspecialchars($ilistname) . '</option>
+ ';
+ endforeach;
+ ?>
+ </select><br>
+ <span class="vexpl">Choose the suppression or filtering file you will like this rule to use.
+ </span>&nbsp;<span class="red">Note:</span>&nbsp;Default option disables suppression and filtering.</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="vncell">Send alerts to main System logs</td>
<td width="78%" class="vtable">
@@ -689,12 +741,14 @@ if ($a_nat[$id]['interface'] != '') {
<input name="snortunifiedlog" type="checkbox" value="on" <?php if ($pconfig['snortunifiedlog'] == "on") echo "checked"; ?> onClick="enable_change(false)"><br>
Snort will log Alerts to a file in the UNIFIED2 format. This is a requirement for barnyard2.</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="vncell">Advanced configuration pass through</td>
<td width="78%" class="vtable">
- <textarea name="configpassthru" cols="100" rows="7" id="configpassthru" class="formpre"><?=htmlspecialchars($pconfig['configpassthru']);?></textarea>
- <br>
- Arguments here will be automatically inserted into the running snort configuration.</td>
+ <textarea wrap="off" name="configpassthru" cols="75" rows="12" id="configpassthru" class="formpre2"><?=htmlspecialchars($pconfig['configpassthru']);?></textarea>
+ </td>
</tr>
<tr>
<td width="22%" valign="top"></td>
diff --git a/config/snort/snort_interfaces_global.php b/config/snort/snort_interfaces_global.php
index bad5efd1..29257bc7 100644
--- a/config/snort/snort_interfaces_global.php
+++ b/config/snort/snort_interfaces_global.php
@@ -257,6 +257,7 @@ include("head.inc");
$tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
$tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
$tab_array[] = array("Whitelists", false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", false, "/snort/snort_interfaces_suppress.php");
$tab_array[] = array("Help", false, "/snort/snort_help_info.php");
display_top_tabs($tab_array);
?> </td></tr>
diff --git a/config/snort/snort_interfaces_suppress.php b/config/snort/snort_interfaces_suppress.php
new file mode 100644
index 00000000..3f67cca8
--- /dev/null
+++ b/config/snort/snort_interfaces_suppress.php
@@ -0,0 +1,170 @@
+<?php
+/* $Id$ */
+/*
+ firewall_aliases.php
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originially part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+
+ modified for the pfsense snort package
+ Copyright (C) 2009-2010 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("guiconfig.inc");
+
+
+if (!is_array($config['installedpackages']['snortglobal']['suppress']['item']))
+ $config['installedpackages']['snortglobal']['suppress']['item'] = array();
+
+//aliases_sort(); << what ?
+$a_suppress = &$config['installedpackages']['snortglobal']['suppress']['item'];
+
+if (isset($config['installedpackages']['snortglobal']['suppress']['item'])) {
+$id_gen = count($config['installedpackages']['snortglobal']['suppress']['item']);
+}else{
+$id_gen = '0';
+}
+
+$d_suppresslistdirty_path = '/var/run/snort_suppress.dirty';
+
+if ($_POST) {
+
+ $pconfig = $_POST;
+
+ if ($_POST['apply']) {
+ $retval = 0;
+
+ if(stristr($retval, "error") <> true)
+ $savemsg = get_std_save_message($retval);
+ else
+ $savemsg = $retval;
+ if ($retval == 0) {
+ if (file_exists($d_suppresslistdirty_path))
+ unlink($d_suppresslistdirty_path);
+ }
+ }
+}
+
+if ($_GET['act'] == "del") {
+ if ($a_suppress[$_GET['id']]) {
+ /* make sure rule is not being referenced by any nat or filter rules */
+
+ unset($a_suppress[$_GET['id']]);
+ write_config();
+ filter_configure();
+ touch($d_suppresslistdirty_path);
+ header("Location: /snort/snort_interfaces_suppress.php");
+ exit;
+ }
+}
+
+$pgtitle = "Services: Snort: Suppression";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("./snort_fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<form action="/snort/snort_interfaces_suppress.php" method="post">
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<?php if (file_exists($d_suppresslistdirty_path)): ?><p>
+<?php print_info_box_np("The white list has been changed.<br>You must apply the changes in order for them to take effect.");?>
+<?php endif; ?>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[] = array("Snort Interfaces", false, "/snort/snort_interfaces.php");
+ $tab_array[] = array("Global Settings", false, "/snort/snort_interfaces_global.php");
+ $tab_array[] = array("Rule Updates", false, "/snort/snort_download_rules.php");
+ $tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
+ $tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
+ $tab_array[] = array("Whitelists", false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", true, "/snort/snort_interfaces_suppress.php");
+ $tab_array[] = array("Help", false, "/snort/snort_help_info.php");
+ display_top_tabs($tab_array);
+?> </td></tr>
+<tr>
+<td class="tabcont">
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+
+<tr>
+ <td width="30%" class="listhdrr">File Name</td>
+ <td width="70%" class="listhdr">Description</td>
+
+ <td width="10%" class="list">
+ </td>
+</tr>
+ <?php $i = 0; foreach ($a_suppress as $list): ?>
+<tr>
+ <td class="listlr" ondblclick="document.location='snort_interfaces_suppress_edit.php?id=<?=$i;?>';">
+ <?=htmlspecialchars($list['name']);?>
+ </td>
+ <td class="listbg" ondblclick="document.location='snort_interfaces_suppress_edit.php?id=<?=$i;?>';">
+ <font color="#FFFFFF">
+ <?=htmlspecialchars($list['descr']);?>&nbsp;
+ </td>
+
+ <td valign="middle" nowrap class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle"><a href="snort_interfaces_suppress_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="edit whitelist"></a></td>
+ <td><a href="/snort/snort_interfaces_whitelist.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this whitelist? All elements that still use it will become invalid (e.g. snort rules will fall back to the default whitelist)!')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="delete whitelist"></a></td>
+ </tr>
+ </table>
+ </td>
+</tr>
+ <?php $i++; endforeach; ?>
+<tr>
+ <td class="list" colspan="2"></td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle" width="17">&nbsp;</td>
+ <td valign="middle"><a href="snort_interfaces_suppress_edit.php?id=<?php echo $id_gen;?> "><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="add a new list"></a></td>
+ </tr>
+ </table>
+ </td>
+</tr>
+</table>
+ </td>
+ </tr>
+ </table>
+<br>
+<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+<td width="100%"><span class="vexpl"><span class="red"><strong>Note:</strong></span>
+ <p><span class="vexpl">Here you can create event filtering and suppression for your snort package rules.<br>Please note that you must restart a running rule so that changes can take effect.</span></p>
+</td>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/config/snort/snort_interfaces_suppress_edit.php b/config/snort/snort_interfaces_suppress_edit.php
new file mode 100644
index 00000000..5b9553f1
--- /dev/null
+++ b/config/snort/snort_interfaces_suppress_edit.php
@@ -0,0 +1,324 @@
+<?php
+/* $Id$ */
+/*
+ firewall_aliases_edit.php
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originially part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+
+ modified for the pfsense snort package
+ Copyright (C) 2009-2010 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.inc");
+require_once("/usr/local/pkg/snort/snort_gui.inc");
+
+if (!is_array($config['installedpackages']['snortglobal']['suppress']['item']))
+ $config['installedpackages']['snortglobal']['suppress']['item'] = array();
+
+$a_suppress = &$config['installedpackages']['snortglobal']['suppress']['item'];
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+
+/* gen uuid for each iface !inportant */
+if ($config['installedpackages']['snortglobal']['suppress']['item'][$id]['uuid'] == '') {
+ //$snort_uuid = gen_snort_uuid(strrev(uniqid(true)));
+$suppress_uuid = 0;
+while ($suppress_uuid > 65535 || $suppress_uuid == 0) {
+ $suppress_uuid = mt_rand(1, 65535);
+ $pconfig['uuid'] = $suppress_uuid;
+ }
+}
+
+if ($config['installedpackages']['snortglobal']['suppress']['item'][$id]['uuid'] != '') {
+ $suppress_uuid = $config['installedpackages']['snortglobal']['suppress']['item'][$id]['uuid'];
+}
+
+$pgtitle = "Services: Snort: Suppression: Edit $suppress_uuid";
+
+$d_snort_suppress_dirty_path = '/var/run/snort_suppress.dirty';
+
+/* returns true if $name is a valid name for a whitelist file name or ip */
+function is_validwhitelistname($name) {
+ if (!is_string($name))
+ return false;
+
+ if (!preg_match("/[^a-zA-Z0-9\.\/]/", $name))
+ return true;
+
+ return false;
+}
+
+
+if (isset($id) && $a_suppress[$id]) {
+
+ /* old settings */
+ $pconfig['name'] = $a_suppress[$id]['name'];
+ $pconfig['uuid'] = $a_suppress[$id]['uuid'];
+ $pconfig['descr'] = $a_suppress[$id]['descr'];
+ $pconfig['suppresspassthru'] = base64_decode($a_suppress[$id]['suppresspassthru']);
+
+
+
+}
+
+ /* this will exec when alert says apply */
+ if ($_POST['apply']) {
+
+ if (file_exists("$d_snort_suppress_dirty_path")) {
+
+ write_config();
+
+ sync_snort_package_config();
+ sync_snort_package();
+
+ unlink("$d_snort_suppress_dirty_path");
+
+ }
+
+ }
+
+if ($_POST['submit']) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if(strtolower($_POST['name']) == "defaultwhitelist")
+ $input_errors[] = "Whitelist file names may not be named defaultwhitelist.";
+
+ $x = is_validwhitelistname($_POST['name']);
+ if (!isset($x)) {
+ $input_errors[] = "Reserved word used for whitelist file name.";
+ } else {
+ if (is_validwhitelistname($_POST['name']) == false)
+ $input_errors[] = "Whitelist file name may only consist of the characters a-z, A-Z and 0-9 _. Note: No Spaces. Press Cancel to reset.";
+ }
+
+
+ /* check for name conflicts */
+ foreach ($a_suppress as $s_list) {
+ if (isset($id) && ($a_suppress[$id]) && ($a_suppress[$id] === $s_list))
+ continue;
+
+ if ($s_list['name'] == $_POST['name']) {
+ $input_errors[] = "A whitelist file name with this name already exists.";
+ break;
+ }
+ }
+
+
+ $s_list = array();
+ /* post user input */
+
+ if (!$input_errors) {
+
+ $s_list['name'] = $_POST['name'];
+ $s_list['uuid'] = $suppress_uuid;
+ $s_list['descr'] = mb_convert_encoding($_POST['descr'],"HTML-ENTITIES","auto");
+ $s_list['suppresspassthru'] = base64_encode($_POST['suppresspassthru']);
+
+
+ if (isset($id) && $a_suppress[$id])
+ $a_suppress[$id] = $s_list;
+ else
+ $a_suppress[] = $s_list;
+
+ touch($d_snort_suppress_dirty_path);
+
+ write_config();
+
+ header("Location: /snort/snort_interfaces_suppress_edit.php?id=$id");
+ exit;
+ }
+
+}
+
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
+
+<style type="text/css">
+.formpre {
+font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
+font-size: 1.1em;
+}
+</style>
+
+<?php
+ include("./snort_fbegin.inc");
+?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<div id="inputerrors"></div>
+
+<form action="/snort/snort_interfaces_suppress_edit.php?id=<?=$id?>" method="post" name="iform" id="iform">
+
+<?php
+ /* Display Alert message */
+ if ($input_errors) {
+ print_input_errors($input_errors); // TODO: add checks
+ }
+
+ if ($savemsg) {
+ print_info_box2($savemsg);
+ }
+
+ //if (file_exists($d_snortconfdirty_path)) {
+ if (file_exists($d_snort_suppress_dirty_path)) {
+ echo '<p>';
+
+ if($savemsg) {
+ print_info_box_np2("{$savemsg}");
+ }else{
+ print_info_box_np2('
+ The Snort configuration has changed and snort needs to be restarted on this interface.<br>
+ You must apply the changes in order for them to take effect.<br>
+ ');
+ }
+ }
+?>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[] = array("Snort Interfaces", false, "/snort/snort_interfaces.php");
+ $tab_array[] = array("Global Settings", false, "/snort/snort_interfaces_global.php");
+ $tab_array[] = array("Rule Updates", false, "/snort/snort_download_rules.php");
+ $tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
+ $tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
+ $tab_array[] = array("Whitelists", false, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", true, "/snort/snort_interfaces_suppress.php");
+ $tab_array[] = array("Help", false, "/snort/snort_help_info.php");
+ display_top_tabs($tab_array);
+?> </td></tr>
+<tr>
+<td class="tabcont">
+<table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Add the name and description of the file.</td>
+ </tr>
+<?php if(is_alias_inuse($pconfig['name']) == true): ?>
+ <tr>
+ <td valign="top" class="vncellreq">Name</td>
+ <td class="vtable"> <input name="name" type="hidden" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
+ <?php echo $pconfig['name']; ?>
+ <p>
+ <span class="vexpl">NOTE: This list is in use so the name may not be modified!</span>
+ </p>
+ </td>
+ </tr>
+<?php else: ?>
+ <tr>
+ <td valign="top" class="vncellreq">Name</td>
+ <td class="vtable">
+ <input name="name" type="text" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
+ <br />
+ <span class="vexpl">
+ The list name may only consist of the characters a-z, A-Z and 0-9. <span class="red">Note: </span> No Spaces.
+ </span>
+ </td>
+ </tr>
+<?php endif; ?>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Description</td>
+ <td width="78%" class="vtable">
+ <input name="descr" type="text" id="descr" size="40" value="<?=$pconfig['descr'];?>" />
+ <br />
+ <span class="vexpl">
+ You may enter a description here for your reference (not parsed).
+ </span>
+ </td>
+ </tr>
+</table>
+<table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <table height="32" width="100%">
+ <tr>
+ <td>
+ <div style='background-color:#E0E0E0' id='redbox'>
+ <table width='100%'>
+ <tr>
+ <td width='8%'>
+ &nbsp;&nbsp;&nbsp;<img style='vertical-align:middle' src="/snort/images/icon_excli.png" width="40" height="32">
+ </td>
+ <td width='70%'>
+ <font size="2" color='#FF850A'><b>NOTE:</b></font>
+ <font size="2" color='#000000'>&nbsp;&nbsp;The threshold keyword is deprecated as of version 2.8.5. Use the event_filter keyword instead.</font>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ <script type="text/javascript">
+ NiftyCheck();
+ Rounded("div#redbox","all","#FFF","#E0E0E0","smooth");
+ Rounded("td#blackbox","all","#FFF","#000000","smooth");
+ </script>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Apply suppression or filters to rules. Valid keywords are 'suppress', 'event_filter' and 'rate_filter'.</td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="vncell">
+ <b>Example 1;</b> suppress gen_id 1, sig_id 1852, track by_src, ip 10.1.1.54<br>
+ <b>Example 2;</b> event_filter gen_id 1, sig_id 1851, type limit, track by_src, count 1, seconds 60<br>
+ <b>Example 3;</b> rate_filter gen_id 135, sig_id 1, track by_src, count 100, seconds 1, new_action log, timeout 10
+ </td>
+ </tr>
+ <tr>
+ <td width="100%" class="vtable">
+ <textarea wrap="off" name="suppresspassthru" cols="142" rows="28" id="suppresspassthru" class="formpre"><?=htmlspecialchars($pconfig['suppresspassthru']);?></textarea>
+</td>
+ </tr>
+ <tr>
+ <td width="78%">
+ <input id="submit" name="submit" type="submit" class="formbtn" value="Save" />
+ <input id="cancelbutton" name="cancelbutton" type="button" class="formbtn" value="Cancel" onclick="history.back()" />
+ <?php if (isset($id) && $a_suppress[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </table>
+ </td>
+ </tr>
+ </table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html> \ No newline at end of file
diff --git a/config/snort/snort_interfaces_whitelist.php b/config/snort/snort_interfaces_whitelist.php
index c55e0352..87da2f57 100644
--- a/config/snort/snort_interfaces_whitelist.php
+++ b/config/snort/snort_interfaces_whitelist.php
@@ -107,6 +107,7 @@ include("head.inc");
$tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
$tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
$tab_array[] = array("Whitelists", true, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", false, "/snort/snort_interfaces_suppress.php");
$tab_array[] = array("Help", false, "/snort/snort_help_info.php");
display_top_tabs($tab_array);
?> </td></tr>
@@ -116,9 +117,9 @@ include("head.inc");
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
- <td width="25%" class="listhdrr">File Name</td>
- <td width="25%" class="listhdrr">Values</td>
- <td width="25%" class="listhdr">Description</td>
+ <td width="20%" class="listhdrr">File Name</td>
+ <td width="40%" class="listhdrr">Values</td>
+ <td width="40%" class="listhdr">Description</td>
<td width="10%" class="list">
</td>
</tr>
@@ -170,7 +171,7 @@ include("head.inc");
<br>
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<td width="100%"><span class="vexpl"><span class="red"><strong>Note:</strong></span>
- <p><span class="vexpl">Here you can create whitelist files for your snort package rules. Please add all the ips or networks you want to protect against snort block decisions. Remember that the default whitelist only includes local networks. Be careful, it is very easy to get locked out of you system.</span></p>
+ <p><span class="vexpl">Here you can create whitelist files for your snort package rules.<br>Please add all the ips or networks you want to protect against snort block decisions.<br>Remember that the default whitelist only includes local networks.<br>Be careful, it is very easy to get locked out of you system.</span></p>
</td>
</table>
</form>
diff --git a/config/snort/snort_interfaces_whitelist_edit.php b/config/snort/snort_interfaces_whitelist_edit.php
index 8fea1a65..ef96c429 100644
--- a/config/snort/snort_interfaces_whitelist_edit.php
+++ b/config/snort/snort_interfaces_whitelist_edit.php
@@ -35,7 +35,9 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-require("guiconfig.inc");
+require_once("guiconfig.inc");
+require_once("/usr/local/pkg/snort/snort.inc");
+require_once("/usr/local/pkg/snort/snort_gui.inc");
if (!is_array($config['installedpackages']['snortglobal']['whitelist']['item']))
$config['installedpackages']['snortglobal']['whitelist']['item'] = array();
@@ -101,7 +103,23 @@ if (isset($id) && $a_whitelist[$id]) {
$addresssubnettest = false;
}
-if ($_POST) {
+ /* this will exec when alert says apply */
+ if ($_POST['apply']) {
+
+ if (file_exists("$d_snort_whitelist_dirty_path")) {
+
+ write_config();
+
+ sync_snort_package_config();
+ sync_snort_package();
+
+ unlink("$d_snort_whitelist_dirty_path");
+
+ }
+
+ }
+
+if ($_POST['submit']) {
unset($input_errors);
$pconfig = $_POST;
@@ -219,17 +237,6 @@ if ($_POST) {
include("head.inc");
-
-
-
-$description_str = gettext("Description");
-$hosts_str = gettext("IP or CIDR items");
-$ip_str = gettext("IP");
-
-$update_freq_str = gettext("Update Freq.");
-
-
-
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
@@ -238,7 +245,7 @@ $update_freq_str = gettext("Update Freq.");
echo $jscriptstr;
?>
-<script type="text/javascript" src="../row_helper.js"></script>
+<script type="text/javascript" src="/snort/javascript/row_helper.js"></script>
<input type='hidden' name='address_type' value='textbox' />
<script type="text/javascript">
rowname[0] = "address";
@@ -257,6 +264,31 @@ $update_freq_str = gettext("Update Freq.");
<form action="snort_interfaces_whitelist_edit.php?id=<?=$id?>" method="post" name="iform" id="iform">
+<?php
+ /* Display Alert message */
+ if ($input_errors) {
+ print_input_errors($input_errors); // TODO: add checks
+ }
+
+ if ($savemsg) {
+ print_info_box2($savemsg);
+ }
+
+ //if (file_exists($d_snortconfdirty_path)) {
+ if (file_exists($d_snort_whitelist_dirty_path)) {
+ echo '<p>';
+
+ if($savemsg) {
+ print_info_box_np2("{$savemsg}");
+ }else{
+ print_info_box_np2('
+ The Snort configuration has changed and snort needs to be restarted on this interface.<br>
+ You must apply the changes in order for them to take effect.<br>
+ ');
+ }
+ }
+?>
+
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="tabnavtbl">
<?php
@@ -267,6 +299,7 @@ $update_freq_str = gettext("Update Freq.");
$tab_array[] = array("Alerts", false, "/snort/snort_alerts.php");
$tab_array[] = array("Blocked", false, "/snort/snort_blocked.php");
$tab_array[] = array("Whitelists", true, "/snort/snort_interfaces_whitelist.php");
+ $tab_array[] = array("Suppress", false, "/snort/snort_interfaces_suppress.php");
$tab_array[] = array("Help", false, "/snort/snort_help_info.php");
display_top_tabs($tab_array);
?> </td></tr>
@@ -276,6 +309,9 @@ $update_freq_str = gettext("Update Freq.");
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<?php if(is_alias_inuse($pconfig['name']) == true): ?>
<tr>
+ <td colspan="2" valign="top" class="listtopic">Add the name and description of the file.</td>
+ </tr>
+ <tr>
<td valign="top" class="vncellreq">Name</td>
<td class="vtable"> <input name="name" type="hidden" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
<?php echo $pconfig['name']; ?>
@@ -286,6 +322,9 @@ $update_freq_str = gettext("Update Freq.");
</tr>
<?php else: ?>
<tr>
+ <td colspan="2" valign="top" class="listtopic">Add the name and description of the file.</td>
+ </tr>
+ <tr>
<td valign="top" class="vncellreq">Name</td>
<td class="vtable">
<input name="name" type="text" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
@@ -321,6 +360,9 @@ $update_freq_str = gettext("Update Freq.");
<span class="vexpl">Choose the type of list you will like see in your Interface Edit Tab.&nbsp;Hint: Best pratice is to test every list you make.
</span>&nbsp;<span class="red">Note:</span>&nbsp;NETLIST's are only for defining snort.conf's external or home NETS.</td>
</tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Add auto generated ips.</td>
+ </tr>
<tr>
<td width="22%" valign="top" class="vncell">WAN IPs</td>
<td width="78%" class="vtable">
@@ -367,6 +409,9 @@ $update_freq_str = gettext("Update Freq.");
</td>
</tr>
<tr>
+ <td colspan="2" valign="top" class="listtopic">Add your own custom ips.</td>
+ </tr>
+ <tr>
<td width="22%" valign="top" class="vncellreq"><div id="addressnetworkport">IP or CIDR items</div></td>
<td width="78%" class="vtable">
<table id="maintable">
@@ -413,9 +458,8 @@ $update_freq_str = gettext("Update Freq.");
} // end foreach
?>
</tbody>
- </table>
- <a onclick="javascript:addRowTo('maintable'); typesel_change(); return false;" href="#">
- <img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="add another entry" />
+ </table>
+ <a onclick="javascript:addRowTo('maintable'); return false;" href="#"><img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="add another entry" />
</a>
</td>
</tr>
diff --git a/config/snort/snort_preprocessors.php b/config/snort/snort_preprocessors.php
index 5875ab70..a96c866a 100644
--- a/config/snort/snort_preprocessors.php
+++ b/config/snort/snort_preprocessors.php
@@ -107,6 +107,7 @@ if (isset($id) && $a_nat[$id]) {
$pconfig['whitelistname'] = $a_nat[$id]['whitelistname'];
$pconfig['homelistname'] = $a_nat[$id]['homelistname'];
$pconfig['externallistname'] = $a_nat[$id]['externallistname'];
+ $pconfig['suppresslistname'] = $a_nat[$id]['suppresslistname'];
$pconfig['performance'] = $a_nat[$id]['performance'];
$pconfig['blockoffenders7'] = $a_nat[$id]['blockoffenders7'];
$pconfig['alertsystemlog'] = $a_nat[$id]['alertsystemlog'];
@@ -208,6 +209,7 @@ $d_snortconfdirty_path = "/var/run/snort_conf_{$snort_uuid}_{$if_real}.dirty";
if ($pconfig['whitelistname'] != "") { $natent['whitelistname'] = $pconfig['whitelistname']; }
if ($pconfig['homelistname'] != "") { $natent['homelistname'] = $pconfig['homelistname']; }
if ($pconfig['externallistname'] != "") { $natent['externallistname'] = $pconfig['externallistname']; }
+ if ($pconfig['suppresslistname'] != "") { $natent['suppresslistname'] = $pconfig['suppresslistname']; }
/* post new options */