. 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. */ /* pfSense_BUILDER_BINARIES: /bin/kill /usr/bin/tar pfSense_MODULE: system */ ##|+PRIV ##|*IDENT=page-system-generalsetup ##|*NAME=System: General Setup page ##|*DESCR=Allow access to the 'System: General Setup' page. ##|*MATCH=system.php* ##|-PRIV require("guiconfig.inc"); require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); $pconfig['hostname'] = $config['system']['hostname']; $pconfig['domain'] = $config['system']['domain']; list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['system']['dnsserver']; $arr_gateways = return_gateways_array(); $pconfig['dns1gw'] = $config['system']['dns1gw']; $pconfig['dns2gw'] = $config['system']['dns2gw']; $pconfig['dns3gw'] = $config['system']['dns3gw']; $pconfig['dns4gw'] = $config['system']['dns4gw']; $pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']); $pconfig['timezone'] = $config['system']['timezone']; $pconfig['timeupdateinterval'] = $config['system']['time-update-interval']; $pconfig['timeservers'] = $config['system']['timeservers']; $pconfig['theme'] = $config['system']['theme']; $pconfig['language'] = $config['system']['language']; $pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']); if (!isset($pconfig['timeupdateinterval'])) $pconfig['timeupdateinterval'] = 300; if (!$pconfig['timezone']) $pconfig['timezone'] = "Etc/UTC"; if (!$pconfig['timeservers']) $pconfig['timeservers'] = "pool.ntp.org"; $changedesc = gettext("System") . ": "; $changecount = 0; function is_timezone($elt) { return !preg_match("/\/$/", $elt); } if($pconfig['timezone'] <> $_POST['timezone']) { filter_pflog_start(true); } exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist); $timezonelist = array_filter($timezonelist, 'is_timezone'); sort($timezonelist); $multiwan = false; $interfaces = get_configured_interface_list(); foreach($interfaces as $interface) { if(interface_has_gateway($interface)) { $multiwan = true; } } if ($_POST) { $changecount++; unset($input_errors); $pconfig = $_POST; /* input validation */ $reqdfields = explode(" ", "hostname domain"); $reqdfieldsn = array(gettext("Hostname"),gettext("Domain")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); if ($_POST['hostname'] && !is_hostname($_POST['hostname'])) { $input_errors[] = gettext("The hostname may only contain the characters a-z, 0-9 and '-'."); } if ($_POST['domain'] && !is_domain($_POST['domain'])) { $input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'."); } for ($dnscounter=1; $dnscounter<5; $dnscounter++){ $dnsname="dns{$dnscounter}"; $dnsgwname="dns{$dnscounter}gw"; if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) { $input_errors[] = gettext("A valid IP address must be specified for the DNS server $dnscounter."); } if(($_POST[$dnsgwname] <> "") && (is_ipaddr($_POST[$dnsname]))) { if (($_POST[$dnsgwname] <> "none") && (is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false )) { $input_errors[] = gettext("You can not specify a IPv6 gateway '{$_POST[$dnsgwname]}'for a IPv4 DNS server '{$_POST[$dnsname]}'"); } if (($_POST[$dnsgwname] <> "none") && (is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false )) { $input_errors[] = gettext("You can not specify a IPv4 gateway '{$_POST[$dnsgwname]}'for a IPv6 DNS server '{$_POST[$dnsname]}'"); } } } if ($_POST['webguiport'] && (!is_numericint($_POST['webguiport']) || ($_POST['webguiport'] < 1) || ($_POST['webguiport'] > 65535))) { $input_errors[] = gettext("A valid TCP/IP port must be specified for the webConfigurator port."); } $direct_networks_list = explode(" ", filter_get_direct_networks_list()); for ($dnscounter=1; $dnscounter<5; $dnscounter++) { $dnsitem = "dns{$dnscounter}"; $dnsgwitem = "dns{$dnscounter}gw"; if ($_POST[$dnsgwitem]) { if(interface_has_gateway($_POST[$dnsgwitem])) { foreach($direct_networks_list as $direct_network) { if(ip_in_subnet($_POST[$dnsitem], $direct_network)) { $input_errors[] = sprintf(gettext("You can not assign a gateway to DNS '%s' server which is on a directly connected network."),$_POST[$dnsitem]); } } } } } $t = (int)$_POST['timeupdateinterval']; if (($t < 0) || (($t > 0) && ($t < 6)) || ($t > 1440)) { $input_errors[] = gettext("The time update interval must be either 0 (disabled) or between 6 and 1440."); } foreach (explode(' ', $_POST['timeservers']) as $ts) { if (!is_domain($ts)) { $input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'."); } } if (!$input_errors) { update_if_changed("hostname", $config['system']['hostname'], strtolower($_POST['hostname'])); update_if_changed("domain", $config['system']['domain'], strtolower($_POST['domain'])); update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']); update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers'])); update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']); if($_POST['language'] && $_POST['language'] != $config['system']['language']) { $config['system']['language'] = $_POST['language']; set_language($config['system']['language']); } /* pfSense themes */ if (! $g['disablethemeselection']) { update_if_changed("System Theme", $config['theme'], $_POST['theme']); } /* XXX - billm: these still need updating after figuring out how to check if they actually changed */ unset($config['system']['dnsserver']); if ($_POST['dns1']) $config['system']['dnsserver'][] = $_POST['dns1']; if ($_POST['dns2']) $config['system']['dnsserver'][] = $_POST['dns2']; if ($_POST['dns3']) $config['system']['dnsserver'][] = $_POST['dns3']; if ($_POST['dns4']) $config['system']['dnsserver'][] = $_POST['dns4']; $olddnsallowoverride = $config['system']['dnsallowoverride']; unset($config['system']['dnsallowoverride']); $config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false; if($_POST['dnslocalhost'] == "yes") $config['system']['dnslocalhost'] = true; else unset($config['system']['dnslocalhost']); /* which interface should the dns servers resolve through? */ for ($dnscounter=1; $dnscounter<5; $dnscounter++) { $dnsname="dns{$dnscounter}"; $dnsgwname="dns{$dnscounter}gw"; if($_POST[$dnsgwname]) { $config['system'][$dnsgwname] = $pconfig[$dnsgwname]; } else { unset($config['system'][$dnsgwname]); } } if ($changecount > 0) write_config($changedesc); $retval = 0; $retval = system_hostname_configure(); $retval |= system_hosts_generate(); $retval |= system_resolvconf_generate(); $retval |= services_dnsmasq_configure(); $retval |= system_timezone_configure(); $retval |= system_ntp_configure(); if ($olddnsallowoverride != $config['system']['dnsallowoverride']) $retval |= send_event("service reload dns"); // Reload the filter - plugins might need to be run. $retval |= filter_configure(); $savemsg = get_std_save_message($retval); } } $pgtitle = array(gettext("System"),gettext("General Setup")); include("head.inc"); ?>


firewall








/>


/>


 
  .
 
  " />