From 2792186c0cc8f07985724f7aad9ae5211d61a33e Mon Sep 17 00:00:00 2001 From: Zac Bergquist Date: Thu, 5 Sep 2024 16:37:15 -0600 Subject: [PATCH] web: add desktop session ID to audit log page The summary of desktop session events did not include the session ID, which made it hard to search for events related to a particular session. Include the session ID in the start/end events. --- .../teleport/src/services/audit/makeEvent.ts | 14 +++++++------- web/packages/teleport/src/services/audit/types.ts | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/web/packages/teleport/src/services/audit/makeEvent.ts b/web/packages/teleport/src/services/audit/makeEvent.ts index 06c513aa5476f..a66864f0a200f 100644 --- a/web/packages/teleport/src/services/audit/makeEvent.ts +++ b/web/packages/teleport/src/services/audit/makeEvent.ts @@ -1145,10 +1145,10 @@ export const formatters: Formatters = { [eventCodes.DESKTOP_SESSION_STARTED]: { type: 'windows.desktop.session.start', desc: 'Windows Desktop Session Started', - format: ({ user, windows_domain, desktop_name, windows_user }) => { - let message = `User [${user}] has connected to Windows desktop [${windows_user}@${desktop_name}]`; + format: ({ user, windows_domain, desktop_name, sid, windows_user }) => { + let message = `User [${user}] started session ${sid} on Windows desktop [${windows_user}@${desktop_name}]`; if (windows_domain) { - message += ` on [${windows_domain}]`; + message += ` with domain [${windows_domain}]`; } return message; }, @@ -1159,7 +1159,7 @@ export const formatters: Formatters = { format: ({ user, windows_domain, desktop_name, windows_user }) => { let message = `User [${user}] was denied access to Windows desktop [${windows_user}@${desktop_name}]`; if (windows_domain) { - message += ` on [${windows_domain}]`; + message += ` with domain [${windows_domain}]`; } return message; }, @@ -1167,12 +1167,12 @@ export const formatters: Formatters = { [eventCodes.DESKTOP_SESSION_ENDED]: { type: 'windows.desktop.session.end', desc: 'Windows Desktop Session Ended', - format: ({ user, windows_domain, desktop_name, windows_user }) => { + format: ({ user, windows_domain, desktop_name, sid, windows_user }) => { let desktopMessage = `[${windows_user}@${desktop_name}]`; if (windows_domain) { - desktopMessage += ` on [${windows_domain}]`; + desktopMessage += ` with domain [${windows_domain}]`; } - let message = `Session for Windows desktop ${desktopMessage} has ended for user [${user}]`; + let message = `Session ${sid} for Windows desktop ${desktopMessage} has ended for user [${user}]`; return message; }, }, diff --git a/web/packages/teleport/src/services/audit/types.ts b/web/packages/teleport/src/services/audit/types.ts index 076fff8f94a6c..c6ffb2f3a5e98 100644 --- a/web/packages/teleport/src/services/audit/types.ts +++ b/web/packages/teleport/src/services/audit/types.ts @@ -1049,6 +1049,7 @@ export type RawEvents = { { desktop_addr: string; desktop_name: string; + sid: string; windows_user: string; windows_domain: string; } @@ -1067,6 +1068,7 @@ export type RawEvents = { { desktop_addr: string; desktop_name: string; + sid: string; windows_user: string; windows_domain: string; }