. 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['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']; /* billm: alternate schedulers are currently disable */ /* * $pconfig['schedulertype'] = $config['shaper']['schedulertype']; */ $pconfig['maximumstates'] = $config['system']['maximumstates']; $pconfig['theme'] = $config['system']['theme']; $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['sharednet'] = $config['system']['sharednet']; $pconfig['polling_enable'] = isset($config['system']['polling']); $pconfig['disablenatreflection'] = $config['system']['disablenatreflection']; 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 (!$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['sharednet'] == "yes") { $config['system']['sharednet'] = true; system_disable_arp_wrong_if(); } else { unset($config['system']['sharednet']); system_enable_arp_wrong_if(); } 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 */ /* alternate scheduler types are currently unsupported */ //$config['shaper']['schedulertype'] = $_POST['schedulertype']; $config['system']['maximumstates'] = $_POST['maximumstates']; if($_POST['enablesshd'] == "yes") { $config['system']['enablesshd'] = $_POST['enablesshd']; } else { unset($config['system']['enablesshd']); } if($_POST['disablenatreflection'] == "yes") { $config['system']['disablenatreflection'] = $_POST['disablenatreflection']; } else { unset($config['system']['disablenatreflection']); } $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false; $config['bridge']['filteringbridge'] = $_POST['filteringbridge_enable'] ? true : false; /* pfSense themes */ $config['theme'] = $_POST['theme']; write_config(); if (($config['system']['webgui']['certificate'] != $oldcert) || ($config['system']['webgui']['private-key'] != $oldkey)) { system_webgui_start(); } $retval = 0; config_lock(); $retval = filter_configure(); if(stristr($retval, "error") <> true) $savemsg = get_std_save_message($retval); else $savemsg = $retval; $retval |= interfaces_optional_configure(); config_unlock(); conf_mount_rw(); /* serial console - write out /boot.config */ if(file_exists("/boot.config")) $boot_config = file_get_contents("/boot.config"); else $boot_config = ""; $boot_config_split = split("\n", $boot_config); if($g['platform'] <> "cdrom") { $fd = fopen("/boot.config","w"); if($fd) { foreach($boot_config_split as $bcs) { if(stristr($bcs, "-D")) { /* DONT WRITE OUT, WE'LL DO IT LATER */ } else { if($bcs <> "") fwrite($fd, "{$bcs}\n"); } } if(isset($config['system']['enableserial'])) { fwrite($fd, "-D"); } fclose($fd); } /* serial console - write out /boot/loader.conf */ $boot_config = file_get_contents("/boot/loader.conf"); $boot_config_split = split("\n", $boot_config); $fd = fopen("/boot/loader.conf","w"); if($fd) { foreach($boot_config_split as $bcs) { if(stristr($bcs, "console")) { /* DONT WRITE OUT, WE'LL DO IT LATER */ } else { if($bcs <> "") fwrite($fd, "{$bcs}\n"); } } if(isset($config['system']['enableserial'])) { fwrite($fd, "console=\"comconsole\"\n"); } fclose($fd); } } conf_mount_ro(); setup_filter_bridge(); } } $pgtitle = "System: Advanced functions"; include("head.inc"); ?>
=$pgtitle?>