From 35c9cd4463738ebfc07aa6099ebb8bd54e10434b Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Thu, 8 Jul 2010 17:15:21 -0600 Subject: Don't use the association when duplicating firewall rules. Fixes #634 --- usr/local/www/firewall_rules_edit.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 342b689..10c3796 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -168,7 +168,8 @@ if (isset($id) && $a_filter[$id]) { //schedule support $pconfig['sched'] = $a_filter[$id]['sched']; - $pconfig['associated-rule-id'] = $a_filter[$id]['associated-rule-id']; + if (!isset($_GET['dup'])) + $pconfig['associated-rule-id'] = $a_filter[$id]['associated-rule-id']; } else { /* defaults */ -- cgit v1.1 From f17f9f2891b459e3f119ced5857469b96c57dde9 Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 9 Jul 2010 09:19:03 -0400 Subject: Bypass the DNS Rebind attack checks if accessing by IP address. --- etc/inc/auth.inc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index d0b261a..504b241 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -60,8 +60,8 @@ if (function_exists("display_error_form") && !isset($config['system']['webgui'][ } else { $http_host = $_SERVER['HTTP_HOST']; } - if(($http_host == "localhost" or $_SERVER['SERVER_ADDR'] == "localhost") or - ($http_host == "127.0.0.1" or $_SERVER['SERVER_ADDR'] == "127.0.0.1")) + if(is_ipaddr($http_host) or $_SERVER['SERVER_ADDR'] == "127.0.0.1" or + $http_host == "localhost" or $_SERVER['SERVER_ADDR'] == "localhost") $found_host = true; if($config['dyndnses']['dyndns']) foreach($config['dyndnses']['dyndns'] as $dyndns) @@ -80,20 +80,6 @@ if (function_exists("display_error_form") && !isset($config['system']['webgui'][ $http_host == $config['system']['hostname']) $found_host = true; - /* Check against locally configured IP addresses, which will catch when someone - port forwards WebGUI access from WAN to an internal IP on the router. */ - if ($found_host == false) { - global $FilterIflist; - if (empty($FilterIflist)) { - require_once('filter.inc'); - require_once('shaper.inc'); - filter_generate_optcfg_array(); - } - foreach ($FilterIflist as $iflist) - if($iflist['ip'] == $http_host) - $found_host = true; - } - if($found_host == false) { display_error_form("501", "Potential DNS Rebind attack detected, see http://en.wikipedia.org/wiki/DNS_rebinding"); exit; -- cgit v1.1 From 2003b5d8bc9c9b2b7aa72f4d3c4532c7349264cd Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 9 Jul 2010 09:50:01 -0400 Subject: Print a warning on the login screen if you are accessing the router by a non-local IP address (one not configured on the system) to warn about potential MITM attacks. --- etc/inc/authgui.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/etc/inc/authgui.inc b/etc/inc/authgui.inc index b3cd6a6..0747452 100644 --- a/etc/inc/authgui.inc +++ b/etc/inc/authgui.inc @@ -163,6 +163,24 @@ function display_login_form() { exit; } +/* Check against locally configured IP addresses, which will catch when someone + port forwards WebGUI access from WAN to an internal IP on the router. */ +global $FilterIflist; +$local_ip = false; +if(strstr($_SERVER['HTTP_HOST'], ":")) { + $http_host_port = explode(":", $_SERVER['HTTP_HOST']); + $http_host = $http_host_port[0]; +} else { + $http_host = $_SERVER['HTTP_HOST']; +} +if (empty($FilterIflist)) { + require_once('filter.inc'); + require_once('shaper.inc'); + filter_generate_optcfg_array(); +} +foreach ($FilterIflist as $iflist) + if($iflist['ip'] == $http_host) + $local_ip = true; ?>
+
If you did not setup this forwarding, you may be the target of a man-in-the-middle attack.")); ?>

