LibreNMS gateone integration

I’ve run into a peculiar problem with the LibreNMS and gateone integration. And I guess it’s not strictly a problem of LibreNMS. I’ve put the $config[‘gateone’][‘server’] = ‘https://x.x.x.x:8080’; variable in the config. If it makes any difference I am running the LibreNMS and the gateone on the same address, but different ports and LibreNMS has its own SSL certificates and gateone is in a docker container with its own certificates as well.
Whenever I start the connection from withing LibreNMS web interface : a new tab/window opens with the address : https://x.x.x.x:8080/?ssh=ssh://x.x.x.x&location=x.x.x.x and the ssh process doesn’t start, gateone seems to be stuck at this point. If I check the gateone logs I get this :

I 200616 12:14:52 web:2106] 200 GET /?ssh=ssh://x.x.x.x&location=x.x.x.x () 1.80ms
[I 200616 12:14:52 web:2106] 200 GET /static/gateone.css (y.y.y.y) 8.76ms
[W 200616 12:14:52 iostream:1451] SSL Error on 13 (‘y.y.y.y’, 2204): [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:590)
[I 200616 12:14:52 web:2106] 200 GET /static/gateone.js (y.y.y.y) 16.94ms
[I 200616 12:14:52 web:2106] 200 GET /auth?check=True (y.y.y.y) 0.68ms
[I 200616 12:15:23 server:1796] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} WebSocket Latency: 4ms
[I 200616 12:16:28 server:1796] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} WebSocket Latency: 2ms

But if I just connect to the https://x.x.x.x:8080/ where gateone is hosted everything works fine and I can connect to hosts without a problem. And the logs look like that :

[I 200616 12:18:05 server:1632] WebSocket opened (ANONYMOUS y.y.y.y) via origin x.x.x.x:8080.
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “upn”: “ANONYMOUS”} Sync check: gateone_utils_extra.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “upn”: “ANONYMOUS”} Sync check: gateone_visual_extra.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “upn”: “ANONYMOUS”} Sync check: gateone_input.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “upn”: “ANONYMOUS”} Sync check: gateone_misc.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “upn”: “ANONYMOUS”} Sync check: doT.js
[I 200616 12:18:05 server:1796] {“ip_address”: “y.y.y.y”, “upn”: “ANONYMOUS”} WebSocket Latency: 3ms
[I 200616 12:18:05 server:2584] {“ip_address”: “y.y.y.y”, “upn”: “ANONYMOUS”} Sync Theme: black
[I 200616 12:18:05 server:2087] {“ip_address”: “y.y.y.y”, “upn”: “ANONYMOUS”} Proxy in use: Client URL differs from server.
[I 200616 12:18:05 server:2226] User ANONYMOUS authenticated successfully via origin x.x.x.x:8080 (location default).
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: terminal.css
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: terminal.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: terminal_input.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: logging.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: 1hmac_sha1.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: 1smoothie.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: example.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: convenience.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: bookmarks.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: playback.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: ssh.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: 256_colors.css
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: printing.css
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: ssh.css
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: logging.css
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: bookmarks.css
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: help.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: codemirror.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: editor.js
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: help.css
[I 200616 12:18:05 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: codemirror.css
[I 200616 12:18:06 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: font.css
[I 200616 12:18:06 server:3002] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sync check: gnome-terminal.css
[I 200616 12:18:06 server:2800] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Sending: font.css
[I 200616 12:18:09 server:1854] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} Client Logging: 2020-06-16 14:18:07 INFO PONG: Gate One server round-trip latency: -994ms
[I 200616 12:18:36 async:514] Shutting down the MultiprocessRunner executor.
[I 200616 12:18:38 server:1796] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} WebSocket Latency: 2ms
[I 200616 12:18:43 server:1765] {“ip_address”: “y.y.y.y”, “location”: “default”, “upn”: “ANONYMOUS”} WebSocket closed (ANONYMOUS y.y.y.y).

Has anybody ran into a similar issue and how was it resolved ? Thanks!

Edit: I’ve noticed that if I remove the location argument from the call https://x.x.x.x:8080/?ssh=ssh://x.x.x.x&location=x.x.x.x it works. No idea why. But it does.

Great in the meantime is there a way for me to edit the source and just remove the location altogether? And if yes which file should I edit ? Thanks.

1 Like

Good Day All - I have recently installed/configured LibreNMS and love the product. After much searching, i found GATEONE to integrate the SSH function from within LibreNMS - but it “almost” works. It appends a “&location=ipaddressgoeshere

Example: https://192.168.1.20/?ssh=ssh://192.168.1.11&location=192.168.1.11

Is there a way to remove the “&location=ip”?

Any help would be greatly appreciated! :slight_smile:

Thank you!

There is different forks of gateone that fixes different problem with it and/or Librenms.

Like:

https://github.com/ntaken/GateOne/tree/dev

or

https://github.com/xykonur/GateOne

Perhaps try out a docker container.

you need to edit it in two files

opt/librenms/app/Http/Controllers/Table/DeviceController.php

$actions .= '<div class="col-xs-1"><a href="' . $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>';
to
$actions .= '<div class="col-xs-1"><a href="' . $server . '?ssh=ssh://' . $device->hostname'" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device->hostname . '"></i></a></div>';

opt/librenms/app/Http/Controllers//DeviceController.php

Config::get('gateone.server') . '?ssh=ssh://' . (Config::get('gateone.use_librenms_user') ? Auth::user()->username . '@' : '') . $device['hostname'] . '&location=' . $device['hostname']

to

Config::get('gateone.server') . '?ssh=ssh://' . (Config::get('gateone.use_librenms_user') ? Auth::user()->username . '@' : '') . $device['hostname']

when ill have some time i can add new config to config.php something like $config[‘gateone’][‘no_location’] = true;

You should never delete “location” for gateone. In case you’re using more then 1 device for remote connect though ssh, all your sessions will become in ‘default’ location for gateone.
So 1st session will open up normally, 2nd session will show the same device that was in 1st session even if IP address in url will be different.
You can just make simple trick - don’t remove “location” in those 2 files @skippybossx defined. Instead of this just add hex encoding for this parametr (base64 will not work) like this

‘&location=’ . bin2hex($device->hostname)

That will do the trick and all your device will be opened in different gateone “locations”

OR

You can check this commit ( I was not lucky to patch gateone.js )