Skip to content

Guacamole Error: guacd was inactive for too long #44

@vnydev

Description

@vnydev

Guacamole-lite and Guacamole-common-js Tunnel connection issue.

I am also facing the same issue ( Closing connection with error: Error: guacd was inactive for too long) . while connecting through WebSocket tunnel on the client side of application using Guacamole-common-js. I am exposing the WS endpoint using Guacamole -lite from Node-JS backend and trying to established the connection between client and WS so i can show the connected guacamole in side the web-application into the browsers.

Basically our requirement is to render the desktop applications of the user on the browser for that we are trying Guacamole RDP/SSH/VNC connection and want to display the respective connected remote server on the browsers to access desktop application.

Please help us its urgent.

Error => Logs

[GcLog] Starting guacamole-lite websocket server
ws guacamole runing on 4822
[GcLog] [2021-12-15 12:37:20] [Connection 1] Client connection open
[GcLog] [2021-12-15 12:37:20] [Connection 1] Opening guacd connection
[GcLog] [2021-12-15 12:37:20] [Connection 1] guacd connection open
[GcLog] [2021-12-15 12:37:20] [Connection 1] Selecting connection type: rdp
[GcLog] [2021-12-15 12:37:20] [Connection 1] Sending opCode: 6.select,3.rdp;
[GcError] [2021-12-15 12:37:30] [Connection 1] Closing connection with error: Error: guacd was inactive for too long
at GuacdClient.checkActivity (C:\Users\vsha8727\CNCX\coding\guacamole\bkgc\node_modules\guacamole-lite\lib\GuacdClient.js:35:41)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
[GcLog] [2021-12-15 12:37:30] [Connection 1] Closing guacd connection
[GcLog] [2021-12-15 12:37:30] [Connection 1] Client connection closed

Client Side Code ->
http://guacamole.incubator.apache.org/doc/gug/guacamole-common-js.html

import React from 'react';
import Guacamole from 'guacamole-common-js';
import { encrypt } from './service';

const connection = {
"connection": {
"type": "rdp",
"settings": {
port: use your port, // port of guacd
host: 'use your host',
username: 'use your username',
password: 'use your password',
}
}
}
const GuacamoleApp: React.FC = () => {
const openGc = async () => {
try {
const token = await encrypt(connection);
console.log("token", token)
const wsurl = ws://localhost:4822/guaclite?token=${token}&width=600&height:600px;
console.log("wsurl", wsurl)
const gc = await new Guacamole.Client(new Guacamole.WebSocketTunnel(wsurl));
console.log("gc", gc)
const display = document.getElementById('gcdisplay');
console.log("element", gc.getDisplay().getElement())
if (display) {
display?.appendChild(gc.getDisplay().getElement());
}

        gc.connect('');
        
    } catch (error: any) {
        console.log("GC Error", error);
    }
}
return <div style={{width: '100%'}}>
    <h1>Guacamole Connect RDP/SSH/VNC</h1>
    <button onClick={openGc}>Open Guacamole</button>
    
    <div id='gcdisplay' style={{minWidth: '800px', minHeight:'600px', backgroundColor:'grey'}}></div>
</div>

}
export default GuacamoleApp;

Backend Side Code ->

var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
const GuacamoleLite = require('guacamole-lite');
var app = express();
const http = require('http').Server(app);

const guacdOptions = {
port: 'use your port', // port of guacd
host: 'use your host',
username: 'use your username',
password: 'use your password',
};

const clientOptions = {
crypt: {
cypher: 'AES-256-CBC',
key: 'MySuperSecretKeyForParamsToken12'
},
connectionDefaultSetting: {
rdp: {
"security": "NLA (Network Level Authentication)",
"ignore-cert": true,
}
},
log: {
level: 'VERBOSE',
stdLog: (...args) => {
console.log('[GcLog]', ...args)
},
errorLog: (...args) => {
console.error('[GcError]', ...args)
}
}
};

const guacServer = new GuacamoleLite({server: http, path: '/guaclite'}, guacdOptions, clientOptions);

var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
app.use('/users', usersRouter);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});

// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};

// render the error page
res.status(err.status || 500);
res.render('error');
});

http.listen(4822, ()=> console.log('ws guacamole runing on 4822'));
module.exports = app;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions