debug(rdp): enable guacd debug logging + log all guacd responses

guacd was dying silently with no error instruction sent back.
Enable -L debug -f for verbose FreeRDP diagnostics and log
first 5 guacd→browser instructions plus connection parameters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell 2026-03-14 05:53:13 -04:00
parent 80463235b0
commit c062cd502d
2 changed files with 7 additions and 4 deletions

View File

@ -70,7 +70,7 @@ export class RdpGateway {
: null; : null;
this.logger.log( this.logger.log(
`Opening RDP tunnel: ${host.hostname}:${host.port} for host "${host.name}"`, `Opening RDP tunnel: ${host.hostname}:${host.port} for host "${host.name}" (user: ${cred?.username || 'none'}, hasPwd: ${!!cred?.password}, domain: ${cred?.domain || 'none'})`,
); );
const socket = await this.guacamole.connect({ const socket = await this.guacamole.connect({
@ -90,11 +90,13 @@ export class RdpGateway {
this.clientSockets.set(client, socket); this.clientSockets.set(client, socket);
// Pipe guacd → browser: wrap raw Guacamole instruction bytes in JSON envelope // Pipe guacd → browser: wrap raw Guacamole instruction bytes in JSON envelope
let guacMsgCount = 0;
socket.on('data', (data: Buffer) => { socket.on('data', (data: Buffer) => {
const instruction = data.toString('utf-8'); const instruction = data.toString('utf-8');
// Log first few instructions or errors for diagnostics guacMsgCount++;
if (instruction.includes('error') || instruction.includes('ready') || instruction.includes('nop')) { // Log first 5 instructions and any errors
this.logger.log(`[guacd→browser] ${instruction.substring(0, 200)}`); if (guacMsgCount <= 5 || instruction.includes('error')) {
this.logger.log(`[guacd→browser #${guacMsgCount}] ${instruction.substring(0, 300)}`);
} }
if (client.readyState === 1 /* WebSocket.OPEN */) { if (client.readyState === 1 /* WebSocket.OPEN */) {
client.send(JSON.stringify({ type: 'guac', instruction })); client.send(JSON.stringify({ type: 'guac', instruction }));

View File

@ -20,6 +20,7 @@ services:
guacd: guacd:
image: guacamole/guacd image: guacamole/guacd
network_mode: host network_mode: host
command: ["/usr/local/sbin/guacd", "-b", "0.0.0.0", "-L", "debug", "-f"]
restart: always restart: always
postgres: postgres: