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_global.php | 130 +++++++++---------------------- 1 file changed, 38 insertions(+), 92 deletions(-) (limited to 'config/snort/snort_interfaces_global.php') diff --git a/config/snort/snort_interfaces_global.php b/config/snort/snort_interfaces_global.php index 0fbc29ae..5f432a6f 100644 --- a/config/snort/snort_interfaces_global.php +++ b/config/snort/snort_interfaces_global.php @@ -52,19 +52,6 @@ $pconfig['autorulesupdate7'] = $config['installedpackages']['snortglobal']['auto $pconfig['snortalertlogtype'] = $config['installedpackages']['snortglobal']['snortalertlogtype']; $pconfig['forcekeepsettings'] = $config['installedpackages']['snortglobal']['forcekeepsettings']; -/* this will exec when alert says apply */ -if ($_POST['apply']) { - - if (file_exists("$d_snort_global_dirty_path")) { - - /* create whitelist and homenet file then sync files */ - sync_snort_package_empty(); - sync_snort_package(); - - unlink("$d_snort_global_dirty_path"); - } -} - /* if no errors move foward */ if (!$input_errors) { @@ -83,48 +70,31 @@ if (!$input_errors) { $retval = 0; $snort_snortloglimit_info_ck = $config['installedpackages']['snortglobal']['snortloglimit']; - if ($snort_snortloglimit_info_ck == 'on') { - snort_snortloglimit_install_cron(''); - snort_snortloglimit_install_cron('true'); - } - - if ($snort_snortloglimit_info_ck == 'off') { - snort_snortloglimit_install_cron(''); - } - + snort_snortloglimit_install_cron($snort_snortloglimit_info_ck == 'ok' ? true : false); /* set the snort block hosts time IMPORTANT */ $snort_rm_blocked_info_ck = $config['installedpackages']['snortglobal']['rm_blocked']; if ($snort_rm_blocked_info_ck == "never_b") - $snort_rm_blocked_false = ""; + $snort_rm_blocked_false = false; else - $snort_rm_blocked_false = "true"; + $snort_rm_blocked_false = true; - if ($snort_rm_blocked_info_ck != "") - { - snort_rm_blocked_install_cron(""); - snort_rm_blocked_install_cron($snort_rm_blocked_false); - } + snort_rm_blocked_install_cron($snort_rm_blocked_false); /* set the snort rules update time */ $snort_rules_up_info_ck = $config['installedpackages']['snortglobal']['autorulesupdate7']; if ($snort_rules_up_info_ck == "never_up") - $snort_rules_up_false = ""; + $snort_rules_up_false = false; else - $snort_rules_up_false = "true"; - - if ($snort_rules_up_info_ck != "") - { - snort_rules_up_install_cron(""); - snort_rules_up_install_cron($snort_rules_up_false); - } + $snort_rules_up_false = true; + snort_rules_up_install_cron($snort_rules_up_false); - touch($d_snort_global_dirty_path); - $savemsg = get_std_save_message($retval); write_config(); + $savemsg = get_std_save_message($retval); - sync_snort_package(); + /* create whitelist and homenet file then sync files */ + sync_snort_package_empty(); /* forces page to reload new settings */ header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); @@ -188,8 +158,6 @@ if ($_POST["Reset"]) { /* remove all snort iface dir */ exec('rm -r /usr/local/etc/snort/snort_*'); exec('rm /var/log/snort/*'); - - write_config(); } snort_deinstall_settings(); @@ -204,35 +172,22 @@ if ($_POST["Reset"]) { exit; } - $pgtitle = 'Services: Snort: Global Settings'; -include_once("/usr/local/pkg/snort/snort_head.inc"); +include_once("head.inc"); ?> - - - - -
-
+include_once("fbegin.inc"); -' . $pgtitle . '

';}?> +if($pfsense_stable == 'yes') + echo '

' . $pgtitle . '

'; +?> - -
+ You must apply the changes in order for them to take effect.
'); } } - ?> +?> - - - - - - + +
- - - -
+
+ +
@@ -297,7 +243,7 @@ enable JavaScript to view this content + Do NOT Install + value="Save" onClick="enable_change(true)"> + -- cgit v1.2.3
> - Do NOT Install
 WARNING:
This will reset all global and interface settings.