From 165f7370b89857b4db89eb2d873fa120791bd8cf Mon Sep 17 00:00:00 2001 From: Ermal Date: Tue, 2 Aug 2011 15:59:36 +0000 Subject: Polishing of the snort pacakge, part 2: * Get rid of snort_head.inc * No more apply settings button since it does not make sense * Other cleanups in many parts of the code Tested only on 2.0 --- config/snort/snort_rulesets.php | 103 ++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 58 deletions(-) (limited to 'config/snort/snort_rulesets.php') diff --git a/config/snort/snort_rulesets.php b/config/snort/snort_rulesets.php index c19c8dd3..df5a24aa 100644 --- a/config/snort/snort_rulesets.php +++ b/config/snort/snort_rulesets.php @@ -51,7 +51,7 @@ if (isset($id) && $a_nat[$id]) { $pconfig['rulesets'] = $a_nat[$id]['rulesets']; /* convert fake interfaces to real */ - $if_real = convert_friendly_interface_to_real_interface_name2($pconfig['interface']); + $if_real = snort_get_real_interface($pconfig['interface']); $iface_uuid = $a_nat[$id]['uuid']; } @@ -64,7 +64,7 @@ $pgtitle = "Snort: Interface $id $iface_uuid $if_real Categories"; $isrulesfolderempty = exec("ls -A /usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules/*.rules"); if ($isrulesfolderempty == "") { - include("/usr/local/pkg/snort/snort_head.inc"); + include_once("head.inc"); include("fbegin.inc"); echo "

"; @@ -75,24 +75,26 @@ if ($isrulesfolderempty == "") { echo " \n - \n - \n - \n + \n
\n"; - - echo '
' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '
' . "\n"; - - echo "
\n"; + + $tab_array = array(); + $tabid = 0; + $tab_array[$tabid] = array(gettext("Snort Interfaces"), false, "/snort/snort_interfaces.php"); + $tabid++; + $tab_array[$tabid] = array(gettext("If Settings"), false, "/snort/snort_interfaces_edit.php?id={$id}"); + $tabid++; + $tab_array[$tabid] = array(gettext("Categories"), true, "/snort/snort_rulesets.php?id={$id}"); + $tabid++; + $tab_array[$tabid] = array(gettext("Rules"), false, "/snort/snort_rules.php?id={$id}"); + $tabid++; + $tab_array[$tabid] = array(gettext("Servers"), false, "/snort/snort_define_servers.php?id={$id}"); + $tabid++; + $tab_array[$tabid] = array(gettext("Preprocessors"), false, "/snort/snort_preprocessors.php?id={$id}"); + $tabid++; + $tab_array[$tabid] = array(gettext("Barnyard2"), false, "/snort/snort_barnyard.php?id={$id}"); + display_top_tabs($tab_array); +echo " +
\n
\n @@ -119,21 +121,10 @@ if ($isrulesfolderempty == "") { echo ""; exit(0); - } /* alert file */ $d_snortconfdirty_path = "/var/run/snort_conf_{$iface_uuid}_{$if_real}.dirty"; - -/* this will exec when alert says apply */ -if ($_POST['apply']) { - - if (file_exists($d_snortconfdirty_path)) { - sync_snort_package(); - unlink($d_snortconfdirty_path); - } -} - if ($_POST["Submit"]) { $enabled_items = ""; $isfirst = true; @@ -150,11 +141,8 @@ if ($_POST["Submit"]) { $a_nat[$id]['rulesets'] = $enabled_items; write_config(); - sync_snort_package_all($id, $if_real, $iface_uuid); - touch($d_snortconfdirty_path); - header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); header( 'Cache-Control: no-store, no-cache, must-revalidate' ); @@ -166,14 +154,13 @@ if ($_POST["Submit"]) { $enabled_rulesets = $a_nat[$id]['rulesets']; if($enabled_rulesets) -$enabled_rulesets_array = split("\|\|", $enabled_rulesets); + $enabled_rulesets_array = split("\|\|", $enabled_rulesets); -include("/usr/local/pkg/snort/snort_head.inc"); +include_once("head.inc"); ?> - + ' . $pgtitle . '

';}?> @@ -182,10 +169,6 @@ include("/usr/local/pkg/snort/snort_head.inc"); echo "{$snort_general_css}\n"; ?> - -
-