-- cgit v1.1 From f85d812be0ab9c6bd4f2adb0c6cefd7a95f3b224 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 9 Jul 2010 11:04:07 -0400 Subject: Remove stray . Obtained-from: m0n0wall --- usr/local/www/diag_ipsec_sad.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/diag_ipsec_sad.php b/usr/local/www/diag_ipsec_sad.php index 75ec782..d0dd0b0 100755 --- a/usr/local/www/diag_ipsec_sad.php +++ b/usr/local/www/diag_ipsec_sad.php @@ -85,7 +85,7 @@ if ($_GET['act'] == "del") { Source - Destination + Destination Protocol SPI Enc. alg. -- cgit v1.1 From d030c9ded4e5541de5be8e73d2bd4f5942380b45 Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Fri, 9 Jul 2010 17:48:17 -0600 Subject: Properly select the interfaces when displaying the edit page for floating rules that have multiple selected interfaces. Fixes #726 --- usr/local/www/firewall_rules_edit.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 10c3796..277ad26 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -644,9 +644,10 @@ include("head.inc"); $interfaces["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) - $interfaces["openvpn"] = "OpenVPN"; + $interfaces["openvpn"] = "OpenVPN"; + $selected_interfaces = explode(",", $pconfig['interface']); foreach ($interfaces as $iface => $ifacename): ?> - +
-- cgit v1.1 From b3cf36d740b6ae39724e48cf5230f68b7bfc17f5 Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Fri, 9 Jul 2010 18:26:57 -0600 Subject: Fix typo that prevented these two checkboxes from displaying the proper state when editing OpenVPN server settings. --- usr/local/www/vpn_openvpn_server.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php index e39e93a..4b9a29a 100644 --- a/usr/local/www/vpn_openvpn_server.php +++ b/usr/local/www/vpn_openvpn_server.php @@ -930,7 +930,7 @@ function netbios_change() { - "> + /> @@ -948,7 +948,7 @@ function netbios_change() { - "> + /> -- cgit v1.1 From 43141617a39cd665db6d9fca76b10e3d5ac02e43 Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Fri, 9 Jul 2010 23:52:53 -0600 Subject: Combine checkout logic for cloning and updating in gitsync and fix a condition showing an error message on the initial cloning. --- etc/phpshellsessions/gitsync | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/etc/phpshellsessions/gitsync b/etc/phpshellsessions/gitsync index cff0b04..1d95bc3 100644 --- a/etc/phpshellsessions/gitsync +++ b/etc/phpshellsessions/gitsync @@ -147,25 +147,27 @@ if($nobackup == false) { echo "===> Checking out $branch\n"; exec("mkdir -p /root/pfsense/$branch"); +// Git commands for resetting to the specified branch +if($branch == "build_commit") { + $git_cmd = array( + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git branch $branch 2>/dev/null", + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git checkout -f $branch 2>/dev/null", + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset --hard `cat /etc/version.lastcommit`" + ); +} else { + $git_cmd = array( + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git branch $branch origin/$branch 2>/dev/null", + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git checkout -f $branch 2>/dev/null", + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset --hard origin/$branch" + ); +} + // Git 'er done! if(is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) { echo "===> Fetching updates...\n"; exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git config remote.origin.url $GIT_REPO"); exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git fetch"); exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git clean -f -f -x -d"); - if($branch == "build_commit") { - $git_cmd = array( - "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git branch $branch 2>/dev/null", - "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git checkout -f $branch 2>/dev/null", - "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset --hard `cat /etc/version.lastcommit`" - ); - } else { - $git_cmd = array( - "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git branch $branch origin/$branch 2>/dev/null", - "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git checkout -f $branch 2>/dev/null", - "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset --hard origin/$branch" - ); - } run_cmds($git_cmd); } else { exec("mkdir -p $CODIR/pfSenseGITREPO"); @@ -175,13 +177,7 @@ if(is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) { exec("mv $CODIR/pfSenseGITREPO/pfSense $CODIR/pfSenseGITREPO/pfSenseGITREPO"); if(is_dir("$CODIR/pfSenseGITREPO/mainline")) exec("mv $CODIR/pfSenseGITREPO/mainline $CODIR/pfSenseGITREPO/pfSenseGITREPO"); - if($branch == "master") { - exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git checkout master"); - } else if($branch == "build_commit") { - exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git checkout -b build_commit `cat /etc/version.lastcommit`"); - } else { - exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git checkout -b $branch origin/$branch"); - } + run_cmds($git_cmd); } foreach($merge_repos as $merge_repo) { -- cgit v1.1 From 42f1649fbb4b90f6e2e1cfb78ab7b7acb744d776 Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Sat, 10 Jul 2010 13:46:25 -0600 Subject: Restore the code for getting the step's title and description after the step ID is set so that it is read from the correct step. --- usr/local/www/wizard.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 800bf30..540236c 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -158,6 +158,9 @@ function update_config_field($field, $updatetext, $unset, $arraynum, $field_type eval($text); } +$title = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['title']); +$description = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$stepid]['description']); + // handle before form display event. do { $oldstepid = $stepid; -- cgit v1.1 From 1fb064e86d12b5a70130e06e3748f345a534fb9b Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Sat, 10 Jul 2010 21:36:54 -0600 Subject: Separate regdomain.xml parsing back to a separate file, so it can be used when xmlreader.inc is used instead of xmlparse.inc --- etc/inc/xmlparse.inc | 41 +-------- etc/inc/xmlparse_attr.inc | 194 +++++++++++++++++++++++++++++++++++++++++++ usr/local/www/interfaces.php | 1 + 3 files changed, 196 insertions(+), 40 deletions(-) create mode 100644 etc/inc/xmlparse_attr.inc diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc index 59b0eb4..7a9d7b8 100644 --- a/etc/inc/xmlparse.inc +++ b/etc/inc/xmlparse.inc @@ -59,28 +59,14 @@ function listtags_pkg() { return $ret; } -/* The following items will be treated as arrays in regdomain.xml */ -function listtags_rd() { - $ret = explode(" ", - "band country flags freqband netband rd " - ); - return $ret; -} - function startElement($parser, $name, $attrs) { - global $parsedcfg, $depth, $curpath, $havedata, $listtags, $parsedattrs, $parsingattrs; + global $parsedcfg, $depth, $curpath, $havedata, $listtags; array_push($curpath, strtolower($name)); $ptr =& $parsedcfg; - if (isset($parsingattrs) && !empty($attrs)) { - $attrptr =& $parsedattrs; - $writeattrs = true; - } foreach ($curpath as $path) { $ptr =& $ptr[$path]; - if (isset($writeattrs)) - $attrptr =& $attrptr[$path]; } /* is it an element that belongs to a list? */ @@ -94,19 +80,11 @@ function startElement($parser, $name, $attrs) { array_push($curpath, count($ptr)); - if (isset($writeattrs)) { - if (!is_array($attrptr)) - $attrptr = array(); - $attrptr[count($ptr)] = $attrs; - } - } else if (isset($ptr)) { /* multiple entries not allowed for this element, bail out */ die(sprintf("XML error: %s at line %d cannot occur more than once\n", $name, xml_get_current_line_number($parser))); - } else if (isset($writeattrs)) { - $attrptr = $attrs; } $depth++; @@ -180,23 +158,6 @@ function parse_xml_config_pkg($cffile, $rootobj, $isstring = "false") { return $cfg; } -function parse_xml_regdomain(&$rdattributes, $rdfile = '/etc/regdomain.xml', $rootobj = 'regulatory-data') { - global $listtags, $parsedattrs, $parsingattrs; - $listtags = listtags_rd(); - if (isset($rdattributes)) { - $parsedattrs = array(); - $parsingattrs = true; - $ret = parse_xml_config_raw($rdfile, $rootobj); - if ($parsedattrs[$rootobj]) - $rdattributes = $parsedattrs[$rootobj]; - unset($parsedattrs); - unset($parsingattrs); - return $ret; - } else { - return parse_xml_config_raw($rdfile, $rootobj); - } -} - function parse_xml_config_raw($cffile, $rootobj, $isstring = "false") { global $depth, $curpath, $parsedcfg, $havedata, $listtags; diff --git a/etc/inc/xmlparse_attr.inc b/etc/inc/xmlparse_attr.inc new file mode 100644 index 0000000..67cc857 --- /dev/null +++ b/etc/inc/xmlparse_attr.inc @@ -0,0 +1,194 @@ +. + 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. +*/ + +/* The following items will be treated as arrays in regdomain.xml */ +function listtags_rd() { + $ret = explode(" ", + "band country flags freqband netband rd" + ); + return $ret; +} + +function startElement_attr($parser, $name, $attrs) { + global $parsedcfg, $depth, $curpath, $havedata, $listtags, $parsedattrs; + + array_push($curpath, strtolower($name)); + + $ptr =& $parsedcfg; + if (!empty($attrs)) { + $attrptr =& $parsedattrs; + $writeattrs = true; + } + foreach ($curpath as $path) { + $ptr =& $ptr[$path]; + if (isset($writeattrs)) + $attrptr =& $attrptr[$path]; + } + + /* is it an element that belongs to a list? */ + if (in_array(strtolower($name), $listtags)) { + + /* is there an array already? */ + if (!is_array($ptr)) { + /* make an array */ + $ptr = array(); + } + + array_push($curpath, count($ptr)); + + if (isset($writeattrs)) { + if (!is_array($attrptr)) + $attrptr = array(); + $attrptr[count($ptr)] = $attrs; + } + + } else if (isset($ptr)) { + /* multiple entries not allowed for this element, bail out */ + die(sprintf("XML error: %s at line %d cannot occur more than once\n", + $name, + xml_get_current_line_number($parser))); + } else if (isset($writeattrs)) { + $attrptr = $attrs; + } + + $depth++; + $havedata = $depth; +} + +function endElement_attr($parser, $name) { + global $depth, $curpath, $parsedcfg, $havedata, $listtags; + + if ($havedata == $depth) { + $ptr =& $parsedcfg; + foreach ($curpath as $path) { + $ptr =& $ptr[$path]; + } + $ptr = ""; + } + + array_pop($curpath); + + if (in_array(strtolower($name), $listtags)) + array_pop($curpath); + + $depth--; +} + +function cData_attr($parser, $data) { + global $depth, $curpath, $parsedcfg, $havedata; + + $data = trim($data, "\t\n\r"); + + if ($data != "") { + $ptr =& $parsedcfg; + foreach ($curpath as $path) { + $ptr =& $ptr[$path]; + } + + if (is_string($ptr)) { + $ptr .= html_entity_decode($data); + } else { + if (trim($data, " ") != "") { + $ptr = html_entity_decode($data); + $havedata++; + } + } + } +} + +function parse_xml_regdomain(&$rdattributes, $rdfile = '/etc/regdomain.xml', $rootobj = 'regulatory-data') { + global $listtags; + $listtags = listtags_rd(); + return parse_xml_config_raw_attr($rdfile, $rootobj, $rdattributes); +} + +function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isstring = "false") { + + global $depth, $curpath, $parsedcfg, $havedata, $listtags, $parsedattrs; + $parsedcfg = array(); + $curpath = array(); + $depth = 0; + $havedata = 0; + + if (isset($parsed_attributes)) + $parsedattrs = array(); + + $xml_parser = xml_parser_create(); + + xml_set_element_handler($xml_parser, "startElement_attr", "endElement_attr"); + xml_set_character_data_handler($xml_parser, "cData_attr"); + xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE, 1); + + if (!($fp = fopen($cffile, "r"))) { + log_error("Error: could not open XML input\n"); + if (isset($parsed_attributes)) { + $parsed_attributes = array(); + unset($parsedattrs); + } + return -1; + } + + while ($data = fread($fp, 4096)) { + if (!xml_parse($xml_parser, $data, feof($fp))) { + log_error(sprintf("XML error: %s at line %d\n", + xml_error_string(xml_get_error_code($xml_parser)), + xml_get_current_line_number($xml_parser))); + if (isset($parsed_attributes)) { + $parsed_attributes = array(); + unset($parsedattrs); + } + return -1; + } + } + xml_parser_free($xml_parser); + + if (!$parsedcfg[$rootobj]) { + log_error("XML error: no $rootobj object found!\n"); + if (isset($parsed_attributes)) { + $parsed_attributes = array(); + unset($parsedattrs); + } + return -1; + } + + if (isset($parsed_attributes)) { + if ($parsedattrs[$rootobj]) + $parsed_attributes = $parsedattrs[$rootobj]; + unset($parsedattrs); + } + + return $parsedcfg[$rootobj]; +} + +?> diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 94fd82f..7d3a548 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -52,6 +52,7 @@ require_once("filter.inc"); require_once("shaper.inc"); require_once("rrd.inc"); require_once("vpn.inc"); +require_once("xmlparse_attr.inc"); if ($_REQUEST['if']) { $if = $_REQUEST['if']; -- cgit v1.1 From 7017b54ec4f8a53ce6af501fac1ce7c0ea60096a Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Sat, 10 Jul 2010 23:20:40 -0600 Subject: Speed up loading information from regdomain.xml --- etc/inc/xmlparse_attr.inc | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/etc/inc/xmlparse_attr.inc b/etc/inc/xmlparse_attr.inc index 67cc857..06d02c4 100644 --- a/etc/inc/xmlparse_attr.inc +++ b/etc/inc/xmlparse_attr.inc @@ -127,10 +127,43 @@ function cData_attr($parser, $data) { } } -function parse_xml_regdomain(&$rdattributes, $rdfile = '/etc/regdomain.xml', $rootobj = 'regulatory-data') { - global $listtags; +function parse_xml_regdomain(&$rdattributes, $rdfile = '', $rootobj = 'regulatory-data') { + global $g, $listtags; + + if (empty($rdfile)) + $rdfile = $g['etc_path'] . '/regdomain.xml'; $listtags = listtags_rd(); - return parse_xml_config_raw_attr($rdfile, $rootobj, $rdattributes); + $parsed_xml = array(); + + if (file_exists($g['tmp_path'] . '/regdomain.cache')) { + $parsed_xml = unserialize(file_get_contents($g['tmp_path'] . '/regdomain.cache')); + if (!empty($parsed_xml)) { + $rdmain = $parsed_xml['main']; + $rdattributes = $parsed_xml['attributes']; + } + } + if (empty($parsed_xml) && file_exists($g['etc_path'] . '/regdomain.xml')) { + $rdmain = parse_xml_config_raw_attr($rdfile, $rootobj, $rdattributes); + + // unset parts that aren't used before making cache + foreach ($rdmain['regulatory-domains']['rd'] as $rdkey => $rdentry) { + if (isset($rdmain['regulatory-domains']['rd'][$rdkey]['netband'])) + unset($rdmain['regulatory-domains']['rd'][$rdkey]['netband']); + if (isset($rdattributes['regulatory-domains']['rd'][$rdkey]['netband'])) + unset($rdattributes['regulatory-domains']['rd'][$rdkey]['netband']); + } + if (isset($rdmain['shared-frequency-bands'])) + unset($rdmain['shared-frequency-bands']); + if (isset($rdattributes['shared-frequency-bands'])) + unset($rdattributes['shared-frequency-bands']); + + $parsed_xml = array('main' => $rdmain, 'attributes' => $rdattributes); + $rdcache = fopen($g['tmp_path'] . '/regdomain.cache', "w"); + fwrite($rdcache, serialize($parsed_xml)); + fclose($rdcache); + } + + return $rdmain; } function parse_xml_config_raw_attr($cffile, $rootobj, &$parsed_attributes, $isstring = "false") { -- cgit v1.1 From f8cb57dba22f108865bdd84dd4d6866059fb41b8 Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 11 Jul 2010 17:23:44 -0400 Subject: couple load balancer fixes, resolves #723 --- etc/inc/vslb.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/inc/vslb.inc b/etc/inc/vslb.inc index ef35c2b..4c90f22 100644 --- a/etc/inc/vslb.inc +++ b/etc/inc/vslb.inc @@ -230,7 +230,7 @@ function relayd_configure() { if(is_array($vs_a)) { for ($i = 0; isset($vs_a[$i]); $i++) { switch($vs_a[$i]['mode']) { - case 'redirect': { + case 'redirect_mode': { $conf .= "redirect \"{$vs_a[$i]['name']}\" {\n"; $conf .= " listen on {$vs_a[$i]['ipaddr']} port {$vs_a[$i]['port']}\n"; $conf .= " forward to <{$vs_a[$i]['pool']}> port {$pools[$vs_a[$i]['pool']]['port']} {$check_a[$pools[$vs_a[$i]['pool']]['monitor']]} timeout 1000\n"; @@ -259,7 +259,7 @@ function relayd_configure() { fwrite($fd, $conf); fclose($fd); - if (is_process_running('relayd: parent')) { + if (is_process_running('relayd')) { /* * XXX: Something breaks our control connection with relayd and makes relayctl stop working * rule reloads are the current suspect -- cgit v1.1 From b2911375bdcd130a2a83b0dcf6ab53c26124114c Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 11 Jul 2010 18:50:02 -0400 Subject: fix double click to edit --- usr/local/www/classes/maintable.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/classes/maintable.inc b/usr/local/www/classes/maintable.inc index d3d9995..2396a0d 100644 --- a/usr/local/www/classes/maintable.inc +++ b/usr/local/www/classes/maintable.inc @@ -116,7 +116,7 @@ class MainTable { } else { $cl = 'listr'; } - echo " edit_uri}?id={$cur_row}\'\">\n"; + echo " edit_uri}?id={$cur_row}'\">\n"; if (is_array($row[$this->cname[$col]])) { foreach ($row[$this->cname[$col]] as $data) { echo " {$data}
\n"; -- cgit v1.1 From 477dcf13ce1e189327d2209b88288effd8cc0846 Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 11 Jul 2010 19:13:57 -0400 Subject: rename slbd pages since this is no longer slbd --- etc/inc/priv.defs.inc | 4 +- usr/local/www/fbegin.inc | 2 +- usr/local/www/help.php | 4 +- usr/local/www/load_balancer_monitor.php | 4 +- usr/local/www/load_balancer_monitor_edit.php | 4 +- usr/local/www/load_balancer_pool.php | 4 +- usr/local/www/load_balancer_pool_edit.php | 4 +- usr/local/www/load_balancer_relay_action.php | 4 +- usr/local/www/load_balancer_relay_action_edit.php | 4 +- usr/local/www/load_balancer_relay_protocol.php | 4 +- .../www/load_balancer_relay_protocol_edit.php | 4 +- usr/local/www/load_balancer_virtual_server.php | 4 +- .../www/load_balancer_virtual_server_edit.php | 4 +- usr/local/www/status_lb_pool.php | 168 +++++++++++++++++++ usr/local/www/status_lb_vs.php | 183 +++++++++++++++++++++ usr/local/www/status_slbd_pool.php | 168 ------------------- usr/local/www/status_slbd_vs.php | 183 --------------------- 17 files changed, 376 insertions(+), 376 deletions(-) create mode 100755 usr/local/www/status_lb_pool.php create mode 100755 usr/local/www/status_lb_vs.php delete mode 100755 usr/local/www/status_slbd_pool.php delete mode 100755 usr/local/www/status_slbd_vs.php diff --git a/etc/inc/priv.defs.inc b/etc/inc/priv.defs.inc index f8bb5ea..3139972 100644 --- a/etc/inc/priv.defs.inc +++ b/etc/inc/priv.defs.inc @@ -790,13 +790,13 @@ $priv_list['page-status-loadbalancer-pool'] = array(); $priv_list['page-status-loadbalancer-pool']['name'] = "WebCfg - Status: Load Balancer: Pool page"; $priv_list['page-status-loadbalancer-pool']['descr'] = "Allow access to the 'Status: Load Balancer: Pool' page."; $priv_list['page-status-loadbalancer-pool']['match'] = array(); -$priv_list['page-status-loadbalancer-pool']['match'][] = "status_slbd_pool.php*"; +$priv_list['page-status-loadbalancer-pool']['match'][] = "status_lb_pool.php*"; $priv_list['page-status-loadbalancer-virtualserver'] = array(); $priv_list['page-status-loadbalancer-virtualserver']['name'] = "WebCfg - Status: Load Balancer: Virtual Server page"; $priv_list['page-status-loadbalancer-virtualserver']['descr'] = "Allow access to the 'Status: Load Balancer: Virtual Server' page."; $priv_list['page-status-loadbalancer-virtualserver']['match'] = array(); -$priv_list['page-status-loadbalancer-virtualserver']['match'][] = "status_slbd_vs.php*"; +$priv_list['page-status-loadbalancer-virtualserver']['match'][] = "status_lb_vs.php*"; $priv_list['page-status-upnpstatus'] = array(); $priv_list['page-status-upnpstatus']['name'] = "WebCfg - Status: UPnP Status page"; diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 4874ac9..c775aaa 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -156,7 +156,7 @@ $status_menu[] = array("DHCP Leases", "/status_dhcp_leases.php"); $status_menu[] = array("Filter Reload", "/status_filter_reload.php"); $status_menu[] = array("Interfaces", "/status_interfaces.php"); $status_menu[] = array("IPsec", "/diag_ipsec.php"); -$status_menu[] = array("Load Balancer", "/status_slbd_pool.php"); +$status_menu[] = array("Load Balancer", "/status_lb_pool.php"); $status_menu[] = array("OpenVPN", "/status_openvpn.php"); if ($g['platform'] == "pfSense") $status_menu[] = array("Package Logs", "/diag_pkglogs.php"); diff --git a/usr/local/www/help.php b/usr/local/www/help.php index f8f11ed..bb990b7 100644 --- a/usr/local/www/help.php +++ b/usr/local/www/help.php @@ -226,8 +226,8 @@ $helppages = array( 'load_balancer_relay_protocol_edit.php' => 'http://doc.pfsense.org/index.php/Category:Load_balancing', 'load_balancer_virtual_server.php' => 'http://doc.pfsense.org/index.php/Category:Load_balancing', 'load_balancer_virtual_server_edit.php' => 'http://doc.pfsense.org/index.php/Category:Load_balancing', - 'status_slbd_pool.php' => 'http://doc.pfsense.org/index.php/Category:Load_balancing', - 'status_slbd_vs.php' => 'http://doc.pfsense.org/index.php/Category:Load_balancing', + 'status_lb_pool.php' => 'http://doc.pfsense.org/index.php/Category:Load_balancing', + 'status_lb_vs.php' => 'http://doc.pfsense.org/index.php/Category:Load_balancing', /* From here down are packages. Not checking these as strictly, diff --git a/usr/local/www/load_balancer_monitor.php b/usr/local/www/load_balancer_monitor.php index 2f0f372..86f7530 100755 --- a/usr/local/www/load_balancer_monitor.php +++ b/usr/local/www/load_balancer_monitor.php @@ -86,8 +86,8 @@ if ($_GET['act'] == "del") { } $pgtitle = array("Services", "Load Balancer","Monitor"); -#$statusurl = "status_slbd_vs.php"; -$statusurl = "status_slbd_pool.php"; +#$statusurl = "status_lb_vs.php"; +$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/load_balancer_monitor_edit.php b/usr/local/www/load_balancer_monitor_edit.php index c3b269f..934be05 100755 --- a/usr/local/www/load_balancer_monitor_edit.php +++ b/usr/local/www/load_balancer_monitor_edit.php @@ -188,8 +188,8 @@ if ($_POST) { } $pgtitle = array("Services", "Load Balancer","Monitor","Edit"); -#$statusurl = "status_slbd_vs.php"; -$statusurl = "status_slbd_pool.php"; +#$statusurl = "status_lb_vs.php"; +$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/load_balancer_pool.php b/usr/local/www/load_balancer_pool.php index 4742ab1..bc97d85 100755 --- a/usr/local/www/load_balancer_pool.php +++ b/usr/local/www/load_balancer_pool.php @@ -95,8 +95,8 @@ for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) { } $pgtitle = array("Services", "Load Balancer","Pool"); -#$statusurl = "status_slbd_vs.php"; -$statusurl = "status_slbd_pool.php"; +#$statusurl = "status_lb_vs.php"; +$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/load_balancer_pool_edit.php b/usr/local/www/load_balancer_pool_edit.php index 5936d35..f34a31a 100755 --- a/usr/local/www/load_balancer_pool_edit.php +++ b/usr/local/www/load_balancer_pool_edit.php @@ -138,8 +138,8 @@ if ($_POST) { } $pgtitle = array("Services", "Load Balancer","Pool","Edit"); -#$statusurl = "status_slbd_vs.php"; -$statusurl = "status_slbd_pool.php"; +#$statusurl = "status_lb_vs.php"; +$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/load_balancer_relay_action.php b/usr/local/www/load_balancer_relay_action.php index 36b4b8f..5e73cfb 100755 --- a/usr/local/www/load_balancer_relay_action.php +++ b/usr/local/www/load_balancer_relay_action.php @@ -102,8 +102,8 @@ if ($_GET['act'] == "del") { */ $pgtitle = array("Services", "Load Balancer","Relay Action"); -#$statusurl = "status_slbd_vs.php"; -$statusurl = "status_slbd_pool.php"; +#$statusurl = "status_lb_vs.php"; +$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/load_balancer_relay_action_edit.php b/usr/local/www/load_balancer_relay_action_edit.php index dc47e45..d623fef 100755 --- a/usr/local/www/load_balancer_relay_action_edit.php +++ b/usr/local/www/load_balancer_relay_action_edit.php @@ -176,8 +176,8 @@ if ($_POST) { } $pgtitle = array("Services", "Load Balancer","Relay Action","Edit"); -#$statusurl = "status_slbd_vs.php"; -$statusurl = "status_slbd_pool.php"; +#$statusurl = "status_lb_vs.php"; +$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/load_balancer_relay_protocol.php b/usr/local/www/load_balancer_relay_protocol.php index f854041..d184f1d 100755 --- a/usr/local/www/load_balancer_relay_protocol.php +++ b/usr/local/www/load_balancer_relay_protocol.php @@ -98,8 +98,8 @@ if ($_GET['act'] == "del") { */ $pgtitle = array("Services", "Load Balancer","Relay Protocol"); -#$statusurl = "status_slbd_vs.php"; -$statusurl = "status_slbd_pool.php"; +#$statusurl = "status_lb_vs.php"; +$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/load_balancer_relay_protocol_edit.php b/usr/local/www/load_balancer_relay_protocol_edit.php index 4575aeb..519dd0b 100755 --- a/usr/local/www/load_balancer_relay_protocol_edit.php +++ b/usr/local/www/load_balancer_relay_protocol_edit.php @@ -132,8 +132,8 @@ if ($_POST) { } $pgtitle = array("Services", "Load Balancer","Relay Protocol","Edit"); -#$statusurl = "status_slbd_vs.php"; -$statusurl = "status_slbd_pool.php"; +#$statusurl = "status_lb_vs.php"; +$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/load_balancer_virtual_server.php b/usr/local/www/load_balancer_virtual_server.php index 9114dc9..4e6186e 100755 --- a/usr/local/www/load_balancer_virtual_server.php +++ b/usr/local/www/load_balancer_virtual_server.php @@ -94,8 +94,8 @@ for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) { } $pgtitle = array("Services","Load Balancer","Virtual Servers"); -$statusurl = "status_slbd_vs.php"; -#$statusurl = "status_slbd_pool.php"; +$statusurl = "status_lb_vs.php"; +#$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/load_balancer_virtual_server_edit.php b/usr/local/www/load_balancer_virtual_server_edit.php index dda2c71..7bd2e7b 100755 --- a/usr/local/www/load_balancer_virtual_server_edit.php +++ b/usr/local/www/load_balancer_virtual_server_edit.php @@ -129,8 +129,8 @@ if ($_POST) { } $pgtitle = array("Services", "Load Balancer","Virtual Server","Edit"); -$statusurl = "status_slbd_vs.php"; -#$statusurl = "status_slbd_pool.php"; +$statusurl = "status_lb_vs.php"; +#$statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); diff --git a/usr/local/www/status_lb_pool.php b/usr/local/www/status_lb_pool.php new file mode 100755 index 0000000..8ac950f --- /dev/null +++ b/usr/local/www/status_lb_pool.php @@ -0,0 +1,168 @@ +. + 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: routing +*/ + +##|+PRIV +##|*IDENT=page-status-loadbalancer-pool +##|*NAME=Status: Load Balancer: Pool page +##|*DESCR=Allow access to the 'Status: Load Balancer: Pool' page. +##|*MATCH=status_lb_pool.php* +##|-PRIV + +require("guiconfig.inc"); + +if (!is_array($config['load_balancer']['lbpool'])) { + $config['load_balancer']['lbpool'] = array(); +} +$a_pool = &$config['load_balancer']['lbpool']; + +$slbd_logfile = "{$g['varlog_path']}/slbd.log"; + +$nentries = $config['syslog']['nentries']; +if (!$nentries) + $nentries = 50; + +$now = time(); +$year = date("Y"); + +$pgtitle = array("Status","Load Balancer","Pool"); +include("head.inc"); + +?> + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + +
NameTypeGatewaysStatusDescription
+ + + +
+ () +
+ + "; + } + ?> +
{$svr[0]}
+
+ + "; + } + } else { + PRINT ""; + } + ?> +
$online "; + if($lastchange <> "") { + PRINT "Last change $lastchange"; + } else { + PRINT "No changes found in logfile"; + } + PRINT "
{$vipent['monitor']}
+
+ +
+
+
+ + + + diff --git a/usr/local/www/status_lb_vs.php b/usr/local/www/status_lb_vs.php new file mode 100755 index 0000000..0589425 --- /dev/null +++ b/usr/local/www/status_lb_vs.php @@ -0,0 +1,183 @@ +. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* + pfSense_BUILDER_BINARIES: /usr/local/sbin/relayctl + pfSense_MODULE: routing +*/ + +##|+PRIV +##|*IDENT=page-status-loadbalancer-virtualserver +##|*NAME=Status: Load Balancer: Virtual Server page +##|*DESCR=Allow access to the 'Status: Load Balancer: Virtual Server' page. +##|*MATCH=status_lb_vs.php* +##|-PRIV + +require("guiconfig.inc"); + +if (!is_array($config['load_balancer']['lbpool'])) { + $config['load_balancer']['lbpool'] = array(); +} +if (!is_array($config['load_balancer']['virtual_server'])) { + $config['load_balancer']['virtual_server'] = array(); +} +$a_vs = &$config['load_balancer']['virtual_server']; +$a_pool = &$config['load_balancer']['lbpool']; + + + +// # relayctl show summary +// Id Type Name Avlblty Status +// 1 redirect testvs2 active +// 5 table test2:80 active (3 hosts up) +// 11 host 192.168.1.2 91.55% up +// 10 host 192.168.1.3 100.00% up +// 9 host 192.168.1.4 88.73% up +// 3 table test:80 active (1 hosts up) +// 7 host 192.168.1.2 66.20% down +// 6 host 192.168.1.3 97.18% up +// 0 redirect testvs active +// 3 table test:80 active (1 hosts up) +// 7 host 192.168.1.2 66.20% down +// 6 host 192.168.1.3 97.18% up +// 4 table testvs-sitedown:80 active (1 hosts up) +// 8 host 192.168.1.4 84.51% up +// # relayctl show redirects +// Id Type Name Avlblty Status +// 1 redirect testvs2 active +// 0 redirect testvs active +// # relayctl show redirects +// Id Type Name Avlblty Status +// 1 redirect testvs2 active +// total: 2 sessions +// last: 2/60s 2/h 2/d sessions +// average: 1/60s 0/h 0/d sessions +// 0 redirect testvs active + +$redirects_a = array(); +exec('/usr/local/sbin/relayctl show redirects 2>&1', $redirects_a); +$summary_a = array(); +exec('/usr/local/sbin/relayctl show summary 2>&1', $summary_a); +$rdr_a = parse_redirects($redirects_a); +//$server_a = parse_summary($summary_a, parse_redirects($redirects_a)); + +function parse_redirects($rdr_a) { + $vs = array(); + for ($i = 0; isset($rdr_a[$i]); $i++) { + $line = $rdr_a[$i]; + if (preg_match("/^[0-9]+/", $line)) { + $regs = array(); + if($x = preg_match("/^[0-9]+\s+redirect\s+([0-9a-zA-Z]+)\s+([a-z]+)/", $line, $regs)) { + $vs[$regs[1]] = array(); + $vs[$regs[1]]['status'] = $regs[2]; + } + } + } + return $vs; +} + +function parse_summary($summary, $rdrs_a) { + $server_a = array(); + return $server_a; +} + +$pgtitle = array("Status","Load Balancer","Virtual Server"); +include("head.inc"); + +?> + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + +
NamePortServersStatusDescription
+ + + +
+
+ + "; + } + } + } + ?> +
{$server}
+
+ + + +
+
+
+ + + + diff --git a/usr/local/www/status_slbd_pool.php b/usr/local/www/status_slbd_pool.php deleted file mode 100755 index 0e8eb66..0000000 --- a/usr/local/www/status_slbd_pool.php +++ /dev/null @@ -1,168 +0,0 @@ -. - 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: routing -*/ - -##|+PRIV -##|*IDENT=page-status-loadbalancer-pool -##|*NAME=Status: Load Balancer: Pool page -##|*DESCR=Allow access to the 'Status: Load Balancer: Pool' page. -##|*MATCH=status_slbd_pool.php* -##|-PRIV - -require("guiconfig.inc"); - -if (!is_array($config['load_balancer']['lbpool'])) { - $config['load_balancer']['lbpool'] = array(); -} -$a_pool = &$config['load_balancer']['lbpool']; - -$slbd_logfile = "{$g['varlog_path']}/slbd.log"; - -$nentries = $config['syslog']['nentries']; -if (!$nentries) - $nentries = 50; - -$now = time(); -$year = date("Y"); - -$pgtitle = array("Status","Load Balancer","Pool"); -include("head.inc"); - -?> - - - - - - -
- -
-
- - - - - - - - - - - - - - - - - -
NameTypeGatewaysStatusDescription
- - - -
- () -
- - "; - } - ?> -
{$svr[0]}
-
- - "; - } - } else { - PRINT ""; - } - ?> -
$online "; - if($lastchange <> "") { - PRINT "Last change $lastchange"; - } else { - PRINT "No changes found in logfile"; - } - PRINT "
{$vipent['monitor']}
-
- -
-
-
- - - - diff --git a/usr/local/www/status_slbd_vs.php b/usr/local/www/status_slbd_vs.php deleted file mode 100755 index f421a7f..0000000 --- a/usr/local/www/status_slbd_vs.php +++ /dev/null @@ -1,183 +0,0 @@ -. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ -/* - pfSense_BUILDER_BINARIES: /usr/local/sbin/relayctl - pfSense_MODULE: routing -*/ - -##|+PRIV -##|*IDENT=page-status-loadbalancer-virtualserver -##|*NAME=Status: Load Balancer: Virtual Server page -##|*DESCR=Allow access to the 'Status: Load Balancer: Virtual Server' page. -##|*MATCH=status_slbd_vs.php* -##|-PRIV - -require("guiconfig.inc"); - -if (!is_array($config['load_balancer']['lbpool'])) { - $config['load_balancer']['lbpool'] = array(); -} -if (!is_array($config['load_balancer']['virtual_server'])) { - $config['load_balancer']['virtual_server'] = array(); -} -$a_vs = &$config['load_balancer']['virtual_server']; -$a_pool = &$config['load_balancer']['lbpool']; - - - -// # relayctl show summary -// Id Type Name Avlblty Status -// 1 redirect testvs2 active -// 5 table test2:80 active (3 hosts up) -// 11 host 192.168.1.2 91.55% up -// 10 host 192.168.1.3 100.00% up -// 9 host 192.168.1.4 88.73% up -// 3 table test:80 active (1 hosts up) -// 7 host 192.168.1.2 66.20% down -// 6 host 192.168.1.3 97.18% up -// 0 redirect testvs active -// 3 table test:80 active (1 hosts up) -// 7 host 192.168.1.2 66.20% down -// 6 host 192.168.1.3 97.18% up -// 4 table testvs-sitedown:80 active (1 hosts up) -// 8 host 192.168.1.4 84.51% up -// # relayctl show redirects -// Id Type Name Avlblty Status -// 1 redirect testvs2 active -// 0 redirect testvs active -// # relayctl show redirects -// Id Type Name Avlblty Status -// 1 redirect testvs2 active -// total: 2 sessions -// last: 2/60s 2/h 2/d sessions -// average: 1/60s 0/h 0/d sessions -// 0 redirect testvs active - -$redirects_a = array(); -exec('/usr/local/sbin/relayctl show redirects 2>&1', $redirects_a); -$summary_a = array(); -exec('/usr/local/sbin/relayctl show summary 2>&1', $summary_a); -$rdr_a = parse_redirects($redirects_a); -//$server_a = parse_summary($summary_a, parse_redirects($redirects_a)); - -function parse_redirects($rdr_a) { - $vs = array(); - for ($i = 0; isset($rdr_a[$i]); $i++) { - $line = $rdr_a[$i]; - if (preg_match("/^[0-9]+/", $line)) { - $regs = array(); - if($x = preg_match("/^[0-9]+\s+redirect\s+([0-9a-zA-Z]+)\s+([a-z]+)/", $line, $regs)) { - $vs[$regs[1]] = array(); - $vs[$regs[1]]['status'] = $regs[2]; - } - } - } - return $vs; -} - -function parse_summary($summary, $rdrs_a) { - $server_a = array(); - return $server_a; -} - -$pgtitle = array("Status","Load Balancer","Virtual Server"); -include("head.inc"); - -?> - - - - - -
- -
-
- - - - - - - - - - - - - - - - - - -
NamePortServersStatusDescription
- - - -
-
- - "; - } - } - } - ?> -
{$server}
-
- - - -
-
-
- - - - -- cgit v1.1 From 32c580703fb09b02127e4f71ed430c0412419125 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 11 Jul 2010 19:57:33 -0400 Subject: Adding drag and drop feature to firewall rules ordering. Simply start dragging a rule and release and the page will refresh with the new order. If all goes well I will duplicate this feature to other pages with rule reordering functionality. --- usr/local/www/firewall_rules.php | 68 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index b9888e6..a91f851 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -98,6 +98,42 @@ if ($_POST['if']) $ifdescs = get_configured_interface_with_descr(); +// Drag and drop reordering +if($_REQUEST['dragdroporder']) { + // First create a new ruleset array and tmp arrays + $a_filter_unorder = array(); + $a_filter_order = array(); + $a_filter_order_tmp = array(); + // Pointer to id of item being reordered + $found = 0; + $drag_order = $_REQUEST['dragtable']; + // Next traverse through rules building a new order for interface + for ($i = 0; isset($a_filter[$i]); $i++) { + if($a_filter[$i]['interface'] <> $_REQUEST['if']) + $a_filter_unorder[] = $a_filter[$i]; + else + $a_filter_order_tmp[] = $a_filter[$i]; + } + // Reorder rules with the posted order + for ($i = 0; $i + )" id="frd" ondblclick="document.location='firewall_rules_edit.php?id=';"> - + + @@ -649,7 +691,8 @@ echo " -- cgit v1.1 From 087a89f823d366d3588c5ce1ca351b6e2dcee2d3 Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 11 Jul 2010 19:57:36 -0400 Subject: fix some of the logging for load balancer, still partially broken --- etc/inc/system.inc | 5 +++-- etc/inc/vslb.inc | 3 ++- usr/local/www/status_lb_pool.php | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/etc/inc/system.inc b/etc/inc/system.inc index a79a5fb..618a50d 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -483,6 +483,8 @@ function system_syslogd_start() { if($syslogcfg['remoteserver3']) $syslogconf .= "*.* @{$syslogcfg['remoteserver3']}\n"; } + $syslogconf .= "!relayd\n"; + $syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/relayd.log\n"; $syslogconf .= "!-{$facilitylist}\n"; if (!isset($syslogcfg['disablelocallogging'])) $syslogconf .= << +?> \ No newline at end of file diff --git a/etc/inc/vslb.inc b/etc/inc/vslb.inc index 4c90f22..bb92e19 100644 --- a/etc/inc/vslb.inc +++ b/etc/inc/vslb.inc @@ -201,6 +201,7 @@ function relayd_configure() { /* reindex pools by name as we loop through the pools array */ $pools = array(); + $conf .= "log updates \n"; /* Virtual server pools */ if(is_array($pool_a)) { for ($i = 0; isset($pool_a[$i]); $i++) { @@ -272,4 +273,4 @@ function relayd_configure() { } } -?> +?> \ No newline at end of file diff --git a/usr/local/www/status_lb_pool.php b/usr/local/www/status_lb_pool.php index 8ac950f..18b4c57 100755 --- a/usr/local/www/status_lb_pool.php +++ b/usr/local/www/status_lb_pool.php @@ -46,7 +46,7 @@ if (!is_array($config['load_balancer']['lbpool'])) { } $a_pool = &$config['load_balancer']['lbpool']; -$slbd_logfile = "{$g['varlog_path']}/slbd.log"; +$lb_logfile = "{$g['varlog_path']}/relayd.log"; $nentries = $config['syslog']['nentries']; if (!$nentries) @@ -117,7 +117,7 @@ include("head.inc"); $lastchange = ""; $svr = split("\|", $server); $monitorip = $svr[1]; - $logstates = return_clog($slbd_logfile, $nentries, true, array("$monitorip", "marking"), "", true); + $logstates = return_clog($lb_logfile, $nentries, true, array("$monitorip", "marking"), "", true); $logstates = $logstates[0]; -- cgit v1.1 From 7abaeb1fa5fab8f9bf3bf6f745bc228938bcb5f1 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 11 Jul 2010 20:57:02 -0400 Subject: Use the move pointer type --- usr/local/www/firewall_rules.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index a91f851..c39615a 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -752,16 +752,17 @@ echo "

You must apply the changes in order for them to take effect.");?>
+

+ Loading, please wait... +

  +

function updateOrder(order) { + if(document.getElementById("redboxtable")) + $('redboxtable').hide(); + $('loading').show(); document.body.style.cursor = 'wait'; document.location = 'firewall_rules.php?if=&dragdroporder=true&' + Sortable.serialize('dragtable', 'tr'); return; } + $('loading').hide(); -- cgit v1.1 From 23287db727fd3bbebea394d31b2efef95674517f Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 11 Jul 2010 22:07:25 -0400 Subject: Rename to already existing name=infoboxnp --- usr/local/www/firewall_rules.php | 4 ++-- usr/local/www/guiconfig.inc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index 3b6bf9e..b6a3266 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -768,8 +768,8 @@ echo " -
EOFnp; } function print_info_box($msg) { - echo "

"; print_info_box_np($msg); - echo "

"; } function get_std_save_message($ok) { -- cgit v1.1 From 28170529cf612be904941edff6baee6db722f749 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 11 Jul 2010 23:02:09 -0400 Subject: Nuke trailing c/r --- usr/local/www/guiconfig.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index fc39166..44680aa 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -1000,4 +1000,4 @@ function rule_popup($src,$srcport,$dst,$dstport){ } } -?> +?> \ No newline at end of file -- cgit v1.1 From eea1e0c520939830567d88490d279554a26444c2 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 11 Jul 2010 23:20:58 -0400 Subject: Unbreak OnMouseEvent --- usr/local/www/firewall_rules.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index bfbbe4f..0d63526 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -691,8 +691,7 @@ echo "