aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rwxr-xr-xconfig/snort/snort.inc22
-rwxr-xr-xconfig/snort/snort_interfaces.php4
-rwxr-xr-xconfig/snort/snort_interfaces_edit.php24
-rw-r--r--config/snort/snort_post_install.php18
4 files changed, 43 insertions, 25 deletions
diff --git a/config/snort/snort.inc b/config/snort/snort.inc
index 466efac1..e9feec1a 100755
--- a/config/snort/snort.inc
+++ b/config/snort/snort.inc
@@ -1036,13 +1036,13 @@ function sync_snort_package_config() {
if ($value['enable'] != 'on') {
foreach ($config['installedpackages']['service'] as $key => $service) {
if (isset($service['uuid']) && $service['uuid'] == $value['uuid'] &&
- $service['name'] == "snort_" . strtolower(convert_friendly_interface_to_friendly_descr($value['interface']))) {
+ $service['name'] == "snort_" . strtolower($value['interface'])) {
unset($config['installedpackages']['service'][$key]);
unlink_if_exists("{$g['varrun_path']}/snort_{$uuid}.disabled");
$is_dirty = TRUE;
}
if (isset($service['uuid']) && $service['uuid'] == $value['uuid'] &&
- $service['name'] == "barnyard2_" . strtolower(convert_friendly_interface_to_friendly_descr($value['interface']))) {
+ $service['name'] == "barnyard2_" . strtolower($value['interface'])) {
unset($config['installedpackages']['service'][$key]);
unlink_if_exists("{$g['varrun_path']}/barnyard2_{$uuid}.disabled");
$is_dirty = TRUE;
@@ -1065,18 +1065,21 @@ function sync_snort_package_config() {
$barnyard_found = FALSE;
foreach ($config['installedpackages']['service'] as $service) {
if (isset($service['uuid']) && $service['uuid'] == $value['uuid'] &&
- $service['name'] == "snort_" . strtolower(convert_friendly_interface_to_friendly_descr($value['interface']))) {
+ $service['name'] == "snort_" . strtolower($value['interface'])) {
$snort_found = TRUE;
}
if (isset($service['uuid']) && $service['uuid'] == $value['uuid'] &&
- $service['name'] == "barnyard2_" . strtolower(convert_friendly_interface_to_friendly_descr($value['interface']))) {
+ $service['name'] == "barnyard2_" . strtolower($value['interface'])) {
$barnyard_found = TRUE;
}
}
if (!$snort_found) {
$service = array();
- $service['name'] = "snort_" . strtolower(convert_friendly_interface_to_friendly_descr($value['interface']));
- $service['description'] = "Snort IDS/IPS - " . convert_friendly_interface_to_friendly_descr($value['interface']);
+ $service['name'] = "snort_" . strtolower($value['interface']);
+ if (!empty($value['descr']))
+ $service['description'] = "Snort IDS - " . $value['descr'];
+ else
+ $service['description'] = "Snort IDS - " . convert_friendly_interface_to_friendly_descr($value['interface']);
$service['uuid'] = $value['uuid'];
$service['startcmd'] = "\$action='start';\$service='snort';\$uuid={$value['uuid']};\$rc = include '/usr/local/pkg/snort/snort_service_utils.php';";
$service['stopcmd'] = "\$action='stop';\$service='snort';\$uuid={$value['uuid']};\$rc = include '/usr/local/pkg/snort/snort_service_utils.php';";
@@ -1087,8 +1090,11 @@ function sync_snort_package_config() {
}
if (!$barnyard_found && $value['barnyard_enable'] == 'on') {
$service = array();
- $service['name'] = "barnyard2_" . strtolower(convert_friendly_interface_to_friendly_descr($value['interface']));
- $service['description'] = "Barnyard2 Logging - " . convert_friendly_interface_to_friendly_descr($value['interface']);
+ $service['name'] = "barnyard2_" . strtolower($value['interface']);
+ if (!empty($value['descr']))
+ $service['description'] = "Barnyard2 Logging - " . $value['descr'];
+ else
+ $service['description'] = "Barnyard2 Logging - " . convert_friendly_interface_to_friendly_descr($value['interface']);
$service['uuid'] = $value['uuid'];
$service['startcmd'] = "\$action='start';\$service='barnyard2';\$uuid={$value['uuid']};\$rc = include '/usr/local/pkg/snort/snort_service_utils.php';";
$service['stopcmd'] = "\$action='stop';\$service='barnyard2';\$uuid={$value['uuid']};\$rc = include '/usr/local/pkg/snort/snort_service_utils.php';";
diff --git a/config/snort/snort_interfaces.php b/config/snort/snort_interfaces.php
index 5e0830c3..51eef308 100755
--- a/config/snort/snort_interfaces.php
+++ b/config/snort/snort_interfaces.php
@@ -57,12 +57,12 @@ if (isset($_POST['del_x'])) {
$snort_uuid = $a_nat[$rulei]['uuid'];
foreach ($config['installedpackages']['service'] as $key => $service) {
if (isset($service['uuid']) && $service['uuid'] == $snort_uuid &&
- $service['name'] == "snort_" . strtolower(convert_friendly_interface_to_friendly_descr($a_nat[$rulei]['interface']))) {
+ $service['name'] == "snort_" . strtolower($a_nat[$rulei]['interface'])) {
unset($config['installedpackages']['service'][$key]);
unlink_if_exists("{$g['varrun_path']}/snort_{$snort_uuid}.disabled");
}
if (isset($service['uuid']) && $service['uuid'] == $snort_uuid &&
- $service['name'] == "barnyard2_" . strtolower(convert_friendly_interface_to_friendly_descr($a_nat[$rulei]['interface']))) {
+ $service['name'] == "barnyard2_" . strtolower($a_nat[$rulei]['interface'])) {
unset($config['installedpackages']['service'][$key]);
unlink_if_exists("{$g['varrun_path']}/barnyard2_{$snort_uuid}.disabled");
}
diff --git a/config/snort/snort_interfaces_edit.php b/config/snort/snort_interfaces_edit.php
index 98e05d82..cc785725 100755
--- a/config/snort/snort_interfaces_edit.php
+++ b/config/snort/snort_interfaces_edit.php
@@ -96,7 +96,7 @@ elseif (isset($id) && !isset($a_rule[$id])) {
foreach ($ifaces as $i) {
if (!in_array($i, $ifrules)) {
$pconfig['interface'] = $i;
- $pconfig['descr'] = strtoupper($i);
+ $pconfig['descr'] = convert_friendly_interface_to_friendly_descr($i);
$pconfig['enable'] = 'on';
break;
}
@@ -130,7 +130,7 @@ if (strcasecmp($action, 'dup') == 0) {
if (!in_array($i, $ifrules)) {
$pconfig['interface'] = $i;
$pconfig['enable'] = 'on';
- $pconfig['descr'] = strtoupper($i);
+ $pconfig['descr'] = convert_friendly_interface_to_friendly_descr($i);
break;
}
}
@@ -197,7 +197,7 @@ if ($_POST["save"] && !$input_errors) {
if ($_POST['suppresslistname'] && ($_POST['suppresslistname'] <> $natent['suppresslistname']))
$snort_reload = true;
- if ($_POST['descr']) $natent['descr'] = $_POST['descr']; else $natent['descr'] = strtoupper($natent['interface']);
+ if ($_POST['descr']) $natent['descr'] = $_POST['descr']; else $natent['descr'] = convert_friendly_interface_to_friendly_descr($natent['interface']);
if ($_POST['performance']) $natent['performance'] = $_POST['performance']; else unset($natent['performance']);
/* if post = on use on off or rewrite the conf */
if ($_POST['blockoffenders7'] == "on") $natent['blockoffenders7'] = 'on'; else $natent['blockoffenders7'] = 'off';
@@ -233,14 +233,20 @@ if ($_POST["save"] && !$input_errors) {
// Need to rename the service entries when moving instance to another interface
foreach ($config['installedpackages']['service'] as &$service) {
if (isset($service['uuid']) && $service['uuid'] == $a_rule[$id]['uuid'] &&
- $service['name'] == "snort_" . strtolower(convert_friendly_interface_to_friendly_descr($a_rule[$id]['interface']))) {
- $service['name'] = "snort_" . strtolower(convert_friendly_interface_to_friendly_descr($natent['interface']));
- $service['description'] = "Snort IDS/IPS - " . convert_friendly_interface_to_friendly_descr($natent['interface']);
+ $service['name'] == "snort_" . strtolower($a_rule[$id]['interface'])) {
+ $service['name'] = "snort_" . strtolower($natent['interface']);
+ if (!empty($natent['descr']))
+ $service['description'] = "Snort IDS - " . $natent['descr'];
+ else
+ $service['description'] = "Snort IDS - " . convert_friendly_interface_to_friendly_descr($natent['interface']);
}
if (isset($service['uuid']) && $service['uuid'] == $a_rule[$id]['uuid'] &&
- $service['name'] == "barnyard2_" . strtolower(convert_friendly_interface_to_friendly_descr($a_rule[$id]['interface']))) {
- $service['name'] = "barnyard2_" . strtolower(convert_friendly_interface_to_friendly_descr($natent['interface']));
- $service['description'] = "Barnyard2 Logging - " . convert_friendly_interface_to_friendly_descr($natent['interface']);
+ $service['name'] == "barnyard2_" . strtolower($a_rule[$id]['interface'])) {
+ $service['name'] = "barnyard2_" . strtolower($natent['interface']);
+ if (!empty($natent['descr']))
+ $service['description'] = "Barnyard2 Logging - " . $natent['descr'];
+ else
+ $service['description'] = "Barnyard2 Logging - " . convert_friendly_interface_to_friendly_descr($natent['interface']);
}
}
@rename("{$snortlogdir}/snort_{$oif_real}{$a_rule[$id]['uuid']}", "{$snortlogdir}/snort_{$if_real}{$a_rule[$id]['uuid']}");
diff --git a/config/snort/snort_post_install.php b/config/snort/snort_post_install.php
index 5c47e151..ece75f2b 100644
--- a/config/snort/snort_post_install.php
+++ b/config/snort/snort_post_install.php
@@ -229,18 +229,21 @@ if ($config['installedpackages']['snortglobal']['forcekeepsettings'] == 'on') {
$barnyard_found = FALSE;
foreach ($config['installedpackages']['service'] as $service) {
if (isset($service['uuid']) && $service['uuid'] == $snortcfg['uuid'] &&
- $service['name'] == "snort_" . strtolower(convert_friendly_interface_to_friendly_descr($snortcfg['interface']))) {
+ $service['name'] == "snort_" . strtolower($snortcfg['interface'])) {
$snort_found = TRUE;
}
if (isset($service['uuid']) && $service['uuid'] == $snortcfg['uuid'] &&
- $service['name'] == "barnyard2_" . strtolower(convert_friendly_interface_to_friendly_descr($snortcfg['interface']))) {
+ $service['name'] == "barnyard2_" . strtolower($snortcfg['interface'])) {
$barnyard_found = TRUE;
}
}
if (!$snort_found) {
$service = array();
- $service['name'] = "snort_" . strtolower(convert_friendly_interface_to_friendly_descr($snortcfg['interface']));
- $service['description'] = "Snort IDS/IPS - " . convert_friendly_interface_to_friendly_descr($snortcfg['interface']);
+ $service['name'] = "snort_" . strtolower($snortcfg['interface']);
+ if (!empty($snortcfg['descr']))
+ $service['description'] = "Snort IDS - " . $snortcfg['descr'];
+ else
+ $service['description'] = "Snort IDS - " . convert_friendly_interface_to_friendly_descr($snortcfg['interface']);
$service['uuid'] = $snortcfg['uuid'];
$service['startcmd'] = "\$action='start';\$service='snort';\$uuid={$snortcfg['uuid']};\$rc = include '/usr/local/pkg/snort/snort_service_utils.php';";
$service['stopcmd'] = "\$action='stop';\$service='snort';\$uuid={$snortcfg['uuid']};\$rc = include '/usr/local/pkg/snort/snort_service_utils.php';";
@@ -251,8 +254,11 @@ if ($config['installedpackages']['snortglobal']['forcekeepsettings'] == 'on') {
}
if (!$barnyard_found && $snortcfg['barnyard_enable'] == 'on') {
$service = array();
- $service['name'] = "barnyard2_" . strtolower(convert_friendly_interface_to_friendly_descr($snortcfg['interface']));
- $service['description'] = "Barnyard2 Logging - " . convert_friendly_interface_to_friendly_descr($snortcfg['interface']);
+ $service['name'] = "barnyard2_" . strtolower($snortcfg['interface']);
+ if (!empty($snortcfg['descr']))
+ $service['description'] = "Barnyard2 Logging - " . $snortcfg['descr'];
+ else
+ $service['description'] = "Barnyard2 Logging - " . convert_friendly_interface_to_friendly_descr($snortcfg['interface']);
$service['uuid'] = $snortcfg['uuid'];
$service['startcmd'] = "\$action='start';\$service='barnyard2';\$uuid={$snortcfg['uuid']};\$rc = include '/usr/local/pkg/snort/snort_service_utils.php';";
$service['stopcmd'] = "\$action='stop';\$service='barnyard2';\$uuid={$snortcfg['uuid']};\$rc = include '/usr/local/pkg/snort/snort_service_utils.php';";