aboutsummaryrefslogtreecommitdiffstats
path: root/config/suricata/suricata_rules.php
diff options
context:
space:
mode:
authorbmeeks8 <bmeeks8@bellsouth.net>2014-02-20 12:54:50 -0500
committerbmeeks8 <bmeeks8@bellsouth.net>2014-02-20 12:54:50 -0500
commitf5db56193887749bc9998218f0aa3b91723f249d (patch)
tree9297622f61aac184e63b2d5f1567630cc170ae15 /config/suricata/suricata_rules.php
parent8d0adb058e23ce6e1c571c2a7d93adbefd268ceb (diff)
downloadpfsense-packages-f5db56193887749bc9998218f0aa3b91723f249d.tar.gz
pfsense-packages-f5db56193887749bc9998218f0aa3b91723f249d.tar.bz2
pfsense-packages-f5db56193887749bc9998218f0aa3b91723f249d.zip
Fix custom rules clear bug and enable custom rule testing.
Diffstat (limited to 'config/suricata/suricata_rules.php')
-rw-r--r--config/suricata/suricata_rules.php34
1 files changed, 17 insertions, 17 deletions
diff --git a/config/suricata/suricata_rules.php b/config/suricata/suricata_rules.php
index b848b4e8..94e43fc7 100644
--- a/config/suricata/suricata_rules.php
+++ b/config/suricata/suricata_rules.php
@@ -49,11 +49,8 @@ if (is_null($id)) {
}
if (isset($id) && $a_rule[$id]) {
- $pconfig['enable'] = $a_rule[$id]['enable'];
$pconfig['interface'] = $a_rule[$id]['interface'];
$pconfig['rulesets'] = $a_rule[$id]['rulesets'];
- if (!empty($a_rule[$id]['customrules']))
- $pconfig['customrules'] = base64_decode($a_rule[$id]['customrules']);
}
function truncate($string, $length) {
@@ -357,26 +354,29 @@ if ($_POST['clear']) {
}
if ($_POST['customrules']) {
- $a_rule[$id]['customrules'] = base64_encode($_POST['customrules']);
+ if ($_POST['customrules'])
+ $a_rule[$id]['customrules'] = base64_encode($_POST['customrules']);
+ else
+ unset($a_rule[$id]['customrules']);
write_config();
$rebuild_rules = true;
suricata_generate_yaml($a_rule[$id]);
$rebuild_rules = false;
$output = "";
$retcode = "";
-// exec("/usr/local/bin/snort -T -c {$snortdir}/snort_{$snort_uuid}_{$if_real}/snort.conf 2>&1", $output, $retcode);
-// if (intval($retcode) != 0) {
-// $error = "";
-// $start = count($output);
-// $end = $start - 4;
-// for($i = $start; $i > $end; $i--)
-// $error .= $output[$i];
-// $input_errors[] = "Custom rules have errors:\n {$error}";
-// }
-// else {
-// header("Location: /snort/snort_rules.php?id={$id}&openruleset={$currentruleset}");
-// exit;
-// }
+ exec("/usr/local/bin/suricata -T --init-errors-fatal -c {$suricatacfgdir}/suricata.yaml 2>&1", $output, $retcode);
+ if (intval($retcode) != 0) {
+ $error = "";
+ $start = count($output);
+ $end = $start - 4;
+ for($i = $start; $i > $end; $i--)
+ $error .= $output[$i];
+ $input_errors[] = "Custom rules have errors:\n {$error}";
+ }
+ else {
+ header("Location: /suricata/suricata_rules.php?id={$id}&openruleset={$currentruleset}");
+ exit;
+ }
}
else if ($_POST['apply']) {