. All rights reserved. Copyright (C) 2008-2009 Robert Zelaya Modified for the Pfsense snort package. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ $pgtitle = "Services:[Snort][Global Settings]"; require("guiconfig.inc"); require("/usr/local/pkg/snort/snort.inc"); /* make things short */ $pconfig['snortdownload'] = $config['installedpackages']['snortglobal']['snortdownload']; $pconfig['oinkmastercode'] = $config['installedpackages']['snortglobal']['oinkmastercode']; $pconfig['emergingthreats'] = $config['installedpackages']['snortglobal']['emergingthreats']; $pconfig['rm_blocked'] = $config['installedpackages']['snortglobal']['rm_blocked']; $pconfig['autorulesupdate7'] = $config['installedpackages']['snortglobal']['autorulesupdate7']; $pconfig['whitelistvpns'] = $config['installedpackages']['snortglobal']['whitelistvpns']; $pconfig['clickablalerteurls'] = $config['installedpackages']['snortglobal']['clickablalerteurls']; $pconfig['associatealertip'] = $config['installedpackages']['snortglobal']['associatealertip']; $pconfig['snortalertlogtype'] = $config['installedpackages']['snortglobal']['snortalertlogtype']; if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ if ($_POST['enable']) { // if ($_POST['timeout'] && (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))) { // $input_errors[] = "The timeout must be at least 1 minute."; // } // if ($_POST['idletimeout'] && (!is_numeric($_POST['idletimeout']) || ($_POST['idletimeout'] < 1))) { // $input_errors[] = "The idle timeout must be at least 1 minute."; // } // if (($_POST['radiusip'] && !is_ipaddr($_POST['radiusip']))) { // $input_errors[] = "A valid IP address must be specified. [".$_POST['radiusip']."]"; // } // if (($_POST['radiusip2'] && !is_ipaddr($_POST['radiusip2']))) { // $input_errors[] = "A valid IP address must be specified. [".$_POST['radiusip2']."]"; // } // if (($_POST['radiusport'] && !is_port($_POST['radiusport']))) { // $input_errors[] = "A valid port number must be specified. [".$_POST['radiusport']."]"; // } // if (($_POST['radiusport2'] && !is_port($_POST['radiusport2']))) { // $input_errors[] = "A valid port number must be specified. [".$_POST['radiusport2']."]"; // } // if (($_POST['radiusacctport'] && !is_port($_POST['radiusacctport']))) { // $input_errors[] = "A valid port number must be specified. [".$_POST['radiusacctport']."]"; // } // if ($_POST['maxproc'] && (!is_numeric($_POST['maxproc']) || ($_POST['maxproc'] < 4) || ($_POST['maxproc'] > 100))) { // $input_errors[] = "The total maximum number of concurrent connections must be between 4 and 100."; // } // $mymaxproc = $_POST['maxproc'] ? $_POST['maxproc'] : 16; // if ($_POST['maxprocperip'] && (!is_numeric($_POST['maxprocperip']) || ($_POST['maxprocperip'] > $mymaxproc))) { // $input_errors[] = "The maximum number of concurrent connections per client IP address may not be larger than the global maximum."; // } } if (!$input_errors) { $config['installedpackages']['snortglobal']['snortdownload'] = $_POST['snortdownload']; $config['installedpackages']['snortglobal']['oinkmastercode'] = $_POST['oinkmastercode']; $config['installedpackages']['snortglobal']['emergingthreats'] = $_POST['emergingthreats'] ? on : off; $config['installedpackages']['snortglobal']['rm_blocked'] = $_POST['rm_blocked']; $config['installedpackages']['snortglobal']['autorulesupdate7'] = $_POST['autorulesupdate7']; $config['installedpackages']['snortglobal']['whitelistvpns'] = $_POST['whitelistvpns'] ? on : off; $config['installedpackages']['snortglobal']['clickablalerteurls'] = $_POST['clickablalerteurls'] ? on : off; $config['installedpackages']['snortglobal']['associatealertip'] = $_POST['associatealertip'] ? on : off; $config['installedpackages']['snortglobal']['snortalertlogtype'] = $_POST['snortalertlogtype']; write_config(); sleep(2); $retval = 0; /* 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 = ""; else $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); } /* 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 = ""; 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); } $savemsg = get_std_save_message($retval); } } include("head.inc"); ?>