aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort/snort_rules.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-07-11 22:26:27 +0000
committerErmal <eri@pfsense.org>2012-07-11 22:27:00 +0000
commit29425cbf9722da360f5ab9d58b380a665e0c86e5 (patch)
tree9176443fcd29c5e59b173433f3e3157a643c13c3 /config/snort/snort_rules.php
parentdc541ec6cf6e12726f3c9a51156670d408275097 (diff)
downloadpfsense-packages-29425cbf9722da360f5ab9d58b380a665e0c86e5.tar.gz
pfsense-packages-29425cbf9722da360f5ab9d58b380a665e0c86e5.tar.bz2
pfsense-packages-29425cbf9722da360f5ab9d58b380a665e0c86e5.zip
Show only enabled categories on rules dropdown
Diffstat (limited to 'config/snort/snort_rules.php')
-rw-r--r--config/snort/snort_rules.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/config/snort/snort_rules.php b/config/snort/snort_rules.php
index 100134c7..5a13cf7b 100644
--- a/config/snort/snort_rules.php
+++ b/config/snort/snort_rules.php
@@ -65,9 +65,9 @@ if (!is_dir("{$snortdir}/snort_{$iface_uuid}_{$if_real}/rules"))
exec("/bin/mkdir -p {$snortdir}/snort_{$iface_uuid}_{$if_real}/rules");
$isrulesfolderempty = exec("ls -A {$snortdir}/snort_{$iface_uuid}_{$if_real}/rules/*.rules");
-if ($isrulesfolderempty == "") {
+if ($isrulesfolderempty == "" || empty($pconfig['rulesets'])) {
$isrulesfolderempty = exec("ls -A {$snortdir}/rules/*.rules");
- if ($isrulesfolderempty == "") {
+ if ($isrulesfolderempty == "" || empty($pconfig['rulesets'])) {
include_once("head.inc");
include_once("fbegin.inc");
@@ -96,7 +96,7 @@ if ($isrulesfolderempty == "") {
<table id=\"maintable\" class=\"tabcont\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n
<tr>\n
<td>\n
- # The rules directory is empty.\n
+ # The rules directory is empty or you have not selected any rules in the Categories tab.\n
</td>\n
</tr>\n
</table>\n
@@ -153,11 +153,12 @@ while (false !== ($filename = readdir($dh)))
$files[] = basename($filename);
}
sort($files);
+$categories = explode("||", $pconfig['rulesets']);
if ($_GET['openruleset'])
$rulefile = $_GET['openruleset'];
else
- $rulefile = $ruledir.$files[0];
+ $rulefile = $ruledir.$categories[0];
//Load the rule file
$splitcontents = load_rule_file($rulefile);
@@ -278,6 +279,8 @@ function popup(url)
<select id="selectbox" name="selectbox" class="formselect" onChange="go()">
<?php
foreach ($files as $value) {
+ if (!in_array($value, $categories))
+ continue;
echo "<option value='?id={$id}&openruleset={$ruledir}{$value}' ";
if ($value === $currentruleset)
echo "selected";
@@ -396,11 +399,6 @@ function popup(url)
</td>
</tr>
<tr>
- <td colspan="9" class="listlr">
- <?php echo " <strong><span class='red'>There are {$counter} rules in this category. <br/><br/></span></strong>"; ?>
- </td>
- </tr>
- <tr>
<td colspan="9">
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>