aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort/snort_rulesets.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-07-09 09:35:24 +0000
committerErmal <eri@pfsense.org>2012-07-09 09:35:24 +0000
commit40cace16a452cd841a6b3626c44ff0d0b655956f (patch)
tree0e9dbda2d0ad6c3996ca575a788c0c82adb872e7 /config/snort/snort_rulesets.php
parent27069169f67967c21cdcf38cef20fe81cfff9073 (diff)
downloadpfsense-packages-40cace16a452cd841a6b3626c44ff0d0b655956f.tar.gz
pfsense-packages-40cace16a452cd841a6b3626c44ff0d0b655956f.tar.bz2
pfsense-packages-40cace16a452cd841a6b3626c44ff0d0b655956f.zip
s//usr/local/etc/snort/snortdir/ to unify its reference and location. Trim some unused functions in the way
Diffstat (limited to 'config/snort/snort_rulesets.php')
-rw-r--r--config/snort/snort_rulesets.php41
1 files changed, 9 insertions, 32 deletions
diff --git a/config/snort/snort_rulesets.php b/config/snort/snort_rulesets.php
index 313daea2..ee700a88 100644
--- a/config/snort/snort_rulesets.php
+++ b/config/snort/snort_rulesets.php
@@ -33,7 +33,7 @@ require_once("guiconfig.inc");
require_once("/usr/local/pkg/snort/snort_gui.inc");
require_once("/usr/local/pkg/snort/snort.inc");
-global $g;
+global $g, $snortdir;
if (!is_array($config['installedpackages']['snortglobal']['rule'])) {
$config['installedpackages']['snortglobal']['rule'] = array();
@@ -64,9 +64,9 @@ $pgtitle = "Snort: Interface $id $iface_uuid $if_real Categories";
/* Check if the rules dir is empy if so warn the user */
/* TODO give the user the option to delete the installed rules rules */
-$isrulesfolderempty = exec("ls -A /usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules/*.rules");
+$isrulesfolderempty = exec("ls -A {$snortdir}/snort_{$iface_uuid}_{$if_real}/rules/*.rules");
if ($isrulesfolderempty == "") {
- $isrulesfolderempty = exec("ls -A /usr/local/etc/snort/rules/*.rules");
+ $isrulesfolderempty = exec("ls -A {$snortdir}/rules/*.rules");
if ($isrulesfolderempty == "") {
include_once("head.inc");
include("fbegin.inc");
@@ -105,7 +105,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. /usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules \n
+ # The rules directory is empty. {$snortdir}/snort_{$iface_uuid}_{$if_real}/rules \n
</td>\n
</tr>\n
</table>\n
@@ -127,7 +127,7 @@ if ($isrulesfolderempty == "") {
exit(0);
} else {
/* Make sure that we have the rules */
- mwexec("/bin/cp /usr/local/etc/snort/rules/*.rules /usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules", true);
+ mwexec("/bin/cp {$snortdir}/rules/*.rules {$snortdir}/snort_{$iface_uuid}_{$if_real}/rules", true);
}
}
@@ -167,19 +167,7 @@ include_once("head.inc");
<?php include("fbegin.inc"); ?>
<?if($pfsense_stable == 'yes'){echo '<p class="pgtitle">' . $pgtitle . '</p>';}?>
-<?php
-echo "{$snort_general_css}\n";
-?>
-
<div class="body2">
-
-<noscript>
-<div class="alert" ALIGN=CENTER><img
- src="../themes/<?php echo $g['theme']; ?>/images/icons/icon_alert.gif" /><strong>Please
-enable JavaScript to view this content
-</CENTER></div>
-</noscript>
-
<?php
echo "<form action=\"snort_rulesets.php?id={$id}\" method=\"post\" name=\"iform\" id=\"iform\">";
@@ -246,9 +234,8 @@ if (file_exists($d_snortconfdirty_path)) {
<td class="listhdrr"><?php if($snort_arch == 'x86'){echo 'Ruleset: Rules that end with "so.rules" are shared object rules.';}else{echo 'Shared object rules are "so.rules" and not available on 64 bit architectures.';}?></td>
<!-- <td class="listhdrr">Description</td> -->
</tr>
- <?php
- $dir = "/usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules/";
- $dh = opendir($dir);
+ <?php
+ $dh = opendir("{$snortdir}/snort_{$iface_uuid}_{$if_real}/rules/");
while (false !== ($filename = readdir($dh))) {
$files[] = basename($filename);
}
@@ -269,14 +256,10 @@ if (file_exists($d_snortconfdirty_path)) {
echo " \n<input type='checkbox' name='toenable[]' value='$file' {$CHECKED} />\n";
echo "</td>\n";
echo "<td>\n";
- echo "<a href='snort_rules.php?id={$id}&openruleset=/usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules/" . urlencode($file) . "'>{$file}</a>\n";
+ echo "<a href='snort_rules.php?id={$id}&openruleset={$snortdir}/snort_{$iface_uuid}_{$if_real}/rules/" . urlencode($file) . "'>{$file}</a>\n";
echo "</td>\n</tr>\n\n";
- //echo "<td>";
- //echo "description";
- //echo "</td>";
}
-
- ?>
+ ?>
</table>
</td>
</tr>
@@ -297,17 +280,11 @@ if (file_exists($d_snortconfdirty_path)) {
</td>
</tr>
</table>
-
</form>
-
<p><b>NOTE:</b> You can click on a ruleset name to edit the ruleset.</p>
-
</div>
-
<?php
include("fend.inc");
-echo $snort_custom_rnd_box;
?>
-
</body>
</html>