. Copyright (C) 2008-2009 Robert Zelaya 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']; if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ if ($_POST['enable']) { $reqdfields = explode(" ", "interface"); $reqdfieldsn = explode(",", "Interface"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if ($_POST['httpslogin_enable']) { if (!$_POST['cert'] || !$_POST['key']) { $input_errors[] = "Certificate and key must be specified for HTTPS login."; } else { if (!strstr($_POST['cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cert'], "END CERTIFICATE")) $input_errors[] = "This certificate does not appear to be valid."; if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY")) $input_errors[] = "This key does not appear to be valid."; } if (!$_POST['httpsname'] || !is_domain($_POST['httpsname'])) { $input_errors[] = "The HTTPS server name must be specified for HTTPS login."; } } } 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; 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"); ?>

Install Snort.org rules
> Do NOT install
> Premium rules HIGHLY RECOMMENDED
> Basic Rules
   
Oinkmaster code
Code
Obtain a snort.org Oinkmaster code and paste here.
Install Emergingthreats rules onClick="enable_change(false)">
Emerging Threats is an open source community that produces fastest moving and diverse Snort Rules.
Remove blocked hosts every
Please select the amount of time you would like hosts to be blocked for.
Hint: in most cases, 1 hour is a good choice.
Update rules automatically
Please select the update times for rules.
Hint: in most cases, every 12 hours is a good choice.
Whitelist VPNs automatically onClick="enable_change(false)">
Checking this option will install whitelists for all VPNs.
Convert Snort alerts urls to clickable links onClick="enable_change(false)">
Checking this option will automatically convert URLs in the Snort alerts tab to clickable links.
Associate events on Blocked tab onClick="enable_change(false)">
Checking this option will automatically associate the blocked reason from the snort alerts file.
 
  Note:
Changing any settings on this page will disconnect all clients! Don't forget to enable the DHCP server on your captive portal interface! Make sure that the default/maximum DHCP lease time is higher than the timeout entered on this page. Also, the DNS forwarder needs to be enabled for DNS lookups by unauthenticated clients to work.