Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guacamole Error: guacd was inactive for too long #44

Open
vnydev opened this issue Dec 15, 2021 · 2 comments
Open

Guacamole Error: guacd was inactive for too long #44

vnydev opened this issue Dec 15, 2021 · 2 comments

Comments

@vnydev
Copy link

vnydev commented Dec 15, 2021

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;

@R-F-R
Copy link

R-F-R commented Feb 25, 2022

You may want to check the port of your websocket connection. Normally, 4822 is the port the guacd daemon listens on, not the port on which guacamole-lite accepts the websocket connection, I believe.

@keitetran
Copy link

SAme eror

guacd[1]: INFO: Connection "$b555b827-5c8e-42d2-8318-6c0fe337874c" removed.
guacd[1]: DEBUG:        Unable to request termination of client process: No such process
guacd[1]: DEBUG:        All child processes for connection "$b555b827-5c8e-42d2-8318-6c0fe337874c" have been terminated.
guacd[1]: DEBUG:        Guacamole connection closed during handshake
guacd[1]: DEBUG:        Error reading "select": End of stream reached while reading instruction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants