From 46bc6e545a17e77202aaf01ec0cd8d5a46567525 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 25 Aug 2015 08:08:24 -0300 Subject: Move main pfSense content to src/ --- src/usr/local/www/system_advanced_misc.php | 738 +++++++++++++++++++++++++++++ 1 file changed, 738 insertions(+) create mode 100644 src/usr/local/www/system_advanced_misc.php (limited to 'src/usr/local/www/system_advanced_misc.php') diff --git a/src/usr/local/www/system_advanced_misc.php b/src/usr/local/www/system_advanced_misc.php new file mode 100644 index 0000000..72f4833 --- /dev/null +++ b/src/usr/local/www/system_advanced_misc.php @@ -0,0 +1,738 @@ +. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* + pfSense_MODULE: system +*/ + +##|+PRIV +##|*IDENT=page-system-advanced-misc +##|*NAME=System: Advanced: Miscellaneous page +##|*DESCR=Allow access to the 'System: Advanced: Miscellaneous' page. +##|*MATCH=system_advanced_misc.php* +##|-PRIV + +require("guiconfig.inc"); +require_once("functions.inc"); +require_once("filter.inc"); +require_once("shaper.inc"); +require_once("vpn.inc"); +require_once("vslb.inc"); + +$pconfig['proxyurl'] = $config['system']['proxyurl']; +$pconfig['proxyport'] = $config['system']['proxyport']; +$pconfig['proxyuser'] = $config['system']['proxyuser']; +$pconfig['proxypass'] = $config['system']['proxypass']; +$pconfig['harddiskstandby'] = $config['system']['harddiskstandby']; +$pconfig['lb_use_sticky'] = isset($config['system']['lb_use_sticky']); +$pconfig['srctrack'] = $config['system']['srctrack']; +$pconfig['gw_switch_default'] = isset($config['system']['gw_switch_default']); +$pconfig['powerd_enable'] = isset($config['system']['powerd_enable']); +$pconfig['crypto_hardware'] = $config['system']['crypto_hardware']; +$pconfig['thermal_hardware'] = $config['system']['thermal_hardware']; +$pconfig['schedule_states'] = isset($config['system']['schedule_states']); +$pconfig['kill_states'] = isset($config['system']['kill_states']); +$pconfig['skip_rules_gw_down'] = isset($config['system']['skip_rules_gw_down']); +$pconfig['apinger_debug'] = isset($config['system']['apinger_debug']); +$pconfig['use_mfs_tmpvar'] = isset($config['system']['use_mfs_tmpvar']); +$pconfig['use_mfs_tmp_size'] = $config['system']['use_mfs_tmp_size']; +$pconfig['use_mfs_var_size'] = $config['system']['use_mfs_var_size']; +$pconfig['pkg_nochecksig'] = isset($config['system']['pkg_nochecksig']); +$pconfig['host_uuid'] = !isset($config['system']['host_uuid']); + +$pconfig['powerd_ac_mode'] = "hadp"; +if (!empty($config['system']['powerd_ac_mode'])) { + $pconfig['powerd_ac_mode'] = $config['system']['powerd_ac_mode']; +} + +$pconfig['powerd_battery_mode'] = "hadp"; +if (!empty($config['system']['powerd_battery_mode'])) { + $pconfig['powerd_battery_mode'] = $config['system']['powerd_battery_mode']; +} + +$pconfig['powerd_normal_mode'] = "hadp"; +if (!empty($config['system']['powerd_normal_mode'])) { + $pconfig['powerd_normal_mode'] = $config['system']['powerd_normal_mode']; +} + +$crypto_modules = array( + 'glxsb' => gettext("AMD Geode LX Security Block"), + 'aesni' => gettext("AES-NI CPU-based Acceleration")); + +$thermal_hardware_modules = array( + 'coretemp' => gettext("Intel Core* CPU on-die thermal sensor"), + 'amdtemp' => gettext("AMD K8, K10 and K11 CPU on-die thermal sensor")); + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + ob_flush(); + flush(); + + if (!empty($_POST['crypto_hardware']) && !array_key_exists($_POST['crypto_hardware'], $crypto_modules)) { + $input_errors[] = gettext("Please select a valid Cryptographic Accelerator."); + } + + if (!empty($_POST['thermal_hardware']) && !array_key_exists($_POST['thermal_hardware'], $thermal_hardware_modules)) { + $input_errors[] = gettext("Please select a valid Thermal Hardware Sensor."); + } + + if (!empty($_POST['use_mfs_tmp_size']) && (!is_numeric($_POST['use_mfs_tmp_size']) || ($_POST['use_mfs_tmp_size'] < 40))) { + $input_errors[] = gettext("/tmp Size must be numeric and should not be less than 40MB."); + } + + if (!empty($_POST['use_mfs_var_size']) && (!is_numeric($_POST['use_mfs_var_size']) || ($_POST['use_mfs_var_size'] < 60))) { + $input_errors[] = gettext("/var Size must be numeric and should not be less than 60MB."); + } + + if (!empty($_POST['proxyport']) && !is_port($_POST['proxyport'])) { + $input_errors[] = gettext("Proxy port must be a valid port number, 1-65535."); + } + + if (!empty($_POST['proxyurl']) && !is_fqdn($_POST['proxyurl']) && !is_ipaddr($_POST['proxyurl'])) { + $input_errors[] = gettext("Proxy URL must be a valid IP address or FQDN."); + } + + if (!empty($_POST['proxyuser']) && preg_match("/[^a-zA-Z0-9\.\-_@]/", $_POST['proxyuser'])) { + $input_errors[] = gettext("The proxy username contains invalid characters."); + } + + if (!$input_errors) { + + if ($_POST['harddiskstandby'] <> "") { + $config['system']['harddiskstandby'] = $_POST['harddiskstandby']; + system_set_harddisk_standby(); + } else { + unset($config['system']['harddiskstandby']); + } + + if ($_POST['proxyurl'] <> "") { + $config['system']['proxyurl'] = $_POST['proxyurl']; + } else { + unset($config['system']['proxyurl']); + } + + if ($_POST['proxyport'] <> "") { + $config['system']['proxyport'] = $_POST['proxyport']; + } else { + unset($config['system']['proxyport']); + } + + if ($_POST['proxyuser'] <> "") { + $config['system']['proxyuser'] = $_POST['proxyuser']; + } else { + unset($config['system']['proxyuser']); + } + + if ($_POST['proxypass'] <> "") { + $config['system']['proxypass'] = $_POST['proxypass']; + } else { + unset($config['system']['proxypass']); + } + + $need_relayd_restart = false; + if ($_POST['lb_use_sticky'] == "yes") { + if (!isset($config['system']['lb_use_sticky'])) { + $config['system']['lb_use_sticky'] = true; + $need_relayd_restart = true; + } + if ($config['system']['srctrack'] != $_POST['srctrack']) { + $config['system']['srctrack'] = $_POST['srctrack']; + $need_relayd_restart = true; + } + } else { + if (isset($config['system']['lb_use_sticky'])) { + unset($config['system']['lb_use_sticky']); + $need_relayd_restart = true; + } + } + + if ($_POST['gw_switch_default'] == "yes") { + $config['system']['gw_switch_default'] = true; + } else { + unset($config['system']['gw_switch_default']); + } + + if ($_POST['pkg_nochecksig'] == "yes") { + $config['system']['pkg_nochecksig'] = true; + } elseif (isset($config['system']['pkg_nochecksig'])) { + unset($config['system']['pkg_nochecksig']); + } + + if ($_POST['host_uuid'] == "yes") { + unset($config['system']['host_uuid']); + } else { + $config['system']['host_uuid'] = true; + } + + if ($_POST['powerd_enable'] == "yes") { + $config['system']['powerd_enable'] = true; + } else { + unset($config['system']['powerd_enable']); + } + + $config['system']['powerd_ac_mode'] = $_POST['powerd_ac_mode']; + $config['system']['powerd_battery_mode'] = $_POST['powerd_battery_mode']; + $config['system']['powerd_normal_mode'] = $_POST['powerd_normal_mode']; + + if ($_POST['crypto_hardware']) { + $config['system']['crypto_hardware'] = $_POST['crypto_hardware']; + } else { + unset($config['system']['crypto_hardware']); + } + + if ($_POST['thermal_hardware']) { + $config['system']['thermal_hardware'] = $_POST['thermal_hardware']; + } else { + unset($config['system']['thermal_hardware']); + } + + if ($_POST['schedule_states'] == "yes") { + $config['system']['schedule_states'] = true; + } else { + unset($config['system']['schedule_states']); + } + + if ($_POST['kill_states'] == "yes") { + $config['system']['kill_states'] = true; + } else { + unset($config['system']['kill_states']); + } + + if ($_POST['skip_rules_gw_down'] == "yes") { + $config['system']['skip_rules_gw_down'] = true; + } else { + unset($config['system']['skip_rules_gw_down']); + } + + $need_apinger_restart = false; + if ($_POST['apinger_debug'] == "yes") { + if (!isset($config['system']['apinger_debug'])) { + $need_apinger_restart = true; + } + $config['system']['apinger_debug'] = true; + } else { + if (isset($config['system']['apinger_debug'])) { + $need_apinger_restart = true; + } + unset($config['system']['apinger_debug']); + } + + if ($_POST['use_mfs_tmpvar'] == "yes") { + $config['system']['use_mfs_tmpvar'] = true; + } else { + unset($config['system']['use_mfs_tmpvar']); + } + + $config['system']['use_mfs_tmp_size'] = $_POST['use_mfs_tmp_size']; + $config['system']['use_mfs_var_size'] = $_POST['use_mfs_var_size']; + + if (isset($_POST['rrdbackup'])) { + $config['system']['rrdbackup'] = $_POST['rrdbackup']; + install_cron_job("/etc/rc.backup_rrd.sh", ($config['system']['rrdbackup'] > 0), $minute="0", "*/{$config['system']['rrdbackup']}"); + } + if (isset($_POST['dhcpbackup'])) { + $config['system']['dhcpbackup'] = $_POST['dhcpbackup']; + install_cron_job("/etc/rc.backup_dhcpleases.sh", ($config['system']['dhcpbackup'] > 0), $minute="0", "*/{$config['system']['dhcpbackup']}"); + } + + write_config(); + + $retval = 0; + system_resolvconf_generate(true); + $retval = filter_configure(); + if (stristr($retval, "error") <> true) { + $savemsg = get_std_save_message(gettext($retval)); + } else { + $savemsg = gettext($retval); + } + + activate_powerd(); + load_crypto(); + load_thermal_hardware(); + if ($need_relayd_restart) { + relayd_configure(); + } + if ($need_apinger_restart) { + setup_gateways_monitor(); + } + } +} + +$pgtitle = array(gettext("System"), gettext("Advanced: Miscellaneous")); +include("head.inc"); + +?> + + + + +
+ + + + + + + +
+ +
+
+ + +   + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ " class="formfld unknown" /> +
+ +
+ " class="formfld unknown" /> +
+ +
+ " class="formfld unknown" /> +
+ +
+ " class="formfld unknown" /> +
+ +
+ onclick="sticky_checked(this)" /> +
+ +
+ " class="formfld unknown" /> +
+ +
+ /> +
+ +
 
+ /> +
+
+ + + + + + + + + + + + + +
  + +
  + +
  + +
+
+ +
 
+ +
+ +

+ +
 
+ +
+ +

+ +
 
  + VPN > IPsec on the Advanced Settings tab."); ?> +
 
+ /> +
+ +
 
+ /> +
+ +
+ /> +
+ +
+ /> +
+ +
+ onclick="tmpvar_checked(this)" /> +
+ +
+ " class="formfld unknown" /> MB +
+ +
+ " class="formfld unknown" /> MB +
+ +
+ + +
+ +
+
+
+ + +
+ +
+
+
 
+ +
+ +
 
+ /> +
+ +
+ /> +
+ +
  + " /> +
+
+
+
+ + + + -- cgit v1.1