diff options
author | jim-p <jimp@pfsense.org> | 2015-06-16 13:39:59 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2015-06-16 13:41:12 -0400 |
commit | f128ee222472b05c9ba9f61abbf772518b926528 (patch) | |
tree | 7101664469e9340f3aaabe6687b0f8314fe0222b /usr/local/www | |
parent | 4fabdca76a3f956df4363d7599cfa784848506ab (diff) | |
download | pfsense-f128ee222472b05c9ba9f61abbf772518b926528.zip pfsense-f128ee222472b05c9ba9f61abbf772518b926528.tar.gz |
Remove load_balancer_relay_* -- They are not used, not linked, not functional, not maintained, and have potential security issues.
Diffstat (limited to 'usr/local/www')
-rw-r--r-- | usr/local/www/load_balancer_relay_action.php | 156 | ||||
-rw-r--r-- | usr/local/www/load_balancer_relay_action_edit.php | 570 | ||||
-rw-r--r-- | usr/local/www/load_balancer_relay_protocol.php | 150 | ||||
-rw-r--r-- | usr/local/www/load_balancer_relay_protocol_edit.php | 293 |
4 files changed, 0 insertions, 1169 deletions
diff --git a/usr/local/www/load_balancer_relay_action.php b/usr/local/www/load_balancer_relay_action.php deleted file mode 100644 index bb39846..0000000 --- a/usr/local/www/load_balancer_relay_action.php +++ /dev/null @@ -1,156 +0,0 @@ -<?php -/* $Id$ */ -/* - load_balancer_relay_action.php - part of pfSense (https://www.pfsense.org/) - - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.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. -*/ -/* - pfSense_MODULE: routing -*/ - -##|+PRIV -##|*IDENT=page-services-loadbalancer-relay-action -##|*NAME=Services: Load Balancer: Relay Actions page -##|*DESCR=Allow access to the 'Services: Load Balancer: Relay Actions' page. -##|*MATCH=load_balancer_relay_action.php* -##|-PRIV - -require_once("guiconfig.inc"); -require_once("functions.inc"); -require_once("filter.inc"); -require_once("shaper.inc"); - -if (!is_array($config['load_balancer']['lbaction'])) { - $config['load_balancer']['lbaction'] = array(); -} -$a_action = &$config['load_balancer']['lbaction']; - - -if ($_POST) { - - $pconfig = $_POST; - - if ($_POST['apply']) { - $retval = 0; - $retval |= filter_configure(); - $retval |= relayd_configure(); - - $savemsg = get_std_save_message($retval); - clear_subsystem_dirty('loadbalancer'); - } -} - -if ($_GET['act'] == "del") { - if (array_key_exists($_GET['id'], $a_action)) { - /* make sure no relay protocols reference this entry */ - if (is_array($config['load_balancer']['lbprotocol'])) { - foreach ($config['load_balancer']['lbprotocol'] as $lbp) { - foreach($lbp['lbaction'] as $lba) { - if ($lba['name'] == $a_action[$_GET['id']]['name']) { - $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one relay protocol."); - break; - } - } - } - } - - if (!$input_errors) { - unset($a_action[$_GET['id']]); - write_config(); - mark_subsystem_dirty('loadbalancer'); - header("Location: load_balancer_relay_action.php"); - exit; - } - } -} - -/* Index lbpool array for easy hyperlinking */ -/* for ($i = 0; isset($config['load_balancer']['lbprotocol'][$i]); $i++) { - for ($o = 0; isset($config['load_balancer']['lbprotocol'][$i]['options'][$o]); o++) { - $a_vs[$i]['options'][$o] = " - $a_vs[$i]['poolname'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['poolname']]}\">{$a_vs[$i]['poolname']}</a>"; - if ($a_vs[$i]['sitedown'] != '') { - $a_vs[$i]['sitedown'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['sitedown']]}\">{$a_vs[$i]['sitedown']}</a>"; - } else { - $a_vs[$i]['sitedown'] = 'none'; - } -} -*/ - -$pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Relay Action")); -$shortcut_section = "relayd"; - -include("head.inc"); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php include("fbegin.inc"); ?> -<form action="load_balancer_relay_action.php" method="post"> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<?php if (is_subsystem_dirty('loadbalancer')): ?><p> -<?php print_info_box_np(gettext("The load balancer configuration has been changed.<br />You must apply the changes in order for them to take effect."));?><br /> -<?php endif; ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td class="tabnavtbl"> - <?php - /* active tabs */ - $tab_array = array(); - $tab_array[] = array(gettext("Monitors"), false, "load_balancer_monitor.php"); - $tab_array[] = array(gettext("Pools"), false, "load_balancer_pool.php"); - $tab_array[] = array(gettext("Virtual Servers"), false, "load_balancer_virtual_server.php"); - $tab_array[] = array(gettext("Relay Actions"), true, "load_balancer_relay_action.php"); - $tab_array[] = array(gettext("Relay Protocols"), false, "load_balancer_relay_protocol.php"); - display_top_tabs($tab_array); - ?> - </td></tr> - <tr> - <td> - <div id="mainarea"> -<? - $t = new MainTable(); - $t->edit_uri('load_balancer_relay_action_edit.php'); - $t->my_uri('load_balancer_relay_action.php'); - $t->add_column(gettext('Name'),'name',20); - $t->add_column(gettext('Type'),'type',10); - $t->add_column(gettext('Options'),'options',30); - $t->add_column(gettext('Description'),'descr',30); - $t->add_button('edit'); - $t->add_button('dup'); - $t->add_button('del'); - $t->add_content_array($a_action); - $t->display(); -?> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/usr/local/www/load_balancer_relay_action_edit.php b/usr/local/www/load_balancer_relay_action_edit.php deleted file mode 100644 index ec83402..0000000 --- a/usr/local/www/load_balancer_relay_action_edit.php +++ /dev/null @@ -1,570 +0,0 @@ -<?php -/* $Id$ */ -/* - load_balancer_relay_action_edit.php - part of pfSense (https://www.pfsense.org/) - - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.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. -*/ -/* - pfSense_MODULE: routing -*/ - -##|+PRIV -##|*IDENT=page-services-loadbalancer-relay-action-edit -##|*NAME=Services: Load Balancer: Relay Action: Edit page -##|*DESCR=Allow access to the 'Services: Load Balancer: Relay Action: Edit' page. -##|*MATCH=load_balancer_relay_action_edit.php* -##|-PRIV - -require("guiconfig.inc"); - -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_relay_action.php'); - -if (!is_array($config['load_balancer']['lbaction'])) { - $config['load_balancer']['lbaction'] = array(); -} -$a_action = &$config['load_balancer']['lbaction']; - -if (is_numericint($_GET['id'])) - $id = $_GET['id']; -if (isset($_POST['id']) && is_numericint($_POST['id'])) - $id = $_POST['id']; - -if (isset($id) && $a_action[$id]) { - $pconfig = array(); - $pconfig = $a_action[$id]; -} else { - // XXX - TODO, this isn't sane for this page :) - /* Some sane page defaults */ - $pconfig['protocol'] = 'http'; - $pconfig['direction'] = 'request'; - $pconfig['type'] = 'cookie'; - $pconfig['action'] = 'change'; -} - -$changedesc = gettext("Load Balancer: Relay Action:") . " "; -$changecount = 0; - -$kv = array('key', 'value'); -$vk = array('value', 'key'); -$hr_actions = array(); -$hr_actions['append'] = $vk; -$hr_actions['change'] = $kv; -$hr_actions['expect'] = $vk; -$hr_actions['filter'] = $vk; -$hr_actions['hash'] = 'key'; -$hr_actions['log'] = 'key'; -// mark is disabled until I can figure out how to make the display clean -//$hr_actions['mark'] = array('value', 'key', 'id'); -//$hr_actions[] = 'label'; -//$hr_actions[] = 'no label'; -$hr_actions['remove'] = 'key'; -//$hr_actions[] = 'return error'; -/* Setup decision tree */ -$action = array(); -$actions['protocol']['http'] = 'HTTP'; -$actions['protocol']['tcp'] = 'TCP'; -$actions['protocol']['dns'] = 'DNS'; -$actions['direction'] = array(); -$actions['direction']['request'] = array(); -$actions['direction']['request']['cookie'] = $hr_actions; -$actions['direction']['request']['header'] = $hr_actions; -$actions['direction']['request']['path'] = $hr_actions; -$actions['direction']['request']['query'] = $hr_actions; -$actions['direction']['request']['url'] = $hr_actions; -$actions['direction']['response'] = array(); -$actions['direction']['response']['cookie'] = $hr_actions; -$actions['direction']['response']['header'] = $hr_actions; -//$action['http']['tcp'] = array(); -//$action['http']['ssl'] = array(); - - - -if ($_POST) { - $changecount++; - - unset($input_errors); - $pconfig = $_POST; - - // Peel off the action and type from the post and fix $pconfig - $action = explode('_', $pconfig['action']); - $pconfig['action'] = $action[2]; - $pconfig['type'] = $action[1]; - unset($pconfig["type_{$pconfig['direction']}"]); - - /* input validation */ - $reqdfields = explode(" ", "name protocol direction action descr"); - $reqdfieldsn = array(gettext("Name"),gettext("Protocol"),gettext("Direction"),gettext("Action"),gettext("Description")); - - do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); - - /* Ensure that our monitor names are unique */ - for ($i=0; isset($config['load_balancer']['lbactions'][$i]); $i++) - if (($_POST['name'] == $config['load_balancer']['lbactions'][$i]['name']) && ($i != $id)) - $input_errors[] = gettext("This action name has already been used. Action names must be unique."); - - if (strpos($_POST['name'], " ") !== false) - $input_errors[] = gettext("You cannot use spaces in the 'name' field."); - - if (!$input_errors) { - $actent = array(); - if(isset($id) && $a_action[$id]) - $actent = $a_action[$id]; - if($actent['name'] != "") - $changedesc .= " " . sprintf(gettext("modified '%s' action:"), $actent['name']); - - update_if_changed("name", $actent['name'], $pconfig['name']); - update_if_changed("protocol", $actent['protocol'], $pconfig['protocol']); - update_if_changed("type", $actent['type'], $pconfig['type']); - update_if_changed("direction", $actent['direction'], $pconfig['direction']); - update_if_changed("description", $actent['descr'], $pconfig['descr']); - update_if_changed("action", $actent['action'], $pconfig['action']); - switch ($pconfig['action']) { - case "append": - case "change": - case "expect": - case "filter": { - update_if_changed("value", $actent['options']['value'], $pconfig['option_action_value']); - update_if_changed("key", $actent['options']['akey'], $pconfig['option_action_key']); - break; - } - case "hash": - case "log": { - update_if_changed("key", $actent['options']['akey'], $pconfig['option_action_key']); - break; - } - } - - if (isset($id) && $a_action[$id]) { -// XXX - TODO - /* modify all virtual servers with this name */ -// for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) { -// if ($config['load_balancer']['virtual_server'][$i]['protocol'] == $a_protocol[$id]['name']) -// $config['load_balancer']['virtual_server'][$i]['protocol'] = $protent['name']; -// } - $a_action[$id] = $actent; - } else { - $a_action[] = $actent; - } - if ($changecount > 0) { - /* Mark config dirty */ - mark_subsystem_dirty('loadbalancer'); - write_config($changedesc); - } - - header("Location: load_balancer_relay_action.php"); - exit; - } -} - -$pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Relay Action"),gettext("Edit")); -$shortcut_section = "relayd"; - -include("head.inc"); - $types = array("http" => gettext("HTTP"), "tcp" => gettext("TCP"), "dns" => gettext("DNS")); -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - -<script type="text/javascript"> - -function updateProtocol(m) { - // Default to HTTP - if (m == "") { - m = "http"; - } - switch (m) { - case "dns": { - jQuery('#type_row').hide(); - jQuery('#tcp_options_row').hide(); - jQuery('#ssl_options_row').hide(); - jQuery('#direction_row').hide(); - jQuery('#action_row').hide(); - break; - } - case "tcp": { - jQuery('#type_row').hide(); - jQuery('#tcp_options_row').show(); - jQuery('#ssl_options_row').hide(); - jQuery('#direction_row').hide(); - jQuery('#action_row').hide(); - break; - } - case "http": { - jQuery('#type_row').show(); - jQuery('#tcp_options_row').hide(); - jQuery('#ssl_options_row').show(); - jQuery('#direction_row').show(); - jQuery('#direction').prop('disabled',false); - jQuery('#type_' + jQuery('#direction').val()).prop('disabled',false); - jQuery('#type_' + jQuery('#direction').val()).show(); - jQuery('#action_row').show(); -<?php - /* Generate lots of .appear() entries for the action row select list - * based on what's been either preconfigured or "defaults" - * This really did have to be done in PHP. - */ - if (isset($pconfig['type'])) { - $dtype = $pconfig['type']; - $ddir = $pconfig['direction']; - } else { - $dtype = "cookie"; - $ddir = "request"; - } - foreach ($actions['direction'][$ddir] as $type => $tv) { - foreach ($actions['direction'][$ddir][$type] as $action => $av ) { - if($dtype == $type) { - echo "jQuery('#{$ddir}_{$type}_{$action}').show();"; - } - } - } -?> - - break; - } - } -} - -function updateDirection(d) { - // Default to request - if (d == "") { - d = "request"; - } - - switch (d) { - case "request": { - jQuery('#type_response').prop('disabled',true); - jQuery('#type_response').hide(); - jQuery('#type_request').prop('disabled',false); - jQuery('#type_request').show(); - break; - } - case "response": { - jQuery('#type_request').prop('disabled',true); - jQuery('#type_request').hide(); - jQuery('#type_response').prop('disabled',false); - jQuery('#type_response').show(); - break; - } - } -} - - -function updateType(t){ - // Default to action_row - // XXX - does this actually make any sense? - if (t == "") { - t = "action_row"; - } - - switch(t) { -<?php - /* OK, so this is sick using php to generate javascript, but it needed to be done */ - foreach ($types as $key => $val) { - echo " case \"{$key}\": {\n"; - $t = $types; - foreach ($t as $k => $v) { - if ($k != $key) { - echo " jQuery('#{$k}').hide();\n"; - } - } - echo " }\n"; - } -?> - } - jQuery('#' + t).show(); -} - - -function updateAction(a) { - // Default to change - if (a == "") { - a = "change"; - } - switch(a) { - case "append": { - jQuery('#input_action_value').show(); - jQuery('#option_action_value').prop('disabled',false); - jQuery('#input_action_key').show(); - jQuery('#option_action_key').prop('disabled',false); - jQuery('#input_action_id').hide(); - jQuery('#option_action_id').prop('disabled',true); - jQuery('#action_action_value').html(" to "); - jQuery('#action_action_id').html(""); - break; - } - case "change": { - jQuery('#input_action_value').show(); - jQuery('#option_action_value').prop('disabled',false); - jQuery('#input_action_key').show(); - jQuery('#option_action_key').prop('disabled',false); - jQuery('#input_action_id').hide(); - jQuery('#option_action_id').prop('disabled',true); - jQuery('#action_action_value').html(" of "); - jQuery('#action_action_id').html(""); - break; - } - case "expect": { - jQuery('#input_action_value').show(); - jQuery('#option_action_value').prop('disabled',false); - jQuery('#input_action_key').show(); - jQuery('#option_action_key').prop('disabled',false); - jQuery('#input_action_id').hide(); - jQuery('#option_action_id').prop('disabled',true); - jQuery('#action_action_value').html(" from "); - jQuery('#action_action_id').html(""); - break; - } - case "filter": { - jQuery('#input_action_value').show(); - jQuery('#option_action_value').prop('disabled',false); - jQuery('#input_action_key').show(); - jQuery('#option_action_key').prop('disabled',false); - jQuery('#input_action_id').hide(); - jQuery('#option_action_id').prop('disabled',true); - jQuery('#action_action_value').html(" from "); - jQuery('#action_action_id').html(""); - break; - } - case "hash": { - jQuery('#input_action_value').hide(); - jQuery('#option_action_value').prop('disabled',true); - jQuery('#input_action_key').show(); - jQuery('#option_action_key').prop('disabled',false); - jQuery('#input_action_id').hide(); - jQuery('#option_action_id').prop('disabled',true); - jQuery('#action_action_value').html(""); - jQuery('#action_action_id').html(""); - break; - } - case "log": { - jQuery('#input_action_value').hide(); - jQuery('#option_action_value').prop('disabled',true); - jQuery('#input_action_key').show(); - jQuery('#option_action_key').prop('disabled',false); - jQuery('#input_action_id').hide(); - jQuery('#option_action_id').prop('disabled',true); - jQuery('#action_action_value').html(""); - jQuery('#action_action_id').html(""); - break; - } - case "mark": { - jQuery('#input_action_value').show(); - jQuery('#option_action_value').prop('disabled',false); - jQuery('#input_action_key').show(); - jQuery('#option_action_key').prop('disabled',false); - jQuery('#input_action_id').show(); - jQuery('#option_action_id').prop('disabled',false); - jQuery('#action_action_value').html(" from "); - jQuery('#action_action_id').html(" with "); - break; - } - } -} - - -function num_options() { - return jQuery('#options_table').children().length - 1; -} - - -jQuery(document).ready(function() { - updateProtocol('<?=htmlspecialchars($pconfig['protocol'])?>'); - updateDirection('<?=htmlspecialchars($pconfig['direction'])?>'); - updateType('<?=htmlspecialchars($pconfig['type'])?>'); - updateAction('<?=htmlspecialchars($pconfig['action'])?>'); -}); - -</script> - -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> - <form action="load_balancer_relay_action_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"><?=gettext("Edit Load Balancer - Relay Action entry"); ?></td> - </tr> - <tr align="left" id="name"> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Name"); ?></td> - <td width="78%" class="vtable" colspan="2"> - <input name="name" type="text" <?if(isset($pconfig['name'])) echo "value=\"{$pconfig['name']}\"";?> size="16" maxlength="16"> - </td> - </tr> - <tr align="left"> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Description"); ?></td> - <td width="78%" class="vtable" colspan="2"> - <input name="descr" type="text" <?if(isset($pconfig['descr'])) echo "value=\"{$pconfig['descr']}\"";?>size="64"> - </td> - </tr> -<!-- Protocol --> - <tr align="left" id="protocol_row"> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol"); ?></td> - <td width="78%" class="vtable" colspan="2"> - <select id="protocol" name="protocol"> -<? - foreach ($actions['protocol'] as $key => $val) { - if(isset($pconfig['protocol']) && $pconfig['protocol'] == $key) { - $selected = " selected"; - } else { - $selected = ""; - } - echo "<option value=\"{$key}\" onclick=\"updateProtocol('{$key}');\"{$selected}>{$val}</option>\n"; - } -?> - </select> - </td> - </tr> - -<!-- Direction --> - <tr align="left" id="direction_row"> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Direction"); ?></td> - <td width="78%" class="vtable" colspan="2"> - <select id="direction" name="direction" style="disabled"> -<? - foreach ($actions['direction'] as $key => $val) { - if(isset($pconfig['direction']) && $pconfig['direction'] == $key) { - $selected = " selected"; - } else { - $selected = ""; - } - echo "<option value=\"{$key}\" onclick=\"updateDirection('{$key}');\"{$selected}>{$key}</option>\n"; - } -?> - </select> - - </td> - </tr> - -<!-- Type --> - <tr align="left" id="type_row"<?= $pconfig['protocol'] == "http" ? "" : " style=\"display:none;\""?>> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Type"); ?></td> - <td width="78%" class="vtable" colspan="2"> -<? - foreach ($actions['direction'] as $dir => $v) { - echo" <select id=\"type_{$dir}\" name=\"type_{$dir}\" style=\"display:none; disabled;\">"; - foreach ($actions['direction'][$dir] as $key => $val) { - if(isset($pconfig['type']) && $pconfig['type'] == $key) { - $selected = " selected"; - } else { - $selected = ""; - } - echo "<option value=\"{$key}\" onclick=\"updateDirection('$key');\"{$selected}>{$key}</option>\n"; - } - } -?> - </select> - </td> - </tr> - -<!-- Action --> - <tr align="left" id="action_row"<?= $pconfig['protocol'] == "http" ? "" : " style=\"display:none;\""?>> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Action"); ?></td> - <td width="78%" class="vtable" colspan="2"> - <select id="action" name="action" style=\"display: none;\"> -<? - foreach ($actions['direction'] as $dir => $dv) { - foreach ($actions['direction'][$dir] as $type => $tv) { - foreach ($actions['direction'][$dir][$type] as $action => $av ) { - if(isset($pconfig['action']) && $pconfig['action'] == $action) { - $selected = " selected"; - } else if ($action == "change" ){ - $selected = " selected"; - } else { - $selected = ""; - } - echo "<option id=\"{$dir}_{$type}_{$action}\" value=\"{$dir}_{$type}_{$action}\" onClick=\"updateAction('$action');\" style=\"display: none;\"{$selected}>{$action}</option>\n"; - } - } - } -?> - </select> -<br /> -<table><tr> -<td><div id="input_action_value"><?=gettext("Value"); ?> <input id="option_action_value" name="option_action_value" type="text" <?if(isset($pconfig['options']['value'])) echo "value=\"{$pconfig['options']['value']}\"";?>size="20"></div></td> -<td><div id="action_action_value"></div></td> -<td><div id="input_action_key"><?=gettext("Key"); ?> <input id="option_action_key" name="option_action_key" type="text" <?if(isset($pconfig['options']['akey'])) echo "value=\"{$pconfig['options']['akey']}\"";?>size="20"></div></td> -<td><div id="action_action_id"></div></td> -<td><div id="input_action_id"><?=gettext("ID"); ?> <input id="option_action_id" name="option_action_id" type="text" <?if(isset($pconfig['options']['id'])) echo "value=\"{$pconfig['options']['id']}\"";?>size="20"></div></td> -</tr></table> - </td> - </tr> - <tr align="left" id="tcp_options_row"<?= $pconfig['protocol'] == "tcp" ? "" : " style=\"display:none;\""?>> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Options"); ?></td> - <td width="78%" class="vtable" colspan="2"> - XXX: <?=gettext("TODO"); ?> - <select id="options" name="options"> -<!-- XXX TODO > -<? - foreach ($types as $key => $val) { - if(isset($pconfig['protocol']) && $pconfig['protocol'] == $key) { - $selected = " selected"; - } else { - $selected = ""; - } - echo "<option value=\"{$key}\" onclick=\"updateType('{$key}');\"{$selected}>{$val}</option>\n"; - } -?> - </select> -< XXX TODO --> - </td> - </tr> - <tr align="left" id="ssl_options_row"<?= $pconfig['protocol'] == "http" ? "" : " style=\"display:none;\""?>> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Options"); ?></td> - <td width="78%" class="vtable" colspan="2"> - XXX: <?=gettext("TODO"); ?> -<!-- XXX TODO > - <select id="options" name="options"> -<? - foreach ($types as $key => $val) { - if(isset($pconfig['protocol']) && $pconfig['protocol'] == $key) { - $selected = " selected"; - } else { - $selected = ""; - } - echo "<option value=\"{$key}\" onclick=\"updateType('{$key}');\"{$selected}>{$val}</option>\n"; - } -?> - </select> -< XXX TODO --> - </td> - </tr> - <tr align="left"> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"> - <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> - <?php if (isset($id) && $a_action[$id] && $_GET['act'] != 'dup'): ?> - <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>"> - <?php endif; ?> - </td> - </tr> - </table> - </form> -<br /> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/usr/local/www/load_balancer_relay_protocol.php b/usr/local/www/load_balancer_relay_protocol.php deleted file mode 100644 index 845b444..0000000 --- a/usr/local/www/load_balancer_relay_protocol.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php -/* $Id$ */ -/* - load_balancer_relay_protocol.php - part of pfSense (https://www.pfsense.org/) - - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.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. -*/ -/* - pfSense_MODULE: routing -*/ - -##|+PRIV -##|*IDENT=page-services-loadbalancer-relay-protocol -##|*NAME=Services: Load Balancer: Relay Protocols page -##|*DESCR=Allow access to the 'Services: Load Balancer: Relay Protocols' page. -##|*MATCH=load_balancer_relay_protocol.php* -##|-PRIV - -require_once("guiconfig.inc"); -require_once("functions.inc"); -require_once("filter.inc"); -require_once("shaper.inc"); - -if (!is_array($config['load_balancer']['lbprotocol'])) { - $config['load_balancer']['lbprotocol'] = array(); -} -$a_protocol = &$config['load_balancer']['lbprotocol']; - -if ($_POST) { - $pconfig = $_POST; - - if ($_POST['apply']) { - $retval = 0; - $retval |= filter_configure(); - $retval |= relayd_configure(); - - $savemsg = get_std_save_message($retval); - clear_subsystem_dirty('loadbalancer'); - } -} - -if ($_GET['act'] == "del") { - if (array_key_exists($_GET['id'], $a_protocol)) { - /* make sure no virtual servers reference this entry */ - if (is_array($config['load_balancer']['virtual_server'])) { - foreach ($config['load_balancer']['virtual_server'] as $vs) { - if ($vs['protocol'] == $a_protocol[$_GET['id']]['name']) { - $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one virtual server."); - break; - } - } - } - - if (!$input_errors) { - unset($a_protocol[$_GET['id']]); - write_config(); - mark_subsystem_dirty('loadbalancer'); - header("Location: load_balancer_relay_protocol.php"); - exit; - } - } -} - -/* Index lbpool array for easy hyperlinking */ -/* for ($i = 0; isset($config['load_balancer']['lbprotocol'][$i]); $i++) { - for ($o = 0; isset($config['load_balancer']['lbprotocol'][$i]['options'][$o]); o++) { - $a_vs[$i]['options'][$o] = " - $a_vs[$i]['poolname'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['poolname']]}\">{$a_vs[$i]['poolname']}</a>"; - if ($a_vs[$i]['sitedown'] != '') { - $a_vs[$i]['sitedown'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['sitedown']]}\">{$a_vs[$i]['sitedown']}</a>"; - } else { - $a_vs[$i]['sitedown'] = 'none'; - } -} -*/ - -$pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Relay Protocol")); -$shortcut_section = "relayd"; - -include("head.inc"); - -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php include("fbegin.inc"); ?> -<form action="load_balancer_relay_protocol.php" method="post"> -<?php if ($input_errors) print_input_errors($input_errors); ?> -<?php if ($savemsg) print_info_box($savemsg); ?> -<?php if (is_subsystem_dirty('loadbalancer')): ?><p> -<?php print_info_box_np(gettext("The load balancer configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br /> -<?php endif; ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td class="tabnavtbl"> - <?php - /* active tabs */ - $tab_array = array(); - $tab_array[] = array(gettext("Monitors"), false, "load_balancer_monitor.php"); - $tab_array[] = array(gettext("Pools"), false, "load_balancer_pool.php"); - $tab_array[] = array(gettext("Virtual Servers"), false, "load_balancer_virtual_server.php"); - display_top_tabs($tab_array); - ?> - </td></tr> - <tr> - <td> - <div id="mainarea"> -<? - $t = new MainTable(); - $t->edit_uri('load_balancer_relay_protocol_edit.php'); - $t->my_uri('load_balancer_relay_protocol.php'); - $t->add_column(gettext('Name'),'name',20); - $t->add_column(gettext('Type'),'type',10); - $t->add_column(gettext('Options'),'options',30); - $t->add_column(gettext('Description'),'descr',30); - $t->add_button('edit'); - $t->add_button('dup'); - $t->add_button('del'); - $t->add_content_array($a_protocol); - $t->display(); -?> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> diff --git a/usr/local/www/load_balancer_relay_protocol_edit.php b/usr/local/www/load_balancer_relay_protocol_edit.php deleted file mode 100644 index c9864c2..0000000 --- a/usr/local/www/load_balancer_relay_protocol_edit.php +++ /dev/null @@ -1,293 +0,0 @@ -<?php -/* $Id$ */ -/* - load_balancer_relay_protocol_edit.php - part of pfSense (https://www.pfsense.org/) - - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.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. -*/ -/* - pfSense_MODULE: routing -*/ - -##|+PRIV -##|*IDENT=page-services-loadbalancer-relay-protocol-edit -##|*NAME=Services: Load Balancer: Relay Protocol: Edit page -##|*DESCR=Allow access to the 'Services: Load Balancer: Relay Protocol: Edit' page. -##|*MATCH=load_balancer_relay_protocol_edit.php* -##|-PRIV - -require("guiconfig.inc"); - -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_relay_protocol.php'); - -if (!is_array($config['load_balancer']['lbprotocol'])) { - $config['load_balancer']['lbprotocol'] = array(); -} -$a_protocol = &$config['load_balancer']['lbprotocol']; - -if (is_numericint($_GET['id'])) - $id = $_GET['id']; -if (isset($_POST['id']) && is_numericint($_POST['id'])) - $id = $_POST['id']; - -if (isset($id) && $a_protocol[$id]) { - $pconfig = $a_protocol[$id]; - $pconfig['type'] = $a_protocol[$id]['type']; - $pconfig['descr'] = $a_protocol[$id]['descr']; - $pconfig['lbaction'] = array(); - $pconfig['options'] = $a_protocol[$id]['options']; -} else { - /* Some sane page defaults */ - $pconfig['type'] = 'http'; -} - -$changedesc = gettext("Load Balancer: Relay Protocol:") . " "; -$changecount = 0; - - - -if ($_POST) { - $changecount++; - - unset($input_errors); - $pconfig = $_POST; - - - /* input validation */ - $reqdfields = explode(" ", "name type descr"); - $reqdfieldsn = array(gettext("Name"),gettext("Type"),gettext("Description")); - - do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); - - /* Ensure that our monitor names are unique */ - for ($i=0; isset($config['load_balancer']['lbprotocol'][$i]); $i++) - if (($_POST['name'] == $config['load_balancer']['lbprotocol'][$i]['name']) && ($i != $id)) - $input_errors[] = gettext("This protocol name has already been used. Protocol names must be unique."); - - if (strpos($_POST['name'], " ") !== false) - $input_errors[] = gettext("You cannot use spaces in the 'name' field."); - - switch($_POST['type']) { - case 'tcp': - case 'http': - case 'https': - case 'dns': { - break; - } - } - - if (!$input_errors) { - $protent = array(); - if(isset($id) && $a_protocol[$id]) - $protent = $a_protocol[$id]; - if($protent['name'] != "") - $changedesc .= " " . sprintf(gettext("modified '%s' load balancing protocol:"), $protent['name']); - - update_if_changed(gettext("name"), $protent['name'], $pconfig['name']); - update_if_changed(gettext("type"), $protent['type'], $pconfig['type']); - update_if_changed(gettext("description"), $protent['descr'], $pconfig['descr']); - update_if_changed(gettext("type"), $protent['type'], $pconfig['type']); - update_if_changed(gettext("action"), $protent['lbaction'], $pconfig['lbaction']); - - if (isset($id) && $a_protocol[$id]) { - /* modify all virtual servers with this name */ -/* - for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) { - if ($config['load_balancer']['virtual_server'][$i]['protocol'] == $a_protocol[$id]['name']) - $config['load_balancer']['virtual_server'][$i]['protocol'] = $protent['name']; - } -*/ - $a_protocol[$id] = $protent; - } else { - $a_protocol[] = $protent; - } - - if ($changecount > 0) { - /* Mark config dirty */ - mark_subsystem_dirty('loadbalancer'); - write_config($changedesc); - } - - header("Location: load_balancer_relay_protocol.php"); - exit; - } -} - -$pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Relay Protocol"),gettext("Edit")); -$shortcut_section = "relayd"; - -include("head.inc"); - -$types = array("http" => gettext("HTTP"), "tcp" => gettext("TCP"), "dns" => gettext("DNS")); -?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<script type="text/javascript"> -function updateType(t){ - switch(t) { -<?php - /* OK, so this is sick using php to generate javascript, but it needed to be done */ - foreach ($types as $key => $val) { - echo " case \"{$key}\": {\n"; - $t = $types; - foreach ($t as $k => $v) { - if ($k != $key) { - echo " jQuery('#{$k}').hide();\n"; - } - } - echo " }\n"; - } -?> - } - jQuery('#' + t).show(); -} - -function num_options() { - return jQuery('#options_table').children().length - 1; -} - -/* -jQuery(document).ready(function(){ - $$('.action').each(function(action) { - new Draggable(action, {revert: true, ghosting: true}); - }); - Droppables.add('actions', { - accept: 'action', onDrop: function(action) { - var new_action = new Element('li'); - new Draggable(new_action, {revert: true}); - $('action_list').appendChild(new_action); - } - }); -}); -*/ -</script> - -<?php include("fbegin.inc"); ?> -<?php if ($input_errors) print_input_errors($input_errors); ?> - <form action="load_balancer_relay_protocol_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"><?=gettext("Edit Load Balancer - Relay Protocol entry"); ?></td> - </tr> - <tr align="left"> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Name"); ?></td> - <td width="78%" class="vtable" colspan="2"> - <input name="name" type="text" <?if(isset($pconfig['name'])) echo "value=\"{$pconfig['name']}\"";?> size="16" maxlength="16"> - </td> - </tr> - <tr align="left"> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Type"); ?></td> - <td width="78%" class="vtable" colspan="2"> - <select id="type" name="type"> -<? - foreach ($types as $key => $val) { - if(isset($pconfig['type']) && $pconfig['type'] == $key) { - $selected = " selected"; - } else { - $selected = ""; - } - echo "<option value=\"{$key}\" onclick=\"updateType('{$key}');\"{$selected}>{$val}</option>\n"; - } -?> - </select> - </td> - </tr> - <tr align="left"> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Description"); ?></td> - <td width="78%" class="vtable" colspan="2"> - <input name="descr" type="text" <?if(isset($pconfig['descr'])) echo "value=\"{$pconfig['descr']}\"";?>size="64"> - </td> - </tr> - <tr> - <td> </td> - </tr> - <tr> - <td colspan="2" valign="top" class="listtopic"><?=gettext("Add / remove available actions"); ?></td> - </tr> - <tr align="left" id="actions"> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Actions"); ?></td> - <td width="78%" class="vtable" colspan="2"> - <table> - <tbody> - <tr> - <td> - <center> - <b><?=gettext("Available Actions"); ?></b> - <br /> - <select id="available_action" name="available_action[]" multiple="true" size="5"> -<?php -if (is_array($config['load_balancer']['lbaction'])) { - foreach($config['load_balancer']['lbaction'] as $actent) { - if($actent != '') echo " <option value=\"{$actent['name']}\">{$actent['name']}</option>\n"; - } -} -echo "</select>"; -?> - <br /> - </td> - <td valign="middle"> - <center> - <input class="formbtn" type="button" name="copyToEnabled" value="<?=gettext("Add"); ?>" onclick="copyOption($('available_action'), $('lbaction'));" /><br /> - <input class="formbtn" type="button" name="removeFromEnabled" value="<?=gettext("Remove"); ?>" onclick="deleteOption($('lbaction'));" /> - </center> - </td> - - <td> - <center> - <b><?=gettext("Enabled Actions"); ?></b> - <br /> - <select id="lbaction" name="lbaction[]" multiple="true" size="5"> -<?php -if (is_array($pconfig['lbaction'])) { - foreach($pconfig['lbaction'] as $actent) { - echo " <option value=\"{$actent}\">{$actent}</option>\n"; - } -} -echo "</select>"; -?> - <br /> - </td> - </tr> - </tbody> - </table> - </td> - </tr> - <tr align="left"> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onClick="AllOptions($('lbaction'), true); AllOptions($('available_action'), false);"> - <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> - <?php if (isset($id) && $a_protocol[$id] && $_GET['act'] != 'dup'): ?> - <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>"> - <?php endif; ?> - </td> - </tr> - </table> - </form> -<br /> -<?php include("fend.inc"); ?> -</body> -</html> |