From 30b50ec9c75d210579a5321e01043e2f5ae7980d Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 31 May 2013 21:29:29 -0400 Subject: Correct misspelled word "enabling" in a caption. --- config/snort/snort_preprocessors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/snort') diff --git a/config/snort/snort_preprocessors.php b/config/snort/snort_preprocessors.php index b813e8bf..4c921ca4 100755 --- a/config/snort/snort_preprocessors.php +++ b/config/snort/snort_preprocessors.php @@ -754,7 +754,7 @@ include_once("head.inc"); " . gettext("Not Checked") . ""; ?>.
" . gettext("Warning: ") . "" . - gettext("Enabing this option could result in missed packets. Recommended setting is not checked."); ?> + gettext("Enabling this option could result in missed packets. Recommended setting is not checked."); ?> -- cgit v1.2.3 From dd0f9ed5d547c72ca78881b99785d7ac209afc1e Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 31 May 2013 21:30:19 -0400 Subject: Remove misplaced tag that was causing issues with some themes. --- config/snort/snort_download_updates.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'config/snort') diff --git a/config/snort/snort_download_updates.php b/config/snort/snort_download_updates.php index a397a7b0..124106ef 100755 --- a/config/snort/snort_download_updates.php +++ b/config/snort/snort_download_updates.php @@ -218,11 +218,10 @@ h += 96; cellpadding="5px" cellspacing="0"> -
-    - +
+ +   
@@ -236,8 +235,8 @@ h += 96; -
- + + -- cgit v1.2.3 From fc01f63f1d6cd4bc28b7d0b6604ce06e380306eb Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 31 May 2013 22:26:17 -0400 Subject: Tweak error message logging a bit for completeness. --- config/snort/snort_check_for_rule_updates.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'config/snort') diff --git a/config/snort/snort_check_for_rule_updates.php b/config/snort/snort_check_for_rule_updates.php index 3e3dd658..f08ebc18 100755 --- a/config/snort/snort_check_for_rule_updates.php +++ b/config/snort/snort_check_for_rule_updates.php @@ -122,6 +122,8 @@ function snort_download_file_url($url, $file_out) { $rc = curl_exec($ch); if ($rc === true) break; + log_error(gettext("[Snort] Rules download error: " . curl_error($ch))); + log_error(gettext("[Snort] Will retry in 15 seconds...")); sleep(15); } if ($rc === false) @@ -726,6 +728,10 @@ if ($snortdownload == 'on' || $emergingthreats == 'on' || $snortcommunityrules = log_error(gettext("[Snort] Snort has restarted with your new set of rules...")); error_log(gettext("\tSnort has restarted with your new set of rules.\n"), 3, $snort_rules_upd_log); } + else { + if ($pkg_interface <> "console") + update_output_window(gettext("The rules update task is complete...")); + } } if ($pkg_interface <> "console") -- cgit v1.2.3 From f3275720d210dd03486089b17c1ebcee850baf20 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 31 May 2013 22:26:50 -0400 Subject: Incorporate Ermal's comments from 2.5.8 pkg review. --- config/snort/snort.inc | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'config/snort') diff --git a/config/snort/snort.inc b/config/snort/snort.inc index fe390a41..cf36ca86 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -146,6 +146,8 @@ function snort_load_suppress_sigs($snortcfg) { $suppress = array(); + if (!is_array($config['installedpackages']['snortglobal'])) + return; if (!is_array($config['installedpackages']['snortglobal']['suppress'])) return; if (!is_array($config['installedpackages']['snortglobal']['suppress']['item'])) @@ -258,15 +260,7 @@ function snort_build_list($snortcfg, $listname = "", $whitelist = false) { /* Skip the WAN interface as we do not typically want that whole subnet */ /* whitelisted (just the interface IP itself). */ /*************************************************************************/ - if (function_exists('get_configured_interface_list')) - $int_array = get_configured_interface_list(); - else { - $int_array = array('wan', 'lan'); - for ($j = 1; isset ($config['interfaces']['opt' . $j]); $j++) { - if(isset($config['interfaces']['opt' . $j]['enable'])) - $int_array[] = "opt{$j}"; - } - } + $int_array = get_configured_interface_list(); foreach ($int_array as $int) { if ($int == "wan") continue; @@ -291,9 +285,6 @@ function snort_build_list($snortcfg, $listname = "", $whitelist = false) { } } - /* Grab the default gateway if set */ - $default_gw = exec("/sbin/route -n get default |grep 'gateway:' | /usr/bin/awk '{ print $2 }'"); - if ($wanip == 'yes') { $ip = get_interface_ip("wan"); if (is_ipaddr($ip)) { @@ -310,6 +301,8 @@ function snort_build_list($snortcfg, $listname = "", $whitelist = false) { } if ($wangw == 'yes') { + /* Grab the default gateway if set */ + $default_gw = exec("/sbin/route -n get default |grep 'gateway:' | /usr/bin/awk '{ print $2 }'"); if (is_ipaddr($default_gw) && !in_array($default_gw, $home_net)) $home_net[] = $default_gw; @@ -589,6 +582,7 @@ function snort_postinstall() { update_status(gettext("Saved settings detected...")); update_output_window(gettext("Please wait... rebuilding installation with saved settings...")); log_error(gettext("[Snort] Downloading and updating configured rule types...")); + update_output_window(gettext("Please wait... downloading and updating configured rule types...")); @include_once("/usr/local/pkg/snort/snort_check_for_rule_updates.php"); update_status(gettext("Generating snort.conf configuration file from saved settings...")); $rebuild_rules = "on"; @@ -600,7 +594,9 @@ function snort_postinstall() { /* Only try to start Snort if not in reboot */ if (!$g['booting']) { update_status(gettext("Starting Snort using rebuilt configuration...")); + update_output_window(gettext("Please wait... while Snort is started...")); log_error(gettext("[Snort] Starting Snort using rebuilt configuration...")); + update_output_window(gettext("Snort has been started using the rebuilt configuration...")); start_service("snort"); } } @@ -852,12 +848,13 @@ function sync_snort_package_config() { global $snort_version, $rebuild_rules, $is_postinstall; $snortdir = SNORTDIR; + $rcdir = RCFILEPREFIX; conf_mount_rw(); /* do not start config build if rules is empty or there are no Snort settings */ if (!is_array($config['installedpackages']['snortglobal']) || !is_array($config['installedpackages']['snortglobal']['rule'])) { - exec("/bin/rm /usr/local/etc/rc.d/snort.sh"); + @unlink("{$rcdir}/snort.sh"); conf_mount_ro(); return; } -- cgit v1.2.3 From 29f2bf96b8adcd91d20d96be182ac0911264da69 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 31 May 2013 22:54:32 -0400 Subject: Minor HTML code edits for styles and tag closure. --- config/snort/snort_download_rules.php | 2 +- config/snort/snort_download_updates.php | 29 +++++++++++------------------ config/snort/snort_rules_flowbits.php | 2 +- 3 files changed, 13 insertions(+), 20 deletions(-) (limited to 'config/snort') diff --git a/config/snort/snort_download_rules.php b/config/snort/snort_download_rules.php index e35eb983..562a6b36 100755 --- a/config/snort/snort_download_rules.php +++ b/config/snort/snort_download_rules.php @@ -49,7 +49,7 @@ include("head.inc"); -
+
diff --git a/config/snort/snort_download_updates.php b/config/snort/snort_download_updates.php index 124106ef..c6e24532 100755 --- a/config/snort/snort_download_updates.php +++ b/config/snort/snort_download_updates.php @@ -129,35 +129,31 @@ h += 96;

