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;
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({
@ -90,11 +90,13 @@ export class RdpGateway {
this.clientSockets.set(client, socket);
// Pipe guacd → browser: wrap raw Guacamole instruction bytes in JSON envelope
let guacMsgCount = 0;
socket.on('data', (data: Buffer) => {
const instruction = data.toString('utf-8');
// Log first few instructions or errors for diagnostics
if (instruction.includes('error') || instruction.includes('ready') || instruction.includes('nop')) {
this.logger.log(`[guacd→browser] ${instruction.substring(0, 200)}`);
guacMsgCount++;
// Log first 5 instructions and any errors
if (guacMsgCount <= 5 || instruction.includes('error')) {
this.logger.log(`[guacd→browser #${guacMsgCount}] ${instruction.substring(0, 300)}`);
}
if (client.readyState === 1 /* WebSocket.OPEN */) {
client.send(JSON.stringify({ type: 'guac', instruction }));

View File

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