Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v15] [web] Include node name or k8s cluster for session started audit entry display #49834

Merged
merged 4 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12800,7 +12800,7 @@ exports[`list of all events 1`] = `
<td
style="word-break: break-word;"
>
User [admin@example.com] has started a session [56408539-6536-11e9-80a1-427cfde50f5a]
User [admin@example.com] has started a session [56408539-6536-11e9-80a1-427cfde50f5a] on node [de3800ea-69d9-4d72-a108-97e57f8eb393]
</td>
<td
style="min-width: 120px;"
Expand Down
15 changes: 14 additions & 1 deletion web/packages/teleport/src/services/audit/makeEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,20 @@ export const formatters: Formatters = {
[eventCodes.SESSION_START]: {
type: 'session.start',
desc: 'Session Started',
format: ({ user, sid }) => `User [${user}] has started a session [${sid}]`,
format: event => {
const user = event.user || '';

if (event.proto === 'kube') {
if (!event.kubernetes_cluster) {
return `User [${user}] has started a Kubernetes session [${event.sid}]`;
}
return `User [${user}] has started a session [${event.sid}] on Kubernetes cluster [${event.kubernetes_cluster}]`;
}

const node =
event.server_hostname || event.server_addr || event.server_id;
return `User [${user}] has started a session [${event.sid}] on node [${node}] `;
},
},
[eventCodes.SESSION_UPLOAD]: {
type: 'session.upload',
Expand Down
5 changes: 5 additions & 0 deletions web/packages/teleport/src/services/audit/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,11 @@ export type RawEvents = {
typeof eventCodes.SESSION_START,
{
sid: string;
kubernetes_cluster: string;
proto: string;
server_hostname: string;
server_addr: string;
server_id: string;
}
>;
[eventCodes.SESSION_REJECT]: RawEvent<
Expand Down
Loading