- +
-

-
+

SNORT.ORG  --> -   
+   
EMERGINGTHREATS.NET  --> -   
+   
SNORT GPLv2 COMMUNITY RULES  --> -   
+   


- +
-

-
+

' . gettext("Update Rules") . '

' . gettext("WARNING:") . '  ' . gettext('No rule types have been selected for download. ') . - gettext('Visit the ') . 'Global Settings Tab' . gettext(' to select rule types.') . '
'; + gettext('Visit the ') . 'Global Settings Tab' . gettext(' to select rule types.') . '
'; echo '

' . "\n"; } else { @@ -184,14 +180,12 @@ h += 96;

- +
-

-
+

- +
diff --git a/config/snort/snort_rules_flowbits.php b/config/snort/snort_rules_flowbits.php index 0b836813..215399c6 100644 --- a/config/snort/snort_rules_flowbits.php +++ b/config/snort/snort_rules_flowbits.php @@ -142,7 +142,7 @@ if ($savemsg) print_info_box($savemsg); ?>
-
+
- + -- cgit v1.2.3 From f6f9238c81a70f4a9f093b0695153bd92baeac78 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Sat, 1 Jun 2013 17:48:46 -0400 Subject: Add check to verify existence of array item before we use it. --- config/snort/snort_interfaces.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'config/snort') diff --git a/config/snort/snort_interfaces.php b/config/snort/snort_interfaces.php index ad492df2..390b83eb 100755 --- a/config/snort/snort_interfaces.php +++ b/config/snort/snort_interfaces.php @@ -35,6 +35,7 @@ require_once("/usr/local/pkg/snort/snort.inc"); global $g, $rebuild_rules; $snortdir = SNORTDIR; +$rcdir = RCFILEPREFIX; $id = $_GET['id']; if (isset($_POST['id'])) @@ -60,11 +61,14 @@ if (isset($_POST['del_x'])) { // If interface had auto-generated Suppress List, then // delete that along with the interface $autolist = "{$a_nat[$rulei]['interface']}" . "suppress"; - $a_suppress = &$config['installedpackages']['snortglobal']['suppress']['item']; - foreach ($a_suppress as $k => $i) { - if ($i['name'] == $autolist) { - unset($config['installedpackages']['snortglobal']['suppress']['item'][$k]); - break; + if (is_array($config['installedpackages']['snortglobal']['suppress']) && + is_array($config['installedpackages']['snortglobal']['suppress']['item'])) { + $a_suppress = &$config['installedpackages']['snortglobal']['suppress']['item']; + foreach ($a_suppress as $k => $i) { + if ($i['name'] == $autolist) { + unset($config['installedpackages']['snortglobal']['suppress']['item'][$k]); + break; + } } } @@ -85,7 +89,7 @@ if (isset($_POST['del_x'])) { snort_create_rc(); else { conf_mount_rw(); - @unlink('/usr/local/etc/rc.d/snort.sh'); + @unlink("{$rcdir}/snort.sh"); conf_mount_ro(); } -- cgit v1.2.3
-- cgit v1.2.3 From 9202d4eee77550b77d0c4828e95fdd077dd35dc1 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Sat, 1 Jun 2013 17:47:58 -0400 Subject: Add HTML markup to wrap IPv6 address in Alert and Blocked tabs. --- config/snort/snort_alerts.php | 4 ++++ config/snort/snort_blocked.php | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'config/snort') diff --git a/config/snort/snort_alerts.php b/config/snort/snort_alerts.php index 607fba54..8c42fa89 100755 --- a/config/snort/snort_alerts.php +++ b/config/snort/snort_alerts.php @@ -305,6 +305,8 @@ if (file_exists("/var/log/snort/snort_{$if_real}{$snort_uuid}/alert")) { $alert_proto = $fields[5]; /* IP SRC */ $alert_ip_src = $fields[6]; + /* Add zero-width space as soft-break opportunity after each colon if we have an IPv6 address */ + $alert_ip_src = str_replace(":", ":​", $alert_ip_src); if (isset($tmpblocked[$fields[6]])) { $alert_ip_src .= "
\"Remove"; @@ -313,6 +315,8 @@ if (file_exists("/var/log/snort/snort_{$if_real}{$snort_uuid}/alert")) { $alert_src_p = $fields[7]; /* IP Destination */ $alert_ip_dst = $fields[8]; + /* Add zero-width space as soft-break opportunity after each colon if we have an IPv6 address */ + $alert_ip_dst = str_replace(":", ":​", $alert_ip_dst); if (isset($tmpblocked[$fields[8]])) { $alert_ip_dst .= "
\"Remove"; diff --git a/config/snort/snort_blocked.php b/config/snort/snort_blocked.php index 5fb7e608..43b351ab 100644 --- a/config/snort/snort_blocked.php +++ b/config/snort/snort_blocked.php @@ -249,10 +249,13 @@ if ($pconfig['brefresh'] == 'on') else $counter++; + /* Add zero-width space as soft-break opportunity after each colon if we have an IPv6 address */ + $tmp_ip = str_replace(":", ":​", $blocked_ip); + /* use one echo to do the magic*/ echo "
{$counter}{$blocked_ip}{$tmp_ip} {$blocked_desc} \"Delete