. 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. */ ##|+PRIV ##|*IDENT=page-system-advancedfunctions ##|*NAME=System: Advanced functions page ##|*DESCR=Allow access to the 'System: Advanced functions' page. ##|*MATCH=system_advanced.php* ##|-PRIV 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['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 { if($config['diag']) { if($config['diag']['ipv6nat']) { 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['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(); conf_mount_rw(); setup_serial_port(); conf_mount_ro(); } } $pgtitle = array("System","Advanced functions"); include("head.inc"); ?>

Note: the options on this page are intended for use by advanced users only.


*/ ?>
Enable Serial Console
  onclick="enable_change(false)" /> This will enable the first serial port with 9600/8/N/1
Note: This will disable the internal video card/keyboard
 
Secure Shell
  onclick="enable_change(false)" /> Enable Secure Shell
  onclick="enable_change(false)" /> Disable Password login for Secure Shell (KEY only)
SSH port
Note: Leave this blank for the default of 22

Paste an authorized keys file here.
 
 
Shared Physical Network
  onclick="enable_change(false)" /> This will suppress ARP messages when interfaces share the same physical network
 
 
IPv6 tunneling
  onclick="enable_change(false)" /> NAT encapsulated IPv6 packets (IP protocol 41/RFC2893) to:

 (IP address)
Don't forget to add a firewall rule to permit IPv6 packets!
 
 
 
webConfigurator SSL certificate/key
Certificate
Paste a signed certificate in X.509 PEM format here. Create certificates automatically.
Key
Paste an RSA private key in PEM format here.
 
 
Load Balancing
Load Balancing /> Use sticky connections
Successive connections will be redirected to the servers in a round-robin manner with connections from the same source being sent to the same web server. This "sticky connection" will exist as long as there are states that refer to this connection. Once the states expire, so will the sticky connection. Further connections from that host will be redirected to the next web server in the round robin.
 
 
Miscellaneous
 
Device polling > Use device polling
Device polling is a technique that lets the system periodically poll network devices for new data instead of relying on interrupts. This prevents your webConfigurator, SSH, etc. from being inaccessible due to interrupt floods when under extreme load. Generally this is not recommended. Not all NICs support polling; see the homepage for a list of supported cards.
Console menu /> Password protect the console menu
Changes to this option will take effect after a reboot.
Hard disk standby time
Puts the hard disk into standby mode when the selected amount of time after the last access has elapsed. Do not set this for CF cards.
webConfigurator anti-lockout /> Disable webConfigurator anti-lockout rule
By default, access to the webConfigurator on the {$lockout_interface} interface is always permitted, regardless of the user-defined filter rule set. Enable this feature to control webConfigurator access (make sure to have a filter rule in place that allows you in, or you will lock yourself out!).
Hint: the "set configure IP address" option in the console menu resets this setting as well.
Static route filtering /> Bypass firewall rules for traffic on the same interface
This option only applies if you have defined one or more static routes. If it is enabled, traffic that enters and leaves through the same interface will not be checked by the firewall. This may be desirable in some situations where multiple subnets are connected to the same interface.
IPsec SA preferral /> Prefer old IPsec SAs
By default, if several SAs match, the newest one is preferred if it's at least 30 seconds old.Select this option to always prefer old SAs over new ones.
 
 
Traffic Shaper and Firewall Advanced
Traffic shaper type
FTP RFC 959 data port violation workaround onclick="enable_change(false)" /> Workaround for sites that violate RFC 959 which specifies that the data connection be sourced from the command port - 1 (typically port 20). This workaround doesn't expose you to any extra risk as the firewall will still only allow connections on a port that the ftp-proxy is listening on.
Clear DF bit instead of dropping onclick="enable_change(false)" /> Workaround for operating systems that generate fragmented packets with the don't fragment (DF) bit set. Linux NFS is known to do this. This will cause the filter to not drop such packets but instead clear the don't fragment bit. The filter will also randomize the IP identification field of outgoing packets with this option on, to compensate for operating systems that set the DF bit but set a zero IP identification header field.
Firewall Optimization Options

Select which type of state table optimization your would like to use
Disable Firewall onclick="enable_change(false)" /> Disable all packet filtering.
Note: This converts into a routing only platform!
Note: This will turn off NAT!
Disable Firewall Scrub onclick="enable_change(false)" /> Disables the PF scrubbing option which can sometimes interfere with NFS and PPTP traffic.
Click here for more information.
Firewall Maximum States
Maximum number of connections to hold in the firewall state table.
Note: Leave this blank for the default. On your system the default size is:
 
 
Network Address Translation
Disable NAT Reflection onclick="enable_change(false)" /> Disables the automatic creation of NAT redirect rules for access to your public IP addresses from within your internal networks. Note: Reflection only works on port forward type items and does not work for large ranges > 500 ports.
Reflection Timeout Enter value for Reflection timeout in seconds.
 
 
Hardware Checksum Offloading
Disable Hardware Checksum Offloading onclick="enable_change(false)" /> Checking this option will prevent hardware checksum offloading. FreeBSD sometimes has difficulties with certain drivers.