aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort/snort_interfaces_edit.php
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2013-04-10 03:17:50 -0700
committerErmal Luçi <eri@pfsense.org>2013-04-10 03:17:50 -0700
commitd7873830add80f31d517523799a8b3166d12c772 (patch)
tree1071ec385fb25311096a5eeb0075593f276e468b /config/snort/snort_interfaces_edit.php
parentb5fb6bd18bce49d8155b270b6bb414cbf7e9c26d (diff)
parent31905aef52131b7067441f8f7902b343a4588f72 (diff)
downloadpfsense-packages-d7873830add80f31d517523799a8b3166d12c772.tar.gz
pfsense-packages-d7873830add80f31d517523799a8b3166d12c772.tar.bz2
pfsense-packages-d7873830add80f31d517523799a8b3166d12c772.zip
Merge pull request #423 from bmeeks8/master
Update Snort Package to ver 2.5.5 - New features and bug fixes
Diffstat (limited to 'config/snort/snort_interfaces_edit.php')
-rwxr-xr-xconfig/snort/snort_interfaces_edit.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/config/snort/snort_interfaces_edit.php b/config/snort/snort_interfaces_edit.php
index d0fabbf4..76763553 100755
--- a/config/snort/snort_interfaces_edit.php
+++ b/config/snort/snort_interfaces_edit.php
@@ -31,7 +31,7 @@
require_once("guiconfig.inc");
require_once("/usr/local/pkg/snort/snort.inc");
-global $g;
+global $g, $rebuild_rules;
if (!is_array($config['installedpackages']['snortglobal']))
$config['installedpackages']['snortglobal'] = array();
@@ -50,10 +50,15 @@ if (is_null($id)) {
}
$pconfig = array();
-if (empty($snortglob['rule'][$id]['uuid']))
+if (empty($snortglob['rule'][$id]['uuid'])) {
+ /* Adding new interface, so flag rules to build. */
$pconfig['uuid'] = snort_generate_id();
-else
+ $rebuild_rules = "on";
+}
+else {
$pconfig['uuid'] = $a_rule[$id]['uuid'];
+ $rebuild_rules = "off";
+}
$snort_uuid = $pconfig['uuid'];
if (isset($id) && $a_rule[$id]) {
@@ -77,14 +82,6 @@ if ($_POST["Submit"]) {
if (!$_POST['interface'])
$input_errors[] = "Interface is mandatory";
-/*
- foreach ($a_rule as $natent) {
- if (isset($id) && ($a_rule[$id]) && ($a_rule[$id] === $natent))
- continue;
- if ($natent['interface'] == $_POST['interface'])
- $input_errors[] = "This interface is already configured for another instance";
- }
-*/
/* if no errors write to conf */
if (!$input_errors) {
@@ -118,10 +115,16 @@ if ($_POST["Submit"]) {
} else
$a_rule[] = $natent;
+ /* If Snort is disabled on this interface, stop any running instance */
if ($natent['enable'] != 'on')
snort_stop($natent, $if_real);
+
+ /* Save configuration changes */
write_config();
- sync_snort_package_config();
+
+ /* Update snort.conf file for this interface */
+ $rebuild_rules = "off";
+ snort_generate_conf($a_rule[$id]);
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );