. 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. */ require("guiconfig.inc"); $pconfig['disablefilter'] = $config['system']['disablefilter']; $pconfig['rfc959workaround'] = $config['system']['rfc959workaround']; $pconfig['scrubnodf'] = $config['system']['scrubnodf']; $pconfig['ipv6nat_enable'] = isset($config['diag']['ipv6nat']['enable']); $pconfig['ipv6nat_ipaddr'] = $config['diag']['ipv6nat']['ipaddr']; $pconfig['cert'] = base64_decode($config['system']['webgui']['certificate']); $pconfig['key'] = base64_decode($config['system']['webgui']['private-key']); $pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']); $pconfig['harddiskstandby'] = $config['system']['harddiskstandby']; $pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']); $pconfig['filteringbridge_enable'] = isset($config['bridge']['filteringbridge']); $pconfig['tcpidletimeout'] = $config['filter']['tcpidletimeout']; $pconfig['maximumstates'] = $config['system']['maximumstates']; $pconfig['disablerendevouz'] = $config['system']['disablerendevouz']; $pconfig['enableserial'] = $config['system']['enableserial']; $pconfig['disablefirmwarecheck'] = isset($config['system']['disablefirmwarecheck']); $pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']); $pconfig['enablesshd'] = $config['system']['enablesshd']; $pconfig['sshport'] = $config['system']['ssh']['port']; $pconfig['sshdkeyonly'] = $config['system']['ssh']['sshdkeyonly']; $pconfig['authorizedkeys'] = base64_decode($config['system']['ssh']['authorizedkeys']); $pconfig['sharednet'] = $config['system']['sharednet']; $pconfig['polling_enable'] = isset($config['system']['polling']); $pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']); $pconfig['disablenatreflection'] = $config['system']['disablenatreflection']; $pconfig['reflectiontimeout'] = $config['system']['reflectiontimeout']; $pconfig['disablechecksumoffloading'] = isset($config['system']['disablechecksumoffloading']); $pconfig['disablescrub'] = isset($config['system']['disablescrub']); $pconfig['shapertype'] = $config['system']['shapertype']; $pconfig['lb_use_sticky'] = isset($config['system']['lb_use_sticky']); if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ if ($_POST['ipv6nat_enable'] && !is_ipaddr($_POST['ipv6nat_ipaddr'])) { $input_errors[] = "You must specify an IP address to NAT IPv6 packets."; } if ($_POST['maximumstates'] && !is_numericint($_POST['maximumstates'])) { $input_errors[] = "The Firewall Maximum States value must be an integer."; } if ($_POST['tcpidletimeout'] && !is_numericint($_POST['tcpidletimeout'])) { $input_errors[] = "The TCP idle timeout must be an integer."; } if (($_POST['cert'] && !$_POST['key']) || ($_POST['key'] && !$_POST['cert'])) { $input_errors[] = "Certificate and key must always be specified together."; } else if ($_POST['cert'] && $_POST['key']) { 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['altfirmwareurl']) if ($_POST['firmwareurl'] == "" || $_POST['firmwarename'] == "") $input_errors[] = "You must specify a base URL and a filename for the alternate firmware."; if ($_POST['altpkgconfigurl']) if ($_POST['pkgconfig_base_url'] == "" || $_POST['pkgconfig_filename'] == "") $input_errors[] = "You must specifiy and base URL and a filename before using an alternate pkg_config.xml."; } if ($_POST['maximumstates'] <> "") { if ($_POST['maximumstates'] < 1000) $input_errors[] = "States must be above 1000 and below 100000000"; if ($_POST['maximumstates'] > 100000000) $input_errors[] = "States must be above 1000 and below 100000000"; } if ($_POST['sshport'] <> "") { if( ! is_port($_POST['sshport'])) { $input_errors[] = "You must specify a valid port number"; } } if($_POST['sshdkeyonly'] == "yes") { $config['system']['ssh']['sshdkeyonly'] = "enabled"; } else { unset($config['system']['ssh']['sshdkeyonly']); } $config['system']['ssh']['authorizedkeys'] = base64_encode($_POST['authorizedkeys']); } if ($_POST) { ob_flush(); flush(); if (!$input_errors) { if($_POST['disablefilter'] == "yes") { $config['system']['disablefilter'] = "enabled"; } else { unset($config['system']['disablefilter']); } if($_POST['enablesshd'] == "yes") { $config['system']['enablesshd'] = "enabled"; touch("{$g['tmp_path']}/start_sshd"); } else { unset($config['system']['enablesshd']); mwexec("/usr/bin/killall sshd"); } $oldsshport = $config['system']['ssh']['port']; $config['system']['ssh']['port'] = $_POST['sshport']; if($_POST['polling_enable'] == "yes") { $config['system']['polling'] = true; setup_polling(); } else { unset($config['system']['polling']); setup_polling(); } if($_POST['lb_use_sticky'] == "yes") $config['system']['lb_use_sticky'] = true; else unset($config['system']['lb_use_sticky']); if($_POST['sharednet'] == "yes") { $config['system']['sharednet'] = true; system_disable_arp_wrong_if(); } else { unset($config['system']['sharednet']); system_enable_arp_wrong_if(); } if($_POST['scrubnodf'] == "yes") $config['system']['scrubnodf'] = "enabled"; else unset($config['system']['scrubnodf']); if($_POST['rfc959workaround'] == "yes") $config['system']['rfc959workaround'] = "enabled"; else unset($config['system']['rfc959workaround']); if($_POST['ipv6nat_enable'] == "yes") { $config['diag']['ipv6nat']['enable'] = true; $config['diag']['ipv6nat']['ipaddr'] = $_POST['ipv6nat_ipaddr']; } else { unset($config['diag']['ipv6nat']['enable']); unset($config['diag']['ipv6nat']['ipaddr']); } $oldcert = $config['system']['webgui']['certificate']; $oldkey = $config['system']['webgui']['private-key']; $config['system']['webgui']['certificate'] = base64_encode($_POST['cert']); $config['system']['webgui']['private-key'] = base64_encode($_POST['key']); if($_POST['disableconsolemenu'] == "yes") { $config['system']['disableconsolemenu'] = true; auto_login(true); } else { unset($config['system']['disableconsolemenu']); auto_login(false); } unset($config['system']['webgui']['expanddiags']); $config['system']['optimization'] = $_POST['optimization']; if($_POST['disablefirmwarecheck'] == "yes") $config['system']['disablefirmwarecheck'] = true; else unset($config['system']['disablefirmwarecheck']); if ($_POST['enableserial'] == "yes") $config['system']['enableserial'] = true; else unset($config['system']['enableserial']); if($_POST['harddiskstandby'] <> "") { $config['system']['harddiskstandby'] = $_POST['harddiskstandby']; system_set_harddisk_standby(); } else unset($config['system']['harddiskstandby']); if ($_POST['noantilockout'] == "yes") $config['system']['webgui']['noantilockout'] = true; else unset($config['system']['webgui']['noantilockout']); /* Firewall and ALTQ options */ $config['system']['maximumstates'] = $_POST['maximumstates']; if($_POST['enablesshd'] == "yes") { $config['system']['enablesshd'] = $_POST['enablesshd']; } else { unset($config['system']['enablesshd']); } if($_POST['disablechecksumoffloading'] == "yes") { $config['system']['disablechecksumoffloading'] = $_POST['disablechecksumoffloading']; } else { unset($config['system']['disablechecksumoffloading']); } if($_POST['disablescrub'] == "yes") { $config['system']['disablescrub'] = $_POST['disablescrub']; } else { unset($config['system']['disablescrub']); } if($_POST['disablenatreflection'] == "yes") { $config['system']['disablenatreflection'] = $_POST['disablenatreflection']; } else { unset($config['system']['disablenatreflection']); } $config['system']['reflectiontimeout'] = $_POST['reflectiontimeout']; // Traffic shaper $config['system']['shapertype'] = $_POST['shapertype']; $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false; $config['bridge']['filteringbridge'] = $_POST['filteringbridge_enable'] ? true : false; $config['filter']['bypassstaticroutes'] = $_POST['bypassstaticroutes'] ? true : false; write_config(); $retval = 0; config_lock(); $retval = filter_configure(); if(stristr($retval, "error") <> true) $savemsg = get_std_save_message($retval); else $savemsg = $retval; config_unlock(); setup_filter_bridge(); conf_mount_rw(); setup_serial_port(); setup_filter_bridge(); conf_mount_ro(); } } $pgtitle = array("System","Advanced functions"); include("head.inc"); ?>