mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Added gateone link SSH support (#8189)
* adding gateone link * Added gateone support, now checks config.php for settings * adding gateone link * Added gateone support, now checks config.php for settings * fixed an incorrect url * fixed syntax errors * added new option to config.php, $config[gateone][use_librenms_user] is a boolean that inserts the logged in Librenms user to the SSH link if set to true * removed code duplication * removed hostbox-menu.inc.php
This commit is contained in:
committed by
Neil Lathwood
parent
de56dccc8a
commit
2f6f99a330
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
|
||||
*
|
||||
* 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, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
echo '<td>';
|
||||
if (device_permitted($device['device_id'])) {
|
||||
echo '<div class="row">
|
||||
<div class="col-xs-1">';
|
||||
echo '<a href="'.generate_device_url($device).'"> <i class="fa fa-server fa-lg icon-theme" title="View device" aria-hidden="true"></i></a> ';
|
||||
echo '</div>
|
||||
<div class="col-xs-1">';
|
||||
echo '<a href="'.generate_device_url($device, array('tab' => 'alerts')).'"> <i class="fa fa-exclamation-circle fa-lg icon-theme" title="View alerts" aria-hidden="true"></i></a> ';
|
||||
echo '</div>';
|
||||
if ($_SESSION['userlevel'] >= '7') {
|
||||
echo '<div class="col-xs-1">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'edit')).'"> <i class="fa fa-pencil fa-lg icon-theme" title="Edit ports" aria-hidden="true"></i></a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-1">
|
||||
<a href="telnet://'.$device['hostname'].'"><i class="fa fa-terminal fa-lg icon-theme" title="Telnet to ' . $device['hostname'] . '"></a>
|
||||
</div>
|
||||
<div class="col-xs-1">
|
||||
<a href="ssh://'.$device['hostname'].'"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device['hostname'] . '"></a>
|
||||
</div>
|
||||
<div class="col-xs-1">
|
||||
<a href="https://' . $device['hostname'] . '" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" title="Launch browser https://' . $device['hostname'] . '"></i></a>
|
||||
</div>
|
||||
</div>';
|
||||
}//end if
|
||||
|
||||
echo '</td>';
|
||||
@@ -177,14 +177,26 @@ foreach (dbFetchRows($sql, $param) as $device) {
|
||||
if ($subformat == 'detail') {
|
||||
$actions .= '</div><div class="row">';
|
||||
}
|
||||
|
||||
$actions .= '
|
||||
<div class="col-xs-1"><a href="telnet://' . $device['hostname'] . '"><i class="fa fa-terminal fa-lg icon-theme" title="Telnet to ' . $device['hostname'] . '"></i></a></div>
|
||||
<div class="col-xs-1"><a href="ssh://' . $device['hostname'] . '"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device['hostname'] . '"></i></a></div>
|
||||
<div class="col-xs-1"><a href="https://' . $device['hostname'] . '" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" title="Launch browser https://' . $device['hostname'] . '"></i></a></div>
|
||||
|
||||
|
||||
$actions .= '
|
||||
<div class="col-xs-1"><a href="telnet://' . $device['hostname'] . '"><i class="fa fa-terminal fa-lg icon-theme" title="Telnet to ' . $device['hostname'] . '"></i></a></div>
|
||||
';
|
||||
if (isset($config['gateone']['server'])) {
|
||||
if ($config['gateone']['use_librenms_user'] == true) {
|
||||
$actions .= '<div class="col-xs-1"><a href="' . $config['gateone']['server'] . '?ssh=ssh://' . $_SESSION['username'] . '@' . $device['hostname'] . '&location=' . $device['hostname'] .'" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device['hostname'] . '"></i></a></div>';
|
||||
} else {
|
||||
$actions .= '<div class="col-xs-1"><a href="' . $config['gateone']['server'] . '?ssh=ssh://' . $device['hostname'] . '&location=' . $device['hostname'] .'" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device['hostname'] . '"></i></a></div>';
|
||||
}
|
||||
} else {
|
||||
$actions .= '<div class="col-xs-1"><a href="ssh://' . $device['hostname'] . '"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device['hostname'] . '"></i></a></div>
|
||||
';
|
||||
}
|
||||
$actions .= '<div class="col-xs-1"><a href="https://' . $device['hostname'] . '" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" title="Launch browser https://' . $device['hostname'] . '"></i></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
';
|
||||
|
||||
$hostname = generate_device_link($device);
|
||||
|
||||
if (extension_loaded('mbstring')) {
|
||||
|
||||
@@ -448,14 +448,23 @@ if (device_permitted($vars['device']) || $permitted_by_port) {
|
||||
</li>';
|
||||
}
|
||||
|
||||
|
||||
echo '<div class="dropdown pull-right">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"><i class="fa fa-cog fa-lg icon-theme" aria-hidden="true"></i>
|
||||
<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="https://'.$device['hostname'].'" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" aria-hidden="true"></i> Web</a></li>
|
||||
<li><a href="ssh://'.$device['hostname'].'" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" aria-hidden="true"></i> SSH</a></li>
|
||||
<li><a href="telnet://'.$device['hostname'].'" target="_blank" rel="noopener"><i class="fa fa-terminal fa-lg icon-theme" aria-hidden="true"></i> Telnet</a></li>';
|
||||
echo '<div class="dropdown pull-right">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"><i class="fa fa-cog fa-lg icon-theme" aria-hidden="true"></i>
|
||||
<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="https://'.$device['hostname'].'" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" aria-hidden="true"></i> Web</a></li>';
|
||||
if (isset($config['gateone']['server'])) {
|
||||
if ($config['gateone']['use_librenms_user'] == true) {
|
||||
echo '<li><a href="' . $config['gateone']['server'] . '?ssh=ssh://' . $_SESSION['username'] . '@' . $device['hostname'] . '&location=' . $device['hostname'] .'" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" aria-hidden="true"></i> SSH</a></li>';
|
||||
} else {
|
||||
echo '<li><a href="' . $config['gateone']['server'] . '?ssh=ssh://' . $device['hostname'] . '&location=' . $device['hostname'] .'" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" aria-hidden="true"></i> SSH</a></li>';
|
||||
}
|
||||
} else {
|
||||
echo '<li><a href="ssh://'.$device['hostname'].'" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" aria-hidden="true"></i> SSH</a></li>
|
||||
';
|
||||
}
|
||||
echo '<li><a href="telnet://'.$device['hostname'].'" target="_blank" rel="noopener"><i class="fa fa-terminal fa-lg icon-theme" aria-hidden="true"></i> Telnet</a></li>';
|
||||
|
||||
if (is_admin()) {
|
||||
echo '<li>
|
||||
<a href="'.generate_device_url($device, array('tab' => 'edit')).'">
|
||||
|
||||
Reference in New Issue
Block a user