Skip to content

Commit

Permalink
web: add desktop session ID to audit log page
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zmb3 committed Sep 10, 2024
1 parent 26764b5 commit ddc50df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8166,7 +8166,7 @@ exports[`list of all events 1`] = `
<td
style="word-break: break-word;"
>
User [joe] was denied access to Windows desktop [Administrator@desktop-name] on [desktopaccess.com]
User [joe] was denied access to Windows desktop [Administrator@desktop-name] with domain [desktopaccess.com]
</td>
<td
style="min-width: 120px;"
Expand Down Expand Up @@ -8214,7 +8214,7 @@ exports[`list of all events 1`] = `
<td
style="word-break: break-word;"
>
Session for Windows desktop [Administrator@desktop-name] on [desktopaccess.com] has ended for user [joe]
Session b7f734d8-bdc2-4996-8959-0b42a11708e7 for Windows desktop [Administrator@desktop-name] with domain [desktopaccess.com] has ended for user [joe]
</td>
<td
style="min-width: 120px;"
Expand Down Expand Up @@ -8262,7 +8262,7 @@ exports[`list of all events 1`] = `
<td
style="word-break: break-word;"
>
User [joe] has connected to Windows desktop [Administrator@desktop-name] on [desktopaccess.com]
User [joe] started session b7f734d8-bdc2-4996-8959-0b42a11708e7 on Windows desktop [Administrator@desktop-name] with domain [desktopaccess.com]
</td>
<td
style="min-width: 120px;"
Expand Down
14 changes: 7 additions & 7 deletions web/packages/teleport/src/services/audit/makeEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1264,10 +1264,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;
},
Expand All @@ -1278,20 +1278,20 @@ 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;
},
},
[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;
},
},
Expand Down
2 changes: 2 additions & 0 deletions web/packages/teleport/src/services/audit/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,7 @@ export type RawEvents = {
{
desktop_addr: string;
desktop_name: string;
sid: string;
windows_user: string;
windows_domain: string;
}
Expand All @@ -1169,6 +1170,7 @@ export type RawEvents = {
{
desktop_addr: string;
desktop_name: string;
sid: string;
windows_user: string;
windows_domain: string;
}
Expand Down

0 comments on commit ddc50df

Please sign in to comment.