From 58851f1c7f48cbe513e9bd0579f741431c687627 Mon Sep 17 00:00:00 2001 From: Perry Mason Date: Tue, 17 Mar 2009 19:47:20 +0100 Subject: dns server 3th and 4th option added --- config/Fit123/bin/dnssrv/system.abc | 347 ++++++++++++++++++++++++++++++++++++ 1 file changed, 347 insertions(+) create mode 100755 config/Fit123/bin/dnssrv/system.abc (limited to 'config/Fit123/bin/dnssrv/system.abc') diff --git a/config/Fit123/bin/dnssrv/system.abc b/config/Fit123/bin/dnssrv/system.abc new file mode 100755 index 00000000..24021aab --- /dev/null +++ b/config/Fit123/bin/dnssrv/system.abc @@ -0,0 +1,347 @@ +. + 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['hostname'] = $config['system']['hostname']; +$pconfig['domain'] = $config['system']['domain']; +list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['system']['dnsserver']; + +$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']); +$pconfig['username'] = $config['system']['username']; +if (!$pconfig['username']) + $pconfig['username'] = "admin"; +$pconfig['webguiproto'] = $config['system']['webgui']['protocol']; +if (!$pconfig['webguiproto']) + $pconfig['webguiproto'] = "http"; +$pconfig['webguiport'] = $config['system']['webgui']['port']; +$pconfig['timezone'] = $config['system']['timezone']; +$pconfig['timeupdateinterval'] = $config['system']['time-update-interval']; +$pconfig['timeservers'] = $config['system']['timeservers']; +$pconfig['theme'] = $config['system']['theme']; + +if (!isset($pconfig['timeupdateinterval'])) + $pconfig['timeupdateinterval'] = 300; +if (!$pconfig['timezone']) + $pconfig['timezone'] = "Etc/UTC"; +if (!$pconfig['timeservers']) + $pconfig['timeservers'] = "pool.ntp.org"; + +$changedesc = "System: "; +$changecount = 0; + +function is_timezone($elt) { + return !preg_match("/\/$/", $elt); +} + +if($pconfig['timezone'] <> $_POST['timezone']) { + /* restart firewall log dumper helper */ + require_once("functions.inc"); + $pid = `ps awwwux | grep -v "grep" | grep "tcpdump -v -l -n -e -ttt -i pflog0" | awk '{ print $2 }'`; + if($pid) { + mwexec("kill $pid"); + usleep(1000); + } + filter_pflog_start(); +} + +exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist); +$timezonelist = array_filter($timezonelist, 'is_timezone'); +sort($timezonelist); + +if ($_POST) { + + $changecount++; + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = split(" ", "hostname domain username"); + $reqdfieldsn = split(",", "Hostname,Domain,Username"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + if ($_POST['hostname'] && !is_hostname($_POST['hostname'])) { + $input_errors[] = "The hostname may only contain the characters a-z, 0-9 and '-'."; + } + if ($_POST['domain'] && !is_domain($_POST['domain'])) { + $input_errors[] = "The domain may only contain the characters a-z, 0-9, '-' and '.'."; + } + if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2'])) || ($_POST['dns3'] && !is_ipaddr($_POST['dns3'])) || ($_POST['dns4'] && !is_ipaddr($_POST['dns4']))) { + $input_errors[] = "A valid IP address must be specified for the primary/secondary DNS server."; + } + if ($_POST['username'] && !preg_match("/^[a-zA-Z0-9]*$/", $_POST['username'])) { + $input_errors[] = "The username may only contain the characters a-z, A-Z and 0-9."; + } + if ($_POST['webguiport'] && (!is_numericint($_POST['webguiport']) || + ($_POST['webguiport'] < 1) || ($_POST['webguiport'] > 65535))) { + $input_errors[] = "A valid TCP/IP port must be specified for the webGUI port."; + } + if (($_POST['password']) && ($_POST['password'] != $_POST['password2'])) { + $input_errors[] = "The passwords do not match."; + } + + $t = (int)$_POST['timeupdateinterval']; + if (($t < 0) || (($t > 0) && ($t < 6)) || ($t > 1440)) { + $input_errors[] = "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[] = "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("username", $config['system']['username'], $_POST['username']); + + if (update_if_changed("webgui protocol", $config['system']['webgui']['protocol'], $_POST['webguiproto'])) + $restart_webgui = true; + if (update_if_changed("webgui port", $config['system']['webgui']['port'], $_POST['webguiport'])) + $restart_webgui = true; + + 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']); + + /* pfSense themes */ + 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['password']) { + $config['system']['password'] = crypt($_POST['password']); + update_changedesc("password changed via webConfigurator"); + sync_webgui_passwords(); + } + + if ($changecount > 0) + write_config($changedesc); + + if ($restart_webgui) { + global $_SERVER; + list($host) = explode(":", $_SERVER['HTTP_HOST']); + if ($config['system']['webgui']['port']) { + $url="{$config['system']['webgui']['protocol']}://{$host}:{$config['system']['webgui']['port']}/system.php"; + } else { + $url = "{$config['system']['webgui']['protocol']}://{$host}/system.php"; + } + } + + $retval = 0; + config_lock(); + $retval = system_hostname_configure(); + $retval |= system_hosts_generate(); + $retval |= system_resolvconf_generate(); + $retval |= system_password_configure(); + $retval |= services_dnsmasq_configure(); + $retval |= system_timezone_configure(); + $retval |= system_ntp_configure(); + + if ($olddnsallowoverride != $config['system']['dnsallowoverride']) + $retval |= interfaces_wan_configure(); + + config_unlock(); + + // Reload filter -- plugins might need to run + filter_configure(); + + $savemsg = get_std_save_message($retval); + if ($restart_webgui) + $savemsg .= "
One moment...redirecting to {$url} in 10 seconds."; + } +} + +$pgtitle = "System: General Setup"; +include("head.inc"); + +?> + + + +

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Hostname +
name of the firewall host, without + domain part
+ e.g. firewall
Domain +
e.g. mycorp.com
DNS servers

+ +
+ +
+ +
+ +
+ IP addresses; these are also used for + the DHCP service, DNS forwarder and for PPTP VPN clients
+
+ > + Allow DNS server list to be overridden by DHCP/PPP + on WAN
+ If this option is set, will use DNS servers assigned + by a DHCP/PPP server on WAN for its own purposes (including + the DNS forwarder). They will not be assigned to DHCP and + PPTP VPN clients, though.

Username +
+ If you want + to change the username for accessing the webGUI, enter it + here.
Password +
+  (confirmation)
If you want + to change the password for accessing the webGUI, enter it + here twice.
webGUI protocol > + HTTP     > + HTTPS
webGUI port +
+ Enter a custom port number for the webGUI + above if you want to override the default (80 for HTTP, 443 + for HTTPS). Changes will take effect immediately after save.
Time zone
Select the location closest + to you
NTP time server +
Use a space to separate multiple + hosts (only one required). Remember to set up at least one + DNS server if you enter a host name here!
 
Theme
  + + This will change the look and feel of +
  +
+
+ +"; + } +?> + + + -- cgit v1.2.3