2012-05-08 17:43:45 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2012-10-15 Dario Rodriguez <dario.rodriguez@artica.es>
* operation/extensions.php,
godmode/extensions.php,
include/functions_extensions.php,
extensions/insert_data.php,
extensions/snmp_explorer.php,
extensions/system_info.php,
extensions/net_tools.php,
extensions/extension_uploader.php,
extensions/pandora_logs.php,
extensions/agents_modules.php,
extensions/update_manager.php,
extensions/ssh_gateway.php,
extensions/dbmanager.php,
extensions/vnc_view.php,
extensions/resource_registration.php,
extensions/users_connected.php,
extensions/resource_exportation.php,
extensions/module_groups.php,
extensions/plugin_registration.php: Modified extension to
show versions.
MERGED FROM 4.0.2
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7074 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-15 12:23:31 +02:00
|
|
|
extensions_add_opemode_tab_agent ('ssh_gateway','SSH Gateway','extensions/ssh_gateway/secure_console.png',"ssh_gateway", "v1r1");
|
2012-05-08 17:43:45 +02:00
|
|
|
|
|
|
|
function ssh_gateway () {
|
2012-07-10 11:21:19 +02:00
|
|
|
|
2012-05-08 17:43:45 +02:00
|
|
|
$SERVER_ADDR = $_SERVER['SERVER_ADDR'];
|
2012-07-10 11:21:19 +02:00
|
|
|
|
2012-05-08 17:43:45 +02:00
|
|
|
$HOST = get_parameter ("host", "");
|
|
|
|
$USER = get_parameter ("user", "");
|
2012-07-10 11:21:19 +02:00
|
|
|
|
2012-05-08 17:43:45 +02:00
|
|
|
// TODO: Put aditional filtering for ";" and "&" characters in user & host for security
|
|
|
|
// because these params are passed to server exec() call :)
|
2012-07-10 11:21:19 +02:00
|
|
|
|
2012-05-08 17:43:45 +02:00
|
|
|
$COMMIT = get_parameter ("commit", 0);
|
|
|
|
$MODE = get_parameter ("mode", "ssh");
|
2012-07-10 11:21:19 +02:00
|
|
|
|
2012-05-08 17:43:45 +02:00
|
|
|
if ($MODE == "telnet")
|
|
|
|
$USER = "<auto>";
|
2012-07-10 11:21:19 +02:00
|
|
|
|
2012-05-08 17:43:45 +02:00
|
|
|
$id_agente = get_parameter ("id_agente");
|
2012-07-10 11:21:19 +02:00
|
|
|
$ip = db_get_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
|
|
|
|
|
|
|
|
if ($HOST == "")
|
2012-05-08 17:43:45 +02:00
|
|
|
$HOST = $ip;
|
2012-07-10 11:21:19 +02:00
|
|
|
|
|
|
|
if (($HOST == "") OR ($USER == "")) {
|
|
|
|
if ($COMMIT == 1) {
|
2012-05-08 17:43:45 +02:00
|
|
|
echo "<h3 class=error>".__("You need to specify a user and a host address")."</h3>";
|
|
|
|
}
|
2012-07-10 11:21:19 +02:00
|
|
|
|
2012-05-08 17:43:45 +02:00
|
|
|
echo "<form method=post>";
|
|
|
|
echo "<table class=databox cellspacing=4 cellpadding=4>";
|
|
|
|
echo "<td>".__("Host address")."<td><input type=text size=25 value='$HOST' name=host>";
|
|
|
|
echo "<tr>";
|
|
|
|
echo "<td>".__("User")."<td><input type=text size=25 value='$USER' name=user>";
|
|
|
|
echo "<tr><td>";
|
|
|
|
echo __("Connect mode")."<td><select name=mode>";
|
2012-07-10 11:21:19 +02:00
|
|
|
if ($MODE == "telnet") {
|
2012-05-08 17:43:45 +02:00
|
|
|
echo "<option>telnet";
|
|
|
|
echo "<option>ssh";
|
2012-07-10 11:21:19 +02:00
|
|
|
}
|
|
|
|
else {
|
2012-05-08 17:43:45 +02:00
|
|
|
echo "<option>ssh";
|
|
|
|
echo "<option>telnet";
|
2012-07-10 11:21:19 +02:00
|
|
|
}
|
2012-05-08 17:43:45 +02:00
|
|
|
echo "</select>";
|
2012-07-10 11:21:19 +02:00
|
|
|
|
2012-05-08 17:43:45 +02:00
|
|
|
echo " <input type=submit name=connect class='sub upd' value=".__("Connect").">";
|
|
|
|
echo "<td><input type=hidden name=commit value=1>";
|
|
|
|
echo "</form></table>";
|
|
|
|
}
|
2012-07-10 11:21:19 +02:00
|
|
|
|
2012-05-08 17:43:45 +02:00
|
|
|
else {
|
|
|
|
if ($MODE == "ssh")
|
|
|
|
echo "<iframe style='border: 0px' src='http://".$SERVER_ADDR.":8022/anyterm.html?param=$USER@$HOST' width='100%' height=550>";
|
|
|
|
else
|
|
|
|
echo "<iframe style='border: 0px' src='http://".$SERVER_ADDR.":8023/anyterm.html?param=$HOST' width='100%' height=550>";
|
2012-07-10 11:21:19 +02:00
|
|
|
|
|
|
|
echo "</iframe>";
|
2012-05-08 17:43:45 +02:00
|
|
|
}
|
|
|
|
}
|
2012-07-10 11:21:19 +02:00
|
|
|
?>
|