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_interfaces.php | 119 ++++++++++---------------------------- 1 file changed, 32 insertions(+), 87 deletions(-) (limited to 'config/snort/snort_interfaces.php') diff --git a/config/snort/snort_interfaces.php b/config/snort/snort_interfaces.php index b5db0857..13b7fb4e 100644 --- a/config/snort/snort_interfaces.php +++ b/config/snort/snort_interfaces.php @@ -46,32 +46,6 @@ if (!is_array($config['installedpackages']['snortglobal']['rule'])) $a_nat = &$config['installedpackages']['snortglobal']['rule']; $id_gen = count($config['installedpackages']['snortglobal']['rule']); -/* alert file */ -$d_snortconfdirty_path_ls = exec('/bin/ls /var/run/snort_conf_*.dirty'); - -/* this will exec when alert says apply */ -if ($_POST['apply']) { - - if ($d_snortconfdirty_path_ls != '') { - - sync_snort_package_empty(); - sync_snort_package(); - - exec('/bin/rm /var/run/snort_conf_*.dirty'); - - 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' ); - header( 'Cache-Control: post-check=0, pre-check=0', false ); - header( 'Pragma: no-cache' ); - header("Location: /snort/snort_interfaces.php"); - - exit; - - } - -} - if (isset($_POST['del_x'])) { /* delete selected rules */ if (is_array($_POST['rule'])) { @@ -80,7 +54,7 @@ if (isset($_POST['del_x'])) { foreach ($_POST['rule'] as $rulei) { /* convert fake interfaces to real */ - $if_real = convert_friendly_interface_to_real_interface_name2($a_nat[$rulei]['interface']); + $if_real = snort_get_real_interface($a_nat[$rulei]['interface']); $snort_uuid = $a_nat[$rulei]['uuid']; /* cool code to check if any snort is up */ @@ -133,7 +107,7 @@ if (isset($_POST['del_x'])) { /* stop syslog flood code */ //$if_real_wan_rulei = $a_nat[$rulei]['interface']; - //$if_real_wan_rulei2 = convert_friendly_interface_to_real_interface_name2($if_real_wan_rulei); + //$if_real_wan_rulei2 = snort_get_real_interface($if_real_wan_rulei); //exec("/sbin/ifconfig $if_real_wan_rulei2 -promisc"); //exec("/bin/cp /var/log/system.log /var/log/snort/snort_sys_$rulei$if_real.log"); //exec("/usr/bin/killall syslogd"); @@ -170,7 +144,7 @@ if (isset($_POST['del_x'])) { conf_mount_ro(); } - //touch("/var/run/snort_conf_delete.dirty"); + sync_snort_package_empty(); header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); @@ -187,7 +161,7 @@ if (isset($_POST['del_x'])) { /* start/stop snort */ if ($_GET['act'] == 'toggle' && is_numeric($id)) { - $if_real = convert_friendly_interface_to_real_interface_name2($config['installedpackages']['snortglobal']['rule'][$id]['interface']); + $if_real = snort_get_real_interface($config['installedpackages']['snortglobal']['rule'][$id]['interface']); $snort_uuid = $config['installedpackages']['snortglobal']['rule'][$id]['uuid']; /* Log Iface stop */ @@ -212,8 +186,6 @@ if ($_GET['act'] == 'toggle' && is_numeric($id)) { }else{ sync_snort_package_all($id, $if_real, $snort_uuid); - sync_snort_package(); - Running_Start($snort_uuid, $if_real, $id); header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); @@ -228,33 +200,19 @@ if ($_GET['act'] == 'toggle' && is_numeric($id)) { $pgtitle = "Services: $snort_package_version"; -include_once("/usr/local/pkg/snort/snort_head.inc"); +include_once("head.inc"); ?> - - - - - -
-
- -' . $pgtitle . '

';}?> +include_once("fbegin.inc"); +if ($pfsense_stable == 'yes') + echo '

' . $pgtitle . '

'; +?> -
- - '; - if($savemsg) { + if($savemsg) print_info_box_np2("{$savemsg}"); - }else{ + else { print_info_box_np2(' The Snort configuration has changed for one or more interfaces.
You must apply the changes in order for them to take effect.
'); } } - - ?> +?> - - - - - + +
- - - -
+
+ +
@@ -346,7 +291,7 @@ enable JavaScript to view this content /* convert fake interfaces to real and check if iface is up */ /* There has to be a smarter way to do this */ - $if_real = convert_friendly_interface_to_real_interface_name2($natent['interface']); + $if_real = snort_get_real_interface($natent['interface']); $snort_uuid = $natent['uuid']; $tester2 = Running_Ck($snort_uuid, $if_real, $id); -- cgit v1.2.3