From a42356458f46215de8718088c2f9143294532bca Mon Sep 17 00:00:00 2001 From: Ermal Date: Mon, 16 Jul 2012 08:43:35 +0000 Subject: Force use of aliases from pfSense for replacing snort var settings. Also make snort var settings generic and overridable in all of its definitions --- config/snort/snort_interfaces_whitelist_edit.php | 156 ++++++----------------- 1 file changed, 37 insertions(+), 119 deletions(-) (limited to 'config/snort/snort_interfaces_whitelist_edit.php') diff --git a/config/snort/snort_interfaces_whitelist_edit.php b/config/snort/snort_interfaces_whitelist_edit.php index aa6ca238..c86f60d3 100644 --- a/config/snort/snort_interfaces_whitelist_edit.php +++ b/config/snort/snort_interfaces_whitelist_edit.php @@ -85,8 +85,6 @@ if (isset($id) && $a_whitelist[$id]) { $pconfig['wandnsips'] = $a_whitelist[$id]['wandnsips']; $pconfig['vips'] = $a_whitelist[$id]['vips']; $pconfig['vpnips'] = $a_whitelist[$id]['vpnips']; - $addresses = explode(' ', $pconfig['address']); - $address = explode(" ", $addresses[0]); } if ($_POST['submit']) { @@ -103,13 +101,8 @@ if ($_POST['submit']) { 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."; - } + 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_whitelist as $w_list) { @@ -122,33 +115,9 @@ if ($_POST['submit']) { } } - $isfirst = 0; - $address = ""; - $final_address_details .= ""; - /* add another entry code */ - for($x=0; $x<499; $x++) { - if (!empty($_POST["address{$x}"])) { - if ($is_first > 0) - $address .= " "; - $address .= $_POST["address{$x}"]; - if ($_POST["address_subnet{$x}"] <> "") - $address .= "" . $_POST["address_subnet{$x}"]; - - /* Compress in details to a single key, data separated by pipes. - Pulling details here lets us only pull in details for valid - address entries, saving us from having to track which ones to - process later. */ - $final_address_detail = mb_convert_encoding($_POST["detail{$x}"],'HTML-ENTITIES','auto'); - if ($final_address_detail <> "") - $final_address_details .= $final_address_detail; - else { - $final_address_details .= "Entry added" . " "; - $final_address_details .= date('r'); - } - $final_address_details .= "||"; - $is_first++; - } - } + if ($_POST['address']) + if (!is_alias($_POST['address'])) + $input_errors[] = "A valid alias need to be provided"; if (!$input_errors) { $w_list = array(); @@ -161,7 +130,7 @@ if ($_POST['submit']) { $w_list['vips'] = $_POST['vips']? 'yes' : 'no'; $w_list['vpnips'] = $_POST['vpnips']? 'yes' : 'no'; - $w_list['address'] = $address; + $w_list['address'] = $_POST['address']; $w_list['descr'] = mb_convert_encoding($_POST['descr'],"HTML-ENTITIES","auto"); $w_list['detail'] = $final_address_details; @@ -177,12 +146,7 @@ if ($_POST['submit']) { header("Location: /snort/snort_interfaces_whitelist.php"); exit; - } else { - $pconfig['descr'] = mb_convert_encoding($_POST['descr'],"HTML-ENTITIES","auto"); - $pconfig['address'] = $address; - $pconfig['detail'] = $final_address_details; } - } $pgtitle = "Services: Snort: Whitelist: Edit $whitelist_uuid"; @@ -193,27 +157,15 @@ include_once("head.inc"); - - - - -' . $pgtitle . '

';} if ($input_errors) print_input_errors($input_errors); if ($savemsg) print_info_box($savemsg); ?> - + +
+ + @@ -350,17 +252,33 @@ if ($savemsg)
@@ -282,61 +234,11 @@ if ($savemsg)
-
IP or CIDR items
+
Alias of IP's
- - - - - - - - - - - ""): - $item = explode(" ", $address); - $item3 = explode("||", $pconfig['detail']); - foreach($item as $ww): - $address = $item[$counter]; - $item4 = $item3[$counter]; - ?> - - - - - - - -
-
For WHITELIST's enter ONLY - IPs not CIDRs. Example: 192.168.4.1
-
- For NETLIST's you may enter IPs and - CIDRs. Example: 192.168.4.1 or 192.168.4.0/24
-
-
IP or CIDR
-
-
Add a Description or leave blank and a date - will be added.
-
- "; ?> -
-
 
- + var addressarray=new Array(); +function createAutoSuggest() { + +} + +setTimeout("createAutoSuggest();", 500); + + -- cgit v1.2.3