feat: record relay proxy_id and port in console audit events

This commit is contained in:
2026-07-29 13:10:58 +01:00
parent c0bec3737b
commit 05f10ed3c9
+5 -1
View File
@@ -2,6 +2,7 @@ package api
import (
"errors"
"fmt"
"net"
"net/http"
"os"
@@ -151,6 +152,9 @@ func consoleTunnel(c *gin.Context) {
}
defer relay.Close()
services.LogEvent(instanceID, "console.proxy_opened", actorFromCtx(c), srv.ServerID, "",
fmt.Sprintf("console relay opened (proxy_id=%s, port=%d)", relay.ProxyID, relay.Port))
gp, err := services.BuildGuacParams(sess.Protocol, sess.SSHUsername, privKey, passphrase,
rdpUser, rdpPass, relay.Host, relay.Port)
if err != nil {
@@ -192,7 +196,7 @@ func consoleTunnel(c *gin.Context) {
wsServer.OnDisconnect = func(id string, r *http.Request, t guac.Tunnel) {
if reason := relay.Reason(); reason != "" {
services.LogEvent(instanceID, "console.proxy_failed", actorFromCtx(c), srv.ServerID, "",
"console relay failed: "+reason)
fmt.Sprintf("console relay failed: %s (proxy_id=%s, port=%d)", reason, relay.ProxyID, relay.Port))
}
relay.Close()
_ = services.EndConsoleSession(instanceID, sessionID)