summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xusr/local/www/fbegin.inc13
-rw-r--r--usr/local/www/firewall_system_tunables.php147
-rw-r--r--usr/local/www/firewall_system_tunables_edit.php138
-rw-r--r--usr/local/www/javascript/system_advanced/system_advanced.js27
-rwxr-xr-xusr/local/www/system_advanced.php711
-rw-r--r--usr/local/www/system_advanced_admin.php332
-rwxr-xr-xusr/local/www/system_advanced_create_certs.php269
-rw-r--r--usr/local/www/system_advanced_firewall.php329
-rw-r--r--usr/local/www/system_advanced_misc.php237
-rw-r--r--usr/local/www/system_advanced_network.php236
-rw-r--r--usr/local/www/system_advanced_sysctl.php269
11 files changed, 1409 insertions, 1299 deletions
diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc
index 1678412..fe1aaa8 100755
--- a/usr/local/www/fbegin.inc
+++ b/usr/local/www/fbegin.inc
@@ -118,20 +118,19 @@ if ($_REQUEST['noticeaction'] == 'acknowledge') {
<li class="firstdrop">
<div>System</div>
<ul class="subdrop">
- <?php
- output_menu_item("/system_advanced.php", "Advanced");
+ <?php
+ output_menu_item("/system_advanced_admin.php", "Advanced");
output_menu_item("/system_firmware.php", "Firmware");
output_menu_item("/system.php", "General Setup");
- ?>
- <li><a href="/index.php?logout" class="navlnk">Logout</a></li>
+ ?>
<?php if($g['platform'] == "pfSense"): ?>
- <?=output_menu_item("/pkg_mgr.php", "Packages");?>
+ <?=output_menu_item("/pkg_mgr.php", "Packages");?>
<?php endif; ?>
<?=output_menu_item("/wizard.php?xml=setup_wizard.xml", "Setup Wizard");?>
<?=output_menu_item("/system_gateways.php", "Routing");?>
- <?=output_menu_item("/firewall_system_tunables.php", "Tunables");?>
<?=output_menu_item("/system_camanager.php", "Cert Manager");?>
- <?=output_menu_item("/system_usermanager.php", "User Manager");?>
+ <?=output_menu_item("/system_usermanager.php", "User Manager");?>
+ <li><a href="/index.php?logout" class="navlnk">Logout</a></li>
</ul>
</li>
<li class="drop">
diff --git a/usr/local/www/firewall_system_tunables.php b/usr/local/www/firewall_system_tunables.php
deleted file mode 100644
index 6c30249..0000000
--- a/usr/local/www/firewall_system_tunables.php
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-/* $Id$ */
-/*
- firewall_virtual_ip.php
- part of pfSense (http://www.pfsense.com/)
- Copyright (C) 2004-2005 Scott Ullrich <geekgod@pfsense.com>.
- 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-firewall-system-tunables
-##|*NAME=Firewall: System: Tunables page
-##|*DESCR=Allow access to the 'Firewall: System: Tunables' page.
-##|*MATCH=firewall_system_tunables.php*
-##|-PRIV
-
-
-$pgtitle = array("System","Tunables");
-
-require("guiconfig.inc");
-
-if (!is_array($config['sysctl']['item']))
- $config['sysctl']['item'] = array();
-
-$a_tunable = &$config['sysctl']['item'];
-
-if ($_POST) {
- $pconfig = $_POST;
-
- if ($_POST['apply']) {
- $retval = 0;
- $savemsg = get_std_save_message($retval);
- unlink_if_exists($d_sysctldirty_path);
- }
-}
-
-if ($_GET['act'] == "del") {
- if ($a_tunable[$_GET['id']]) {
- /* if this is an AJAX caller then handle via JSON */
- if(isAjax() && is_array($input_errors)) {
- input_errors2Ajax($input_errors);
- exit;
- }
-
- if (!$input_errors) {
- unset($a_tunable[$_GET['id']]);
- write_config();
- touch($d_sysctldirty_path);
- pfSenseHeader("firewall_system_tunables.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
-<?php include("fbegin.inc"); ?>
- <form action="firewall_system_tunables.php" method="post">
- <div id="inputerrors"></div>
- <?php
- if ($input_errors)
- print_input_errors($input_errors);
- if ($savemsg)
- print_info_box($savemsg);
- if (file_exists($d_sysctldirty_path))
- print_info_box_np("The firewall tunables have changed. You must apply the configuration to take affect.");
-?>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Tunable Name</td>
- <td width="60%" class="listhdrr">Description</td>
- <td width="20%" class="listhdrr">Value</td>
- </tr>
- <?php $i = 0; foreach ($config['sysctl']['item'] as $tunable): ?>
- <tr>
- <td class="listlr" ondblclick="document.location='firewall_system_tunables_edit.php?id=<?=$i;?>';">
- <?php echo $tunable['tunable']; ?>
- </td>
- <td class="listr" align="left" ondblclick="document.location='firewall_system_tunables_edit.php?id=<?=$i;?>';">
- <?php echo $tunable['desc']; ?>
- </td>
- <td class="listr" align="left" ondblclick="document.location='firewall_system_tunables_edit.php?id=<?=$i;?>';">
- <?php echo $tunable['value']; ?>
- </td>
- <td class="list" nowrap>
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle">
- <a href="firewall_system_tunables_edit.php?id=<?=$i;?>">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="" />
- </a>
- </td>
- <td valign="middle">
- <a href="firewall_system_tunables.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('Do you really want to delete this entry?')">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="" />
- </a>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <?php $i++; endforeach; ?>
- <tr>
- <td class="list" colspan="3">
- </td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle">
- <a href="firewall_system_tunables_edit.php">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="" />
- </a>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </div>
- </form>
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/usr/local/www/firewall_system_tunables_edit.php b/usr/local/www/firewall_system_tunables_edit.php
deleted file mode 100644
index f497ffc..0000000
--- a/usr/local/www/firewall_system_tunables_edit.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/* $Id$ */
-/*
- firewall_virtual_ip_edit.php
- part of pfSense (http://www.pfsense.com/)
- Copyright (C) 2004-2005 Scott Ullrich <geekgod@pfsense.com>.
- 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-firewall-system-tunables-edit
-##|*NAME=Firewall: System: Tunables: Edit page
-##|*DESCR=Allow access to the 'Firewall: System: Tunables: Edit' page.
-##|*MATCH=firewall_system_tunables_edit.php*
-##|-PRIV
-
-
-$pgtitle = array("Firewall","System Tunables","Edit");
-
-require("guiconfig.inc");
-if (!is_array($config['sysctl']['item'])) {
- $config['sysctl']['item'] = array();
-}
-$a_tunable = &$config['sysctl']['item'];
-
-if (isset($_POST['id']))
- $id = $_POST['id'];
-else
- $id = $_GET['id'];
-
-if (isset($id) && $a_tunable[$id]) {
- $pconfig['tunable'] = $a_tunable[$id]['tunable'];
- $pconfig['value'] = $a_tunable[$id]['value'];
- $pconfig['desc'] = $a_tunable[$id]['desc'];
-}
-
-if ($_POST) {
- unset($input_errors);
- $pconfig = $_POST;
-
- /* if this is an AJAX caller then handle via JSON */
- if(isAjax() && is_array($input_errors)) {
- input_errors2Ajax($input_errors);
- exit;
- }
-
- if (!$input_errors) {
- $tunableent = array();
-
- $tunableent['tunable'] = $_POST['tunable'];
- $tunableent['value'] = $_POST['value'];
- $tunableent['desc'] = $_POST['desc'];
-
- if (isset($id) && $a_tunable[$id]) {
- $a_tunable[$id] = $tunableent;
- } else
- $a_tunable[] = $tunableent;
-
- touch($d_sysctldirty_path);
-
- write_config();
-
- pfSenseHeader("firewall_system_tunables.php");
-
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
-<?php include("fbegin.inc"); ?>
-<div id="inputerrors"></div>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
- <form action="firewall_system_tunables_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td colspan="2" valign="top" class="listtopic">Edit system tunable</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Tunable</td>
- <td width="78%" class="vtable">
- <input size="65" name="tunable" value="<?php echo $pconfig['tunable']; ?>">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Description</td>
- <td width="78%">
- <textarea rows="7" cols="50" name="desc"><?php echo $pconfig['desc']; ?></textarea>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Value</td>
- <td width="78%">
- <input size="65" name="value" value="<?php echo $pconfig['value']; ?>">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input id="submit" name="Submit" type="submit" class="formbtn" value="Save" />
- <input id="cancelbutton" name="cancelbutton" type="button" class="formbtn" value="Cancel" onclick="history.back()" />
- <?php if (isset($id) && $a_tunable[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>" />
- <?php endif; ?>
- </td>
- </tr>
- </table>
-</form>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/usr/local/www/javascript/system_advanced/system_advanced.js b/usr/local/www/javascript/system_advanced/system_advanced.js
deleted file mode 100644
index a7e69ad..0000000
--- a/usr/local/www/javascript/system_advanced/system_advanced.js
+++ /dev/null
@@ -1,27 +0,0 @@
-function enable_change(enable_over) {
- if (document.iform.ipv6nat_enable.checked || enable_over) {
- document.iform.ipv6nat_ipaddr.disabled = 0;
- } else {
- document.iform.ipv6nat_ipaddr.disabled = 1;
- }
-}
-
-var descs=new Array(5);
-descs[0]="as the name says, it's the normal optimization algorithm";
-descs[1]="used for high latency links, such as satellite links. Expires idle connections later than default";
-descs[2]="expires idle connections quicker. More efficient use of CPU and memory but can drop legitimate connections";
-descs[3]="tries to avoid dropping any legitimate connections at the expense of increased memory usage and CPU utilization.";
-
-function update_description(itemnum) {
- document.forms[0].info.value=descs[itemnum];
-
-}
-
-function openwindow(url) {
- var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
- if (oWin==null || typeof(oWin)=="undefined") {
- return false;
- } else {
- return true;
- }
-}
diff --git a/usr/local/www/system_advanced.php b/usr/local/www/system_advanced.php
deleted file mode 100755
index f02e58e..0000000
--- a/usr/local/www/system_advanced.php
+++ /dev/null
@@ -1,711 +0,0 @@
-<?php
-/* $Id$ */
-/*
- system_advanced.php
- part of pfSense
- Copyright (C) 2005-2007 Scott Ullrich
-
- originally part of m0n0wall (http://m0n0.ch/wall)
- Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
- 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");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php include("fbegin.inc"); ?>
-<form action="system_advanced.php" method="post" name="iform" id="iform">
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-<?php if ($savemsg) print_info_box($savemsg); ?>
-<p><span class="vexpl"><span class="red"><strong>Note: </strong></span>the options on this page are intended for use by advanced users only.</span></p>
-<br />
-
-<table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tbody>
- <?php if($g['platform'] == "pfSense" || $g['platform'] == "cdrom"): ?>
- <tr>
- <td colspan="2" valign="top" class="listtopic">Enable Serial Console</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">&nbsp;</td>
- <td width="78%" class="vtable">
- <input name="enableserial" type="checkbox" id="enableserial" value="yes" <?php if (isset($pconfig['enableserial'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong>This will enable the first serial port with 9600/8/N/1</strong>
- <br>
- <span class="vexpl">Note: This will disable the internal video card/keyboard</span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
- </tr>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12"></td>
- </tr>
- <?php endif; ?>
- <tr>
- <td colspan="2" valign="top" class="listtopic">Secure Shell</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">&nbsp;</td>
- <td width="78%" class="vtable">
- <input name="enablesshd" type="checkbox" id="enablesshd" value="yes" <?php if (isset($pconfig['enablesshd'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong>Enable Secure Shell</strong>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">&nbsp;</td>
- <td width="78%" class="vtable">
- <input name="sshdkeyonly" type="checkbox" id="sshdkeyonly" value="yes" <?php if (isset($pconfig['sshdkeyonly'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong>Disable Password login for Secure Shell (KEY only)</strong>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">SSH port</td>
- <td width="78%" class="vtable">
- <input name="sshport" type="text" id="sshport" value="<?php echo $pconfig['sshport']; ?>" onclick="enable_change(false)" />
- <br />
- <span class="vexpl">Note: Leave this blank for the default of 22</span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Authorizedkeys");?></td>
- <td width="78%" class="vtable">
- <textarea name="authorizedkeys" cols="65" rows="7" id="authorizedkeys" class="formfld_cert"><?=htmlspecialchars($pconfig['authorizedkeys']);?></textarea>
- <br />
- Paste an authorized keys file here.
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
- </td>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="listtopic">Shared Physical Network</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">&nbsp;</td>
- <td width="78%" class="vtable">
- <input name="sharednet" type="checkbox" id="sharednet" value="yes" <?php if (isset($pconfig['sharednet'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong>This will suppress ARP messages when interfaces share the same physical network</strong>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
- </td>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="listtopic">IPv6 tunneling</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">&nbsp;</td>
- <td width="78%" class="vtable">
- <input name="ipv6nat_enable" type="checkbox" id="ipv6nat_enable" value="yes" <?php if ($pconfig['ipv6nat_enable']) echo "checked"; ?> onclick="enable_change(false)" />
- <strong>NAT encapsulated IPv6 packets (IP protocol 41/RFC2893) to:</strong>
- <br /> <br />
- <input name="ipv6nat_ipaddr" type="text" class="formfld unknown" id="ipv6nat_ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipv6nat_ipaddr']);?>" />
- &nbsp;(IP address)<span class="vexpl"><br /> Don't forget to add a firewall rule to permit IPv6 packets!</span>
- </td>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
- </td>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="listtopic">webConfigurator SSL certificate/key</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Certificate</td>
- <td width="78%" class="vtable">
- <textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
- <br />
- Paste a signed certificate in X.509 PEM format here. <a href="javascript:if(openwindow('system_advanced_create_certs.php') == false) alert('Popup blocker detected. Action aborted.');" >Create</a> certificates automatically.
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Key</td>
- <td width="78%" class="vtable">
- <textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
- <br />
- Paste an RSA private key in PEM format here.
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
- </td>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
-
- <tr>
- <td colspan="2" valign="top" class="listtopic">Load Balancing</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Load Balancing</td>
- <td width="78%" class="vtable">
- <input name="lb_use_sticky" type="checkbox" id="lb_use_sticky" value="yes" <?php if ($pconfig['lb_use_sticky']) echo "checked=\"checked\""; ?> />
- <strong>Use sticky connections</strong>
- <br />
- <span class="vexpl">
- 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.
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
- </td>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
-
- <tr>
- <td colspan="2" valign="top" class="listtopic">Miscellaneous</td>
- </tr>
-
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
-
-
- <tr>
- <td width="22%" valign="top" class="vncell">Device polling</td>
- <td width="78%" class="vtable">
- <input name="polling_enable" type="checkbox" id="polling_enable" value="yes" <?php if ($pconfig['polling_enable']) echo "checked"; ?>>
- <strong>Use device polling</strong><br>
- 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 <?= $g['product_name'] ?> homepage for a list of supported cards.
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Console menu </td>
- <td width="78%" class="vtable">
- <input name="disableconsolemenu" type="checkbox" id="disableconsolemenu" value="yes" <?php if ($pconfig['disableconsolemenu']) echo "checked"; ?> />
- <strong>Password protect the console menu</strong>
- <br />
- <span class="vexpl">Changes to this option will take effect after a reboot.</span>
- </td>
- </tr>
-<?php if($g['platform'] == "pfSenseDISABLED"): ?>
- <tr>
- <td width="22%" valign="top" class="vncell">Hard disk standby time </td>
- <td width="78%" class="vtable">
- <select name="harddiskstandby" class="formselect">
-<?php
- ## Values from ATA-2 http://www.t13.org/project/d0948r3-ATA-2.pdf (Page 66)
- $sbvals = explode(" ", "0.5,6 1,12 2,24 3,36 4,48 5,60 7.5,90 10,120 15,180 20,240 30,241 60,242");
-?>
- <option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected');?>>Always on</option>
-<?php
- foreach ($sbvals as $sbval):
- list($min,$val) = explode(",", $sbval); ?>
- <option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected');?>><?=$min;?> minutes</option>
-<?php endforeach; ?>
- </select>
- <br />
- Puts the hard disk into standby mode when the selected amount of time after the last
- access has elapsed. <em>Do not set this for CF cards.</em>
- </td>
- </tr>
-<?php endif; ?>
-<?php
- if($config['interfaces']['lan'])
- $lockout_interface = "LAN";
- else
- $lockout_interface = "WAN";
-?>
- <tr>
- <td width="22%" valign="top" class="vncell">webConfigurator anti-lockout</td>
- <td width="78%" class="vtable">
- <input name="noantilockout" type="checkbox" id="noantilockout" value="yes" <?php if ($pconfig['noantilockout']) echo "checked"; ?> />
- <strong>Disable webConfigurator anti-lockout rule</strong>
- <br />
- 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!).
- <br />
- Hint: the &quot;set configure IP address&quot; option in the console menu resets this setting as well.
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Static route filtering</td>
- <td width="78%" class="vtable">
- <input name="bypassstaticroutes" type="checkbox" id="bypassstaticroutes" value="yes" <?php if ($pconfig['bypassstaticroutes']) echo "checked"; ?> />
- <strong>Bypass firewall rules for traffic on the same interface</strong>
- <br />
- 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.
- <br />
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">IPsec SA preferral</td>
- <td width="78%" class="vtable">
- <input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked"; ?> />
- <strong>Prefer old IPsec SAs</strong>
- <br />
- 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.
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
- </td>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="listtopic">Traffic Shaper and Firewall Advanced</td>
- </tr>
-<?php
-/*
- <tr>
- <td width="22%" valign="top" class="vncell">Traffic shaper type</td>
- <td width="78%" class="vtable">
- <select name="shapertype" class="formselect">
- <option value="pfSense"<?php if($pconfig['shapertype'] == 'pfSense') echo " selected"; ?>><?= $g['product_name'] ?> (ALTQ)</option>
- <option value="m0n0"<?php if($pconfig['shapertype'] == 'm0n0') echo " selected"; ?>>M0n0wall (dummynet)</option>
- </select>
- </td>
- </tr>
-*/
-?>
- <tr>
- <td width="22%" valign="top" class="vncell">FTP RFC 959 data port violation workaround</td>
- <td width="78%" class="vtable">
- <input name="rfc959workaround" type="checkbox" id="rfc959workaround" value="yes" <?php if (isset($config['system']['rfc959workaround'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong class="vexpl">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.</strong>
- <br />
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Clear DF bit instead of dropping</td>
- <td width="78%" class="vtable">
- <input name="scrubnodf" type="checkbox" id="scrubnodf" value="yes" <?php if (isset($config['system']['scrubnodf'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong class="vexpl">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.</strong>
- <br />
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Firewall Optimization Options</td>
- <td width="78%" class="vtable">
- <select onChange="update_description(this.selectedIndex);" name="optimization" id="optimization">
- <option value="normal"<?php if($config['system']['optimization']=="normal") echo " selected"; ?>>normal</option>
- <option value="high-latency"<?php if($config['system']['optimization']=="high-latency") echo " selected"; ?>>high-latency</option>
- <option value="aggressive"<?php if($config['system']['optimization']=="aggressive") echo " selected"; ?>>aggressive</option>
- <option value="conservative"<?php if($config['system']['optimization']=="conservative") echo " selected"; ?>>conservative</option>
- </select>
- <br />
- <textarea cols="60" rows="2" id="info" name="info"style="padding:5px; border:1px dashed #990000; background-color: #ffffff; color: #000000; font-size: 8pt;"></textarea>
- <script language="javascript" type="text/javascript">
- update_description(document.forms[0].optimization.selectedIndex);
- </script>
- <br />
- <span class="vexpl"><b>Select which type of state table optimization your would like to use</b></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Disable Firewall</td>
- <td width="78%" class="vtable">
- <input name="disablefilter" type="checkbox" id="disablefilter" value="yes" <?php if (isset($config['system']['disablefilter'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong>Disable all packet filtering.</strong>
- <br />
- <span class="vexpl">Note: This converts <?= $g['product_name'] ?> into a routing only platform!<br>
- Note: This will turn off NAT!
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Disable Firewall Scrub</td>
- <td width="78%" class="vtable">
- <input name="disablescrub" type="checkbox" id="disablescrub" value="yes" <?php if (isset($config['system']['disablescrub'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong>Disables the PF scrubbing option which can sometimes interfere with NFS and PPTP traffic.</strong>
- <br/>
- Click <a href='http://www.openbsd.org/faq/pf/scrub.html' target='_new'>here</a> for more information.
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Firewall Maximum States</td>
- <td width="78%" class="vtable">
- <input name="maximumstates" type="text" id="maximumstates" value="<?php echo $pconfig['maximumstates']; ?>" onclick="enable_change(false)" />
- <br />
- <strong>Maximum number of connections to hold in the firewall state table.</strong>
- <br />
- <span class="vexpl">Note: Leave this blank for the default. On your system the default size is: <?= pfsense_default_state_size() ?></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
- </tr>
- <?php if($config['interfaces']['lan']): ?>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="listtopic">Network Address Translation</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Disable NAT Reflection</td>
- <td width="78%" class="vtable">
- <input name="disablenatreflection" type="checkbox" id="disablenatreflection" value="yes" <?php if (isset($config['system']['disablenatreflection'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong>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.</strong>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Reflection Timeout</td>
- <td width="78%" class="vtable">
- <input name="reflectiontimeout" id="reflectiontimeout" value="<?php echo $config['system']['reflectiontimeout']; ?>" />
- <strong>Enter value for Reflection timeout in seconds.</strong>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
- </tr>
-<?php endif; ?>
-
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="listtopic">Hardware Checksum Offloading</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Disable Hardware Checksum Offloading</td>
- <td width="78%" class="vtable">
- <input name="disablechecksumoffloading" type="checkbox" id="disablechecksumoffloading" value="yes" <?php if (isset($config['system']['disablechecksumoffloading'])) echo "checked"; ?> onclick="enable_change(false)" />
- <strong>Checking this option will prevent hardware checksum offloading. FreeBSD sometimes has difficulties with certain drivers.</strong>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
- </tr>
- <tr>
- <td colspan="2" class="list" height="12">&nbsp;</td>
- </tr>
- </tbody>
-</table>
-</form>
-
-<script language="JavaScript" type="text/javascript">
-<!--
- enable_change(false);
-//-->
-</script>
-
-<?php include("fend.inc"); ?>
-
-</body>
-</html>
-
-<?php
-
-if($_POST['cert'] || $_POST['key']) {
- if (($config['system']['webgui']['certificate'] != $oldcert)
- || ($config['system']['webgui']['private-key'] != $oldkey)) {
- ob_flush();
- flush();
- log_error("webConfigurator certificates have changed. Restarting webConfigurator.");
- sleep(1);
- touch("/tmp/restart_webgui");
- }
-}
-
-?>
diff --git a/usr/local/www/system_advanced_admin.php b/usr/local/www/system_advanced_admin.php
new file mode 100644
index 0000000..821fc60
--- /dev/null
+++ b/usr/local/www/system_advanced_admin.php
@@ -0,0 +1,332 @@
+<?php
+/* $Id$ */
+/*
+ system_advanced_admin.php
+ part of pfSense
+ Copyright (C) 2005-2007 Scott Ullrich
+
+ Copyright (C) 2008 Shrew Soft Inc
+
+ originally part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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-advanced-admin
+##|*NAME=System: Advanced: Admin Access Page
+##|*DESCR=Allow access to the 'System: Advanced: Admin Access' page.
+##|*MATCH=system_advanced_admin.php*
+##|-PRIV
+
+
+require("guiconfig.inc");
+
+$pconfig['cert'] = base64_decode($config['system']['webgui']['certificate']);
+$pconfig['key'] = base64_decode($config['system']['webgui']['private-key']);
+$pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']);
+$pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']);
+$pconfig['enableserial'] = $config['system']['enableserial'];
+$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']);
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if (($_POST['cert'] && !$_POST['key']) || ($_POST['key'] && !$_POST['cert']))
+ $input_errors[] = "Certificate and key must always be specified together.";
+
+ 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['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']);
+
+ ob_flush();
+ flush();
+
+ if (!$input_errors) {
+
+ $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);
+ }
+
+ if ($_POST['noantilockout'] == "yes")
+ $config['system']['webgui']['noantilockout'] = true;
+ else
+ unset($config['system']['webgui']['noantilockout']);
+
+ if ($_POST['enableserial'] == "yes")
+ $config['system']['enableserial'] = true;
+ else
+ unset($config['system']['enableserial']);
+
+ 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'];
+
+ if ($_POST['sshdkeyonly'] == "yes") {
+ $config['system']['sshdkeyonly'] = true;
+ touch("{$g['tmp_path']}/start_sshd");
+ } else {
+ unset($config['system']['sshdkeyonly']);
+ mwexec("/usr/bin/killall sshd");
+ }
+
+ $config['system']['ssh']['port'] = $_POST['sshport'];
+ $config['system']['ssh']['authorizedkeys'] = base64_encode($_POST['authorizedkeys']);
+
+ write_config();
+
+ 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: Admin Access");
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php
+ include("fbegin.inc");
+ if ($input_errors)
+ print_input_errors($input_errors);
+ if ($savemsg)
+ print_info_box($savemsg);
+?>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+ <span class="vexpl">
+ <span class="red">
+ <strong>Note:</strong>
+ </span>
+ the options on this page are intended for use by advanced users only.
+ <br/>
+ </span>
+ <br/>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+ <ul id="tabnav">
+ <?php
+ $tab_array = array();
+ $tab_array[] = array("Admin Access", true, "system_advanced_admin.php");
+ $tab_array[] = array("Firewall / NAT", false, "system_advanced_firewall.php");
+ $tab_array[] = array("Networking", false, "system_advanced_network.php");
+ $tab_array[] = array("Miscellaneous", false, "system_advanced_misc.php");
+ $tab_array[] = array("System Tunables", false, "system_advanced_sysctl.php");
+ display_top_tabs($tab_array);
+ ?>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabcont">
+ <form action="system_advanced_admin.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">webConfigurator</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Certificate</td>
+ <td width="78%" class="vtable">
+ <textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
+ <br/>
+ Paste a signed certificate in X.509 PEM format here. <a href="javascript:if(openwindow('system_advanced_create_certs.php') == false) alert('Popup blocker detected. Action aborted.');" >Create</a> certificates automatically.
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Key</td>
+ <td width="78%" class="vtable">
+ <textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
+ <br/>
+ Paste an RSA private key in PEM format here.
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Anti-lockout</td>
+ <td width="78%" class="vtable">
+ <?php
+ if($config['interfaces']['lan'])
+ $lockout_interface = "LAN";
+ else
+ $lockout_interface = "WAN";
+ ?>
+ <input name="noantilockout" type="checkbox" id="noantilockout" value="yes" <?php if ($pconfig['noantilockout']) echo "checked"; ?> />
+ <strong>Disable webConfigurator anti-lockout rule</strong>
+ <br/>
+ 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!). <em> Hint: the &quot;set configure IP address&quot;
+ option in the console menu resets this setting as well. </em>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Secure Shell</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Secure Shell Server</td>
+ <td width="78%" class="vtable">
+ <input name="enablesshd" type="checkbox" id="enablesshd" value="yes" <?php if (isset($pconfig['enablesshd'])) echo "checked"; ?> />
+ <strong>Enable Secure Shell</strong>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Authentication Method</td>
+ <td width="78%" class="vtable">
+ <input name="sshdkeyonly" type="checkbox" id="sshdkeyonly" value="yes" <?php if (isset($pconfig['sshdkeyonly'])) echo "checked"; ?> />
+ <strong>Disable Password login for Secure Shell (rsa key only)</strong>
+ <br/>
+ When this option is enabled, you will need to configure
+ allowed keys for each user that has secure shell
+ access.
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">SSH port</td>
+ <td width="78%" class="vtable">
+ <input name="sshport" type="text" id="sshport" value="<?php echo $pconfig['sshport']; ?>" />
+ <br/>
+ <span class="vexpl">Note: Leave this blank for the default of 22</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Authorizedkeys");?></td>
+ <td width="78%" class="vtable">
+ <textarea name="authorizedkeys" cols="65" rows="7" id="authorizedkeys" class="formfld_cert"><?=htmlspecialchars($pconfig['authorizedkeys']);?></textarea>
+ <br/>
+ Paste an authorized keys file here.
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <?php if($g['platform'] == "pfSense" || $g['platform'] == "cdrom"): ?>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Serial Communcations</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Serial Terminal</td>
+ <td width="78%" class="vtable">
+ <input name="enableserial" type="checkbox" id="enableserial" value="yes" <?php if (isset($pconfig['enableserial'])) echo "checked"; ?> />
+ <strong>This will enable the first serial port with 9600/8/N/1</strong>
+ <br>
+ <span class="vexpl">Note: This will disable the internal video card/keyboard</span>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <?php endif; ?>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Shell Options</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Console menu</td>
+ <td width="78%" class="vtable">
+ <input name="disableconsolemenu" type="checkbox" id="disableconsolemenu" value="yes" <?php if ($pconfig['disableconsolemenu']) echo "checked"; ?> />
+ <strong>Password protect the console menu</strong>
+ <br/>
+ <span class="vexpl">Changes to this option will take effect after a reboot.</span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" /></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+ </table>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
+
+<?php
+
+if($_POST['cert'] || $_POST['key']) {
+ if (($config['system']['webgui']['certificate'] != $oldcert)
+ || ($config['system']['webgui']['private-key'] != $oldkey)) {
+ ob_flush();
+ flush();
+ log_error("webConfigurator certificates have changed. Restarting webConfigurator.");
+ sleep(1);
+ touch("/tmp/restart_webgui");
+ }
+}
+
+?>
diff --git a/usr/local/www/system_advanced_create_certs.php b/usr/local/www/system_advanced_create_certs.php
deleted file mode 100755
index bc36818..0000000
--- a/usr/local/www/system_advanced_create_certs.php
+++ /dev/null
@@ -1,269 +0,0 @@
-<?php
-/* $Id$ */
-/*
- system_advanced_create_certs.php
- part of pfSense
-
- Copyright (C) 2004 Scott Ullrich
- 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-createcertificates
-##|*NAME=System: Advanced functions: Create Certificates page
-##|*DESCR=Allow access to the 'System: Advanced functions: Create Certificates' page.
-##|*MATCH=system_advanced_create_certs.php*
-##|-PRIV
-
-
-require("guiconfig.inc");
-
-if(file_exists("/var/etc/ssl/openssl.cnf")) {
- $fd = fopen("/var/etc/ssl/openssl.cnf", "r");
- $openssl = fread($fd,8096);
- fclose($fd);
-}
-
-/* Lets match the fileds in the read in file and
- populate the variables for the form */
-preg_match('/C\=(.*)\n/', $openssl, $countrycodeA);
-preg_match('/\nST\=(.*)\n/', $openssl, $stateorprovinceA);
-preg_match('/\nL\=(.*)\n/', $openssl, $citynameA);
-preg_match('/\nO\=(.*)\n/', $openssl, $orginizationnameA);
-preg_match('/\nOU\=(.*)\n/', $openssl, $orginizationdepartmentA);
-preg_match('/\nCN\=(.*)\n/', $openssl, $commonnameA);
-
-$countrycode = $countrycodeA[1];
-$stateorprovince = $stateorprovinceA[1];
-$cityname = $citynameA[1];
-$orginizationname = $orginizationnameA[1];
-$orginizationdepartment = $orginizationdepartmentA[1];
-$commonname = $commonnameA[1];
-
-if ($_POST) {
-
- /* Grab posted variables and create a new openssl.cnf */
- $countrycode=$_POST['countrycode'];
- $stateorprovince=$_POST['stateorprovince'];
- $cityname=$_POST['cityname'];
- $orginizationname=$_POST['orginizationname'];
- $orginizationdepartment=$_POST['orginizationdepartment'];
- $commonname=$_POST['commonname'];
-
- /* Write out /var/etc/ssl/openssl.cnf */
- conf_mount_rw();
- safe_mkdir("/var/etc/ssl/");
- $fd = fopen("/var/etc/ssl/openssl.cnf", "w");
- fwrite($fd, "");
- fwrite($fd, "[ req ]\n");
- fwrite($fd, "distinguished_name=req_distinguished_name \n");
- fwrite($fd, "req_extensions = v3_req \n");
- fwrite($fd, "prompt=no\n");
- fwrite($fd, "default_bits = 1024\n");
- fwrite($fd, "default_keyfile = privkey.pem\n");
- fwrite($fd, "distinguished_name = req_distinguished_name\n");
- fwrite($fd, "attributes = req_attributes\n");
- fwrite($fd, "x509_extensions = v3_ca # The extentions to add to the self signed cert\n");
- fwrite($fd, "[ req_distinguished_name ] \n");
- fwrite($fd, "C=" . $countrycode . " \n");
- fwrite($fd, "ST=" . $stateorprovince. " \n");
- fwrite($fd, "L=" . $cityname . " \n");
- fwrite($fd, "O=" . $orginizationname . " \n");
- fwrite($fd, "OU=" . $orginizationdepartment . " \n");
- fwrite($fd, "CN=" . $commonname . " \n");
- fwrite($fd, "[EMAIL PROTECTED] \n");
- fwrite($fd, "[EMAIL PROTECTED] \n");
- fwrite($fd, "[ v3_req ] \n");
- fwrite($fd, "basicConstraints = critical,CA:FALSE \n");
- fwrite($fd, "keyUsage = nonRepudiation, digitalSignature, keyEncipherment, dataEncipherment, keyAgreement \n");
- fwrite($fd, "extendedKeyUsage=emailProtection,clientAuth \n");
- fwrite($fd, "[ ca ]\n");
- fwrite($fd, "default_ca = CA_default\n");
- fwrite($fd, "[ CA_default ]\n");
- fwrite($fd, "certificate = /tmp/cacert.pem \n");
- fwrite($fd, "private_key = /tmp/cakey.pem \n");
- fwrite($fd, "dir = /tmp/\n");
- fwrite($fd, "certs = /tmp/certs\n");
- fwrite($fd, "crl_dir = /tmp/crl\n");
- fwrite($fd, "database = /tmp/index.txt \n");
- fwrite($fd, "new_certs_dir = /tmp/newcerts \n");
- fwrite($fd, "serial = /tmp/serial \n");
- fwrite($fd, "crl = /tmp/crl.pem \n");
- fwrite($fd, "RANDFILE = /tmp/.rand \n");
- fwrite($fd, "x509_extensions = usr_cert \n");
- fwrite($fd, "name_opt = ca_default \n");
- fwrite($fd, "cert_opt = ca_default \n");
- fwrite($fd, "default_days = 365 \n");
- fwrite($fd, "default_crl_days = 30 \n");
- fwrite($fd, "default_md = md5 \n");
- fwrite($fd, "preserve = no \n");
- fwrite($fd, "policy = policy_match\n");
- fwrite($fd, "[ policy_match ]\n");
- fwrite($fd, "countryName = match\n");
- fwrite($fd, "stateOrProvinceName = match\n");
- fwrite($fd, "organizationName = match\n");
- fwrite($fd, "organizationalUnitName = optional\n");
- fwrite($fd, "commonName = supplied\n");
- fwrite($fd, "emailAddress = optional\n");
- fwrite($fd, "[ policy_anything ]\n");
- fwrite($fd, "countryName = optional\n");
- fwrite($fd, "stateOrProvinceName = optional\n");
- fwrite($fd, "localityName = optional\n");
- fwrite($fd, "organizationName = optional\n");
- fwrite($fd, "organizationalUnitName = optional\n");
- fwrite($fd, "commonName = supplied\n");
- fwrite($fd, "emailAddress = optional\n");
- fwrite($fd, "[ req_distinguished_name ]\n");
- //fwrite($fd, "countryName = US\n");
- fwrite($fd, "[ req_attributes ]\n");
- fwrite($fd, "challengePassword = A challenge password\n");
- fwrite($fd, "unstructuredName = An optional company name\n");
- fwrite($fd, "[ usr_cert ]\n");
- fwrite($fd, "basicConstraints=CA:FALSE\n");
- fwrite($fd, "[ v3_ca ]\n");
- fwrite($fd, "subjectKeyIdentifier=hash\n");
- fwrite($fd, "authorityKeyIdentifier=keyid:always,issuer:always\n");
- fwrite($fd, "basicConstraints = CA:true\n");
- fwrite($fd, "[ crl_ext ]\n");
- fwrite($fd, "authorityKeyIdentifier=keyid:always,issuer:always\n");
- fclose($fd);
-
-$pgtitle = array("System","Advanced functions","Create Certificates");
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<form action="system_advanced_create_certs.php" method="post" name="iform" id="iform">
- <?php if ($input_errors) print_input_errors($input_errors); ?>
- <?php if ($savemsg) print_info_box($savemsg); ?>
- <p>One moment please...
- <?php
- mwexec("cd /tmp/ && /usr/bin/openssl req -new -x509 -keyout cakey.pem -out cacert.pem -days 3650 -config /var/etc/ssl/openssl.cnf -passin pass:test -nodes");
- //mwexec("cd /tmp/ && /usr/bin/openssl req -config openssl.cnf -new -nodes > cacert.pem ");
- //mwexec("cd /tmp/ && /usr/bin/openssl x509 -in cert.csr -out cert.pem -req -signkey cakey.pem");
- $fd = fopen("/tmp/cacert.pem", "r");
- $cacert = fread($fd,8096);
- fclose($fd);
- $fd = fopen("/tmp/cakey.pem", "r");
- $cakey = fread($fd,8096);
- fclose($fd);
- $cacertA = ereg_replace("\r","",$cacert);
- $cakeyA = ereg_replace("\r","",$cakey);
- $cacert = ereg_replace("\n","\\n",$cacert);
- $cakey = ereg_replace("\n","\\n",$cakey);
- ?>
- <script language="JavaScript">
- <!--
- var cacert='<?=$cacert?>';
- var cakey='<?=$cakey?>';
- opener.document.forms[0].cert.value=cacert;
- opener.document.forms[0].key.value=cakey;
- this.close();
- -->
- </script>
-
-</body>
-</html>
-
-<?php
-
-} else {
-
-$pgtitle = 'System: Advanced - Create Certificates';
-include("head.inc");
-?>
-
-
- <body link="#0000CC" vlink="#0000CC" alink="#0000CC">
- <form action="system_advanced_create_certs.php" method="post" name="iform" id="iform">
- <p class="pgtitle">System: Advanced - Create Certificates</p>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="35%" valign="top" class="vncell"><B>Country Code (2 Letters)</td>
- <td width="78%" class="vtable">
- <input name="countrycode" value="<?=$countrycode?>">
- </span></td>
- </tr>
-
- <tr>
- <td width="35%" valign="top" class="vncell"><B>State or Province name</td>
- <td width="78%" class="vtable">
- <input name="stateorprovince" value="<?=$stateorprovince?>">
- </span></td>
- </tr>
-
- <tr>
- <td width="35%" valign="top" class="vncell"><B>City name</td>
- <td width="78%" class="vtable">
- <input name="cityname" value="<?=$cityname?>">
- </span></td>
- </tr>
-
- <tr>
- <td width="35%" valign="top" class="vncell"><B>Organization name</td>
- <td width="78%" class="vtable">
- <input name="orginizationname" value="<?=$orginizationname?>">
- </span></td>
- </tr>
-
- <tr>
- <td width="35%" valign="top" class="vncell"><B>Organization department</td>
- <td width="78%" class="vtable">
- <input name="orginizationdepartment" value="<?=$orginizationdepartment?>">
- </span></td>
- </tr>
-
- <tr>
- <td width="35%" valign="top" class="vncell"><B>Common Name (Your name)</td>
- <td width="78%" class="vtable">
- <input name="commonname" value="<?=$commonname?>">
- </span></td>
- </tr>
-
- <!--
- <tr>
- <td width="35%" valign="top" class="vncell"><B>E-Mail address</td>
- <td width="78%" class="vtable">
- <input name="email" value="<?=$email?>">
- </span></td>
- </tr>
- -->
-
- <tr>
- <td width="35%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save">
- </td>
- </tr>
-
- </body>
- </html>
-
-<?php
-}
- conf_mount_ro();
-
-?>
diff --git a/usr/local/www/system_advanced_firewall.php b/usr/local/www/system_advanced_firewall.php
new file mode 100644
index 0000000..e48043c
--- /dev/null
+++ b/usr/local/www/system_advanced_firewall.php
@@ -0,0 +1,329 @@
+<?php
+/* $Id$ */
+/*
+ system_advanced_firewall.php
+ part of pfSense
+ Copyright (C) 2005-2007 Scott Ullrich
+
+ Copyright (C) 2008 Shrew Soft Inc
+
+ originally part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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-advanced-firewall
+##|*NAME=System: Advanced: Firewall and NAT page
+##|*DESCR=Allow access to the 'System: Advanced: Firewall and NAT' 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['tcpidletimeout'] = $config['filter']['tcpidletimeout'];
+$pconfig['optimization'] = $config['filter']['optimization'];
+$pconfig['maximumstates'] = $config['system']['maximumstates'];
+$pconfig['disablenatreflection'] = $config['system']['disablenatreflection'];
+$pconfig['reflectiontimeout'] = $config['system']['reflectiontimeout'];
+$pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']);
+$pconfig['disablescrub'] = isset($config['system']['disablescrub']);
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ 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['reflectiontimeout'] && !is_numericint($_POST['reflectiontimeout'])) {
+ $input_errors[] = "The Reflection timeout must be an integer.";
+ }
+
+ ob_flush();
+ flush();
+
+ if (!$input_errors) {
+
+ if($_POST['disablefilter'] == "yes")
+ $config['system']['disablefilter'] = "enabled";
+ else
+ unset($config['system']['disablefilter']);
+
+ if($_POST['rfc959workaround'] == "yes")
+ $config['system']['rfc959workaround'] = "enabled";
+ else
+ unset($config['system']['rfc959workaround']);
+
+ if($_POST['scrubnodf'] == "yes")
+ $config['system']['scrubnodf'] = "enabled";
+ else
+ unset($config['system']['scrubnodf']);
+
+ $config['system']['optimization'] = $_POST['optimization'];
+ $config['system']['maximumstates'] = $_POST['maximumstates'];
+
+ if($_POST['disablenatreflection'] == "yes")
+ $config['system']['disablenatreflection'] = $_POST['disablenatreflection'];
+ else
+ unset($config['system']['disablenatreflection']);
+
+ $config['system']['reflectiontimeout'] = $_POST['reflectiontimeout'];
+
+ if($_POST['bypassstaticroutes'] == "yes")
+ $config['system']['bypassstaticroutes'] = $_POST['bypassstaticroutes'];
+ else
+ unset($config['system']['bypassstaticroutes']);
+
+ if($_POST['disablescrub'] == "yes")
+ $config['system']['disablescrub'] = $_POST['disablescrub'];
+ else
+ unset($config['system']['disablescrub']);
+
+ write_config();
+
+ $retval = 0;
+ config_lock();
+ $retval = filter_configure();
+ if(stristr($retval, "error") <> true)
+ $savemsg = get_std_save_message($retval);
+ else
+ $savemsg = $retval;
+ }
+}
+
+$pgtitle = array("System","Advanced: Firewall and NAT");
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<script language="JavaScript">
+<!--
+
+var descs=new Array(5);
+descs[0]="as the name says, it's the normal optimization algorithm";
+descs[1]="used for high latency links, such as satellite links. Expires idle connections later than default";
+descs[2]="expires idle connections quicker. More efficient use of CPU and memory but can drop legitimate connections";
+descs[3]="tries to avoid dropping any legitimate connections at the expense of increased memory usage and CPU utilization.";
+
+function update_description(itemnum) {
+ document.forms[0].info.value=descs[itemnum];
+
+}
+
+//-->
+</script>
+
+<?php
+ if ($input_errors)
+ print_input_errors($input_errors);
+ if ($savemsg)
+ print_info_box($savemsg);
+?>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+ <span class="vexpl">
+ <span class="red">
+ <strong>Note:</strong>
+ </span>
+ the options on this page are intended for use by advanced users only.
+ <br/>
+ </span>
+ <br/>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+ <ul id="tabnav">
+ <?php
+ $tab_array = array();
+ $tab_array[] = array("Admin Access", false, "system_advanced_admin.php");
+ $tab_array[] = array("Firewall / NAT", true, "system_advanced_firewall.php");
+ $tab_array[] = array("Networking", false, "system_advanced_network.php");
+ $tab_array[] = array("Miscellaneous", false, "system_advanced_misc.php");
+ $tab_array[] = array("System Tunables", false, "system_advanced_sysctl.php");
+ display_top_tabs($tab_array);
+ ?>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabcont">
+ <form action="system_advanced_firewall.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Firewall Advanced</td>
+ </tr>
+<?php
+/*
+ <tr>
+ <td width="22%" valign="top" class="vncell">Traffic shaper type</td>
+ <td width="78%" class="vtable">
+ <select name="shapertype" class="formselect">
+ <option value="pfSense"<?php if($pconfig['shapertype'] == 'pfSense') echo " selected"; ?>><?= $g['product_name'] ?> (ALTQ)</option>
+ <option value="m0n0"<?php if($pconfig['shapertype'] == 'm0n0') echo " selected"; ?>>M0n0wall (dummynet)</option>
+ </select>
+ </td>
+ </tr>
+*/
+?>
+ <tr>
+ <td width="22%" valign="top" class="vncell">FTP server compatibility</td>
+ <td width="78%" class="vtable">
+ <input name="rfc959workaround" type="checkbox" id="rfc959workaround" value="yes" <?php if (isset($config['system']['rfc959workaround'])) echo "checked"; ?> />
+ <strong>Allow data connections from the FTP command port</strong><br/>
+ This allows for communication with ftp servers that violate
+ RFC 959 by opening data connections from the command port (21).
+ Thes should be opened on the data port(20). This option should
+ not expose you to any extra risk as the firewall will still only
+ allow connections on a port that ftp-proxy listens on.
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">IP Do-Not-Fragment compatibility</td>
+ <td width="78%" class="vtable">
+ <input name="scrubnodf" type="checkbox" id="scrubnodf" value="yes" <?php if (isset($config['system']['scrubnodf'])) echo "checked"; ?> />
+ <strong>Clear invalid DF bits instead of dropping the packets</strong><br/>
+ This allows for communications with hosts 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.
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Firewall Optimization Options</td>
+ <td width="78%" class="vtable">
+ <select onChange="update_description(this.selectedIndex);" name="optimization" id="optimization">
+ <option value="normal"<?php if($config['system']['optimization']=="normal") echo " selected"; ?>>normal</option>
+ <option value="high-latency"<?php if($config['system']['optimization']=="high-latency") echo " selected"; ?>>high-latency</option>
+ <option value="aggressive"<?php if($config['system']['optimization']=="aggressive") echo " selected"; ?>>aggressive</option>
+ <option value="conservative"<?php if($config['system']['optimization']=="conservative") echo " selected"; ?>>conservative</option>
+ </select>
+ <br/>
+ <textarea cols="60" rows="1" id="info" name="info"style="padding:5px; border:1px dashed #990000; background-color: #ffffff; color: #000000; font-size: 8pt;"></textarea>
+ <script language="javascript" type="text/javascript">
+ update_description(document.forms[0].optimization.selectedIndex);
+ </script>
+ <br/>
+ Select which type of state table optimization your would like to use
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Disable Firewall</td>
+ <td width="78%" class="vtable">
+ <input name="disablefilter" type="checkbox" id="disablefilter" value="yes" <?php if (isset($config['system']['disablefilter'])) echo "checked"; ?> />
+ <strong>Disable all packet filtering.</strong>
+ <br/>
+ <span class="vexpl">Note: This converts <?= $g['product_name'] ?> into a routing only platform!<br>
+ Note: This will turn off NAT!
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Disable Firewall Scrub</td>
+ <td width="78%" class="vtable">
+ <input name="disablescrub" type="checkbox" id="disablescrub" value="yes" <?php if (isset($config['system']['disablescrub'])) echo "checked"; ?> />
+ <strong>Disables the PF scrubbing option which can sometimes interfere with NFS and PPTP traffic.</strong>
+ <br/>
+ Click <a href='http://www.openbsd.org/faq/pf/scrub.html' target='_new'>here</a> for more information.
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Firewall Maximum States</td>
+ <td width="78%" class="vtable">
+ <input name="maximumstates" type="text" id="maximumstates" value="<?php echo $pconfig['maximumstates']; ?>" />
+ <br/>
+ <strong>Maximum number of connections to hold in the firewall state table.</strong>
+ <br/>
+ <span class="vexpl">Note: Leave this blank for the default. On your system the default size is: <?= pfsense_default_state_size() ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Static route filtering</td>
+ <td width="78%" class="vtable">
+ <input name="bypassstaticroutes" type="checkbox" id="bypassstaticroutes" value="yes" <?php if ($pconfig['bypassstaticroutes']) echo "checked"; ?> />
+ <strong>Bypass firewall rules for traffic on the same interface</strong>
+ <br/>
+ 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.
+ <br/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+
+ <?php if($config['interfaces']['lan']): ?>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Network Address Translation</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Disable NAT Reflection</td>
+ <td width="78%" class="vtable">
+ <input name="disablenatreflection" type="checkbox" id="disablenatreflection" value="yes" <?php if (isset($config['system']['disablenatreflection'])) echo "checked"; ?> />
+ <strong>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.</strong>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Reflection Timeout</td>
+ <td width="78%" class="vtable">
+ <input name="reflectiontimeout" id="reflectiontimeout" value="<?php echo $config['system']['reflectiontimeout']; ?>" />
+ <strong>Enter value for Reflection timeout in seconds.</strong>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <?php endif; ?>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" /></td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+ </table>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
+
diff --git a/usr/local/www/system_advanced_misc.php b/usr/local/www/system_advanced_misc.php
new file mode 100644
index 0000000..4ce4d41
--- /dev/null
+++ b/usr/local/www/system_advanced_misc.php
@@ -0,0 +1,237 @@
+<?php
+/* $Id$ */
+/*
+ system_advanced_misc.php
+ part of pfSense
+ Copyright (C) 2005-2007 Scott Ullrich
+
+ Copyright (C) 2008 Shrew Soft Inc
+
+ originally part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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-advanced-misc
+##|*NAME=System: Advanced: Miscellaneous page
+##|*DESCR=Allow access to the 'System: Advanced: Miscellaneous' page.
+##|*MATCH=system_advanced.php*
+##|-PRIV
+
+
+require("guiconfig.inc");
+
+$pconfig['harddiskstandby'] = $config['system']['harddiskstandby'];
+$pconfig['lb_use_sticky'] = isset($config['system']['lb_use_sticky']);
+$pconfig['shapertype'] = $config['system']['shapertype'];
+$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ ob_flush();
+ flush();
+
+ if (!$input_errors) {
+
+ if($_POST['harddiskstandby'] <> "") {
+ $config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
+ system_set_harddisk_standby();
+ } else
+ unset($config['system']['harddiskstandby']);
+
+ if($_POST['lb_use_sticky'] == "yes")
+ $config['system']['lb_use_sticky'] = true;
+ else
+ unset($config['system']['lb_use_sticky']);
+
+ $config['system']['shapertype'] = $_POST['shapertype'];
+
+ $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? 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();
+ }
+}
+
+$pgtitle = array("System","Advanced: Miscellaneous");
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php
+ include("fbegin.inc");
+ if ($input_errors)
+ print_input_errors($input_errors);
+ if ($savemsg)
+ print_info_box($savemsg);
+?>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+ <span class="vexpl">
+ <span class="red">
+ <strong>Note:</strong>
+ </span>
+ the options on this page are intended for use by advanced users only.
+ <br/>
+ </span>
+ <br/>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+ <ul id="tabnav">
+ <?php
+ $tab_array = array();
+ $tab_array[] = array("Admin Access", false, "system_advanced_admin.php");
+ $tab_array[] = array("Firewall / NAT", false, "system_advanced_firewall.php");
+ $tab_array[] = array("Networking", false, "system_advanced_network.php");
+ $tab_array[] = array("Miscellaneous", true, "system_advanced_misc.php");
+ $tab_array[] = array("System Tunables", false, "system_advanced_sysctl.php");
+ display_top_tabs($tab_array);
+ ?>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabcont">
+ <form action="system_advanced_misc.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Load Balancing</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Load Balancing</td>
+ <td width="78%" class="vtable">
+ <input name="lb_use_sticky" type="checkbox" id="lb_use_sticky" value="yes" <?php if ($pconfig['lb_use_sticky']) echo "checked=\"checked\""; ?> />
+ <strong>Use sticky connections</strong><br/>
+ 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.
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <?php
+ /*
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Traffic Shaper</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Traffic shaper type</td>
+ <td width="78%" class="vtable">
+ <select name="shapertype" class="formselect">
+ <option value="pfSense"<?php if($pconfig['shapertype'] == 'pfSense') echo " selected"; ?>><?= $g['product_name'] ?> (ALTQ)</option>
+ <option value="m0n0"<?php if($pconfig['shapertype'] == 'm0n0') echo " selected"; ?>>M0n0wall (dummynet)</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ */
+ ?>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">IP Security</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">IPsec SA preferral</td>
+ <td width="78%" class="vtable">
+ <input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked"; ?> />
+ <strong>Prefer older IPsec SAs</strong>
+ <br />
+ 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.
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <?php if($g['platform'] == "pfSenseDISABLED"): ?>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Hardware Settings</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Hard disk standby time </td>
+ <td width="78%" class="vtable">
+ <select name="harddiskstandby" class="formselect">
+ <?php
+ ## Values from ATA-2 http://www.t13.org/project/d0948r3-ATA-2.pdf (Page 66)
+ $sbvals = explode(" ", "0.5,6 1,12 2,24 3,36 4,48 5,60 7.5,90 10,120 15,180 20,240 30,241 60,242");
+ ?>
+ <option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected');?>>Always on</option>
+ <?php
+ foreach ($sbvals as $sbval):
+ list($min,$val) = explode(",", $sbval);
+ ?>
+ <option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected');?>><?=$min;?> minutes</option>
+ <?php endforeach; ?>
+ </select>
+ <br/>
+ Puts the hard disk into standby mode when the selected amount of time after the last
+ access has elapsed. <em>Do not set this for CF cards.</em>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <?php endif; ?>
+
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+ </table>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
+
diff --git a/usr/local/www/system_advanced_network.php b/usr/local/www/system_advanced_network.php
new file mode 100644
index 0000000..321c37f
--- /dev/null
+++ b/usr/local/www/system_advanced_network.php
@@ -0,0 +1,236 @@
+<?php
+/* $Id$ */
+/*
+ system_advanced_network.php
+ part of pfSense
+ Copyright (C) 2005-2007 Scott Ullrich
+
+ Copyright (C) 2008 Shrew Soft Inc
+
+ originally part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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-advanced-network
+##|*NAME=System: Advanced: Network page
+##|*DESCR=Allow access to the 'System: Advanced: Networking' page.
+##|*MATCH=system_advanced-network.php*
+##|-PRIV
+
+
+require("guiconfig.inc");
+
+$pconfig['ipv6nat_enable'] = isset($config['diag']['ipv6nat']['enable']);
+$pconfig['ipv6nat_ipaddr'] = $config['diag']['ipv6nat']['ipaddr'];
+$pconfig['polling_enable'] = isset($config['system']['polling']);
+$pconfig['sharednet'] = $config['system']['sharednet'];
+$pconfig['disablechecksumoffloading'] = isset($config['system']['disablechecksumoffloading']);
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ if ($_POST['ipv6nat_enable'] && !is_ipaddr($_POST['ipv6nat_ipaddr']))
+ $input_errors[] = "You must specify an IP address to NAT IPv6 packets.";
+
+ ob_flush();
+ flush();
+ if (!$input_errors) {
+
+ 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']);
+ }
+ }
+ }
+
+ 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['polling_enable'] == "yes") {
+ $config['system']['polling'] = true;
+ setup_polling();
+ } else {
+ unset($config['system']['polling']);
+ setup_polling();
+ }
+
+ if($_POST['disablechecksumoffloading'] == "yes") {
+ $config['system']['disablechecksumoffloading'] = $_POST['disablechecksumoffloading'];
+ } else {
+ unset($config['system']['disablechecksumoffloading']);
+ }
+
+ write_config();
+
+ config_lock();
+ $retval = filter_configure();
+ if(stristr($retval, "error") <> true)
+ $savemsg = get_std_save_message($retval);
+ else
+ $savemsg = $retval;
+ config_unlock();
+ }
+}
+
+$pgtitle = array("System","Advanced: Networking");
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<script language="JavaScript">
+<!--
+
+function enable_change(enable_over) {
+ if (document.iform.ipv6nat_enable.checked || enable_over)
+ document.iform.ipv6nat_ipaddr.disabled = 0;
+ else
+ document.iform.ipv6nat_ipaddr.disabled = 1;
+}
+
+//-->
+</script>
+
+
+<?
+ if ($input_errors)
+ print_input_errors($input_errors);
+ if ($savemsg)
+ print_info_box($savemsg);
+?>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+ <span class="vexpl">
+ <span class="red">
+ <strong>Note:</strong>
+ </span>
+ the options on this page are intended for use by advanced users only.
+ <br/>
+ </span>
+ <br/>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+ <ul id="tabnav">
+ <?php
+ $tab_array = array();
+ $tab_array[] = array("Admin Access", false, "system_advanced_admin.php");
+ $tab_array[] = array("Firewall / NAT", false, "system_advanced_firewall.php");
+ $tab_array[] = array("Networking", true, "system_advanced_network.php");
+ $tab_array[] = array("Miscellaneous", false, "system_advanced_misc.php");
+ $tab_array[] = array("System Tunables", false, "system_advanced_sysctl.php");
+ display_top_tabs($tab_array);
+ ?>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabcont">
+ <form action="system_advanced_network.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">IPv6 Options</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">IPv6 over IPv4 Tunneling</td>
+ <td width="78%" class="vtable">
+ <input name="ipv6nat_enable" type="checkbox" id="ipv6nat_enable" value="yes" <?php if ($pconfig['ipv6nat_enable']) echo "checked"; ?> onclick="enable_change(false)" />
+ <strong>Enable IPv4 NAT encapsulation of IPv6 packets</strong><br/>
+ This provides an RFC 2893 compatibility mechanism
+ that can be used to tunneling IPv6 packets over IPv4
+ routing infrastructures. If enabled, don't forget to
+ add a firewall rule to permit IPv6 packets.<br/>
+ <br/>
+ IP address :&nbsp;
+ <input name="ipv6nat_ipaddr" type="text" class="formfld unknown" id="ipv6nat_ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipv6nat_ipaddr']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Network Interfaces</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Device polling</td>
+ <td width="78%" class="vtable">
+ <input name="polling_enable" type="checkbox" id="polling_enable" value="yes" <?php if ($pconfig['polling_enable']) echo "checked"; ?>>
+ <strong>Enable device polling</strong><br>
+ 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 <?= $g['product_name'] ?> homepage for a list of supported cards.
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Hardware Checksum Offloading</td>
+ <td width="78%" class="vtable">
+ <input name="disablechecksumoffloading" type="checkbox" id="disablechecksumoffloading" value="yes" <?php if (isset($config['system']['disablechecksumoffloading'])) echo "checked"; ?> />
+ <strong>Disable hardware checksum offload.</strong><br>
+ This option will hardware assisted checksum offloading. FreeBSD sometimes has difficulties with certain drivers.
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Arp Handling</td>
+ <td width="78%" class="vtable">
+ <input name="sharednet" type="checkbox" id="sharednet" value="yes" <?php if (isset($pconfig['sharednet'])) echo "checked"; ?> />
+ <strong>Suppress ARP messages</strong><br>
+ This option will suppress ARP messages when interfaces share the same physical network</strong>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" /></td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+ </table>
+ <script language="JavaScript" type="text/javascript">
+ <!--
+ enable_change(false);
+ //-->
+ </script>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/usr/local/www/system_advanced_sysctl.php b/usr/local/www/system_advanced_sysctl.php
new file mode 100644
index 0000000..5e2fd79
--- /dev/null
+++ b/usr/local/www/system_advanced_sysctl.php
@@ -0,0 +1,269 @@
+<?php
+/* $Id$ */
+/*
+ system_advanced_misc.php
+ part of pfSense
+ Copyright (C) 2005-2007 Scott Ullrich
+
+ Copyright (C) 2008 Shrew Soft Inc
+
+ originally part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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-advanced-sysctl
+##|*NAME=System: Advanced: Tunables page
+##|*DESCR=Allow access to the 'System: Advanced: Tunables' page.
+##|*MATCH=system_advanced-sysctrl.php*
+##|-PRIV
+
+
+require("guiconfig.inc");
+
+if (!is_array($config['sysctl']['item']))
+ $config['sysctl']['item'] = array();
+
+$a_tunable = &$config['sysctl']['item'];
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+$act = $_GET['act'];
+if (isset($_POST['act']))
+ $act = $_POST['act'];
+
+if ($act == "edit") {
+ if ($a_tunable[$id]) {
+ $pconfig['tunable'] = $a_tunable[$id]['tunable'];
+ $pconfig['value'] = $a_tunable[$id]['value'];
+ $pconfig['desc'] = $a_tunable[$id]['desc'];
+ }
+}
+
+if ($act == "del") {
+ if ($a_tunable[$id]) {
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($input_errors)) {
+ input_errors2Ajax($input_errors);
+ exit;
+ }
+ if (!$input_errors) {
+ unset($a_tunable[$id]);
+ write_config();
+ touch($d_sysctldirty_path);
+ pfSenseHeader("firewall_system_tunables.php");
+ exit;
+ }
+ }
+}
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* if this is an AJAX caller then handle via JSON */
+ if (isAjax() && is_array($input_errors)) {
+ input_errors2Ajax($input_errors);
+ exit;
+ }
+
+ if ($_POST['apply']) {
+ $retval = 0;
+ $savemsg = get_std_save_message($retval);
+ unlink_if_exists($d_sysctldirty_path);
+ }
+
+ if ($_POST['Submit'] == "Save") {
+ $tunableent = array();
+
+ $tunableent['tunable'] = $_POST['tunable'];
+ $tunableent['value'] = $_POST['value'];
+ $tunableent['desc'] = $_POST['desc'];
+
+ if (isset($id) && $a_tunable[$id])
+ $a_tunable[$id] = $tunableent;
+ else
+ $a_tunable[] = $tunableent;
+
+ touch($d_sysctldirty_path);
+
+ write_config();
+
+ pfSenseHeader("system_advanced_sysctl.php");
+ exit;
+ }
+}
+
+include("head.inc");
+
+$pgtitle = array("System","Advanced: Miscellaneous");
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+ <form action="system_advanced_sysctl.php" method="post">
+ <?php
+ if ($input_errors)
+ print_input_errors($input_errors);
+ if ($savemsg)
+ print_info_box($savemsg);
+ if (file_exists($d_sysctldirty_path))
+ print_info_box_np("The firewall tunables have changed. You must apply the configuration to take affect.");
+ ?>
+ </form>
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+ <span class="vexpl">
+ <span class="red">
+ <strong>Note:</strong>
+ </span>
+ the options on this page are intended for use by advanced users only.
+ <br/>
+ </span>
+ <br/>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+ <ul id="tabnav">
+ <?php
+ $tab_array = array();
+ $tab_array[] = array("Admin Access", false, "system_advanced_admin.php");
+ $tab_array[] = array("Firewall / NAT", false, "system_advanced_firewall.php");
+ $tab_array[] = array("Networking", false, "system_advanced_network.php");
+ $tab_array[] = array("Miscellaneous", false, "system_advanced_misc.php");
+ $tab_array[] = array("System Tunables", true, "system_advanced_sysctl.php");
+ display_top_tabs($tab_array);
+ ?>
+ </ul>
+ </td>
+ </tr>
+ <?php if ($act != "edit" ): ?>
+ <tr>
+ <td class="tabcont">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="20%" class="listhdrr">Tunable Name</td>
+ <td width="60%" class="listhdrr">Description</td>
+ <td width="20%" class="listhdrr">Value</td>
+ </tr>
+ <?php $i = 0; foreach ($config['sysctl']['item'] as $tunable): ?>
+ <tr>
+ <td class="listlr" ondblclick="document.location='firewall_system_tunables_edit.php?id=<?=$i;?>';">
+ <?php echo $tunable['tunable']; ?>
+ </td>
+ <td class="listr" align="left" ondblclick="document.location='firewall_system_tunables_edit.php?id=<?=$i;?>';">
+ <?php echo $tunable['desc']; ?>
+ </td>
+ <td class="listr" align="left" ondblclick="document.location='firewall_system_tunables_edit.php?id=<?=$i;?>';">
+ <?php echo $tunable['value']; ?>
+ </td>
+ <td class="list" nowrap>
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle">
+ <a href="system_advanced_sysctl.php?act=edit&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ <td valign="middle">
+ <a href="system_advanced_sysctl.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('Do you really want to delete this entry?')">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="3">
+ </td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle">
+ <a href="firewall_system_tunables_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <? else: ?>
+ <tr>
+ <td class="tabcont">
+ <form action="system_advanced_sysctl.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Edit system tunable</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Tunable</td>
+ <td width="78%" class="vtable">
+ <input size="65" name="tunable" value="<?php echo $pconfig['tunable']; ?>">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Description</td>
+ <td width="78%">
+ <textarea rows="7" cols="50" name="desc"><?php echo $pconfig['desc']; ?></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Value</td>
+ <td width="78%">
+ <input size="65" name="value" value="<?php echo $pconfig['value']; ?>">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="Save" />
+ <input id="cancelbutton" name="cancelbutton" type="button" class="formbtn" value="Cancel" onclick="history.back()" />
+ <?php if (isset($id) && $a_tunable[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+ <? endif; ?>
+ </table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
OpenPOWER on IntegriCloud