fix(rdp): 服务端 guacd 握手替代透明 TCP 桥接

guacamole-common-js 不会向 guacd 发送 select/connect;改为 Nexus 用 rdp_hosts 凭据完成握手后再桥接 WebSocket,消除 protocol violation。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nexus Agent
2026-06-10 21:33:01 +08:00
parent 6f998048b6
commit 960598f504
6 changed files with 394 additions and 10 deletions
@@ -0,0 +1,30 @@
# 2026-06-10 — RDP guacd 握手修复
## 摘要
修复浏览器 RDP 连接时 guacd 报 `Guacamole protocol violation`:由透明 TCP 桥接改为服务端完成 guacd 握手后再转发 WebSocket。
## 动机
`guacamole-common-js``WebSocketTunnel` 假定服务端(官方 Java servlet)向 guacd 发送 `select`/`connect` 等指令;Nexus 原先将浏览器 WS 字节原样转发到 guacd,导致协议错误。
## 涉及文件
- `server/infrastructure/guacamole/protocol.py` — 指令编解码、guacd RDP 握手
- `server/infrastructure/guacamole/ws_tunnel.py` — 握手后 WS↔guacd 桥接,过滤内部 ping
- `server/api/rdp.py` — 使用 DB 中 `rdp_hosts` 凭据握手,JWT 仍走路径
- `tests/test_guacamole_protocol.py` — 协议单测
## 迁移 / 重启
- 无 DB 迁移
- 需重启 API 容器(`deploy-production.sh`
## 验证
```bash
bash scripts/local_verify.sh
python -m pytest tests/test_guacamole_protocol.py -q
```
生产:3389 页连接 → guacd 日志无 protocol violation → 画布显示桌面。