Skip to content

Commit

Permalink
Add autoupdate events to web UI (#52748) (#52838)
Browse files Browse the repository at this point in the history
* Add autoupdate events to web UI

* lint
  • Loading branch information
hugoShaka authored Mar 6, 2025
1 parent 8198383 commit 15b2008
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/packages/teleport/src/Audit/EventList/EventTypeCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ const EventIconMap: Record<EventCode, any> = {
[eventCodes.GIT_COMMAND]: Icons.GitHub,
[eventCodes.GIT_COMMAND_FAILURE]: Icons.GitHub,
[eventCodes.STABLE_UNIX_USER_CREATE]: Icons.Info,
[eventCodes.AUTOUPDATE_CONFIG_CREATE]: Icons.Info,
[eventCodes.AUTOUPDATE_CONFIG_UPDATE]: Icons.Info,
[eventCodes.AUTOUPDATE_CONFIG_DELETE]: Icons.Info,
[eventCodes.AUTOUPDATE_VERSION_CREATE]: Icons.Info,
[eventCodes.AUTOUPDATE_VERSION_UPDATE]: Icons.Info,
[eventCodes.AUTOUPDATE_VERSION_DELETE]: Icons.Info,
};

export default function renderTypeCell(event: Event) {
Expand Down
96 changes: 96 additions & 0 deletions web/packages/teleport/src/Audit/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3777,6 +3777,102 @@ export const events = [
},
],
},
{
'addr.remote': '127.0.0.1:41608',
cluster_name: 'autest.cloud.gravitational.io',
code: 'AUV001I',
ei: 0,
event: 'auto_update_version.create',
expires: '0001-01-01T00:00:00Z',
name: 'autoupdate-version',
success: true,
time: '2025-03-04T15:41:24.433Z',
uid: '3d677d2f-91d0-4b5a-966d-183a59cec888',
updated_by:
'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user: 'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user_kind: 1,
},
{
'addr.remote': '127.0.0.1:42540',
cluster_name: 'autest.cloud.gravitational.io',
code: 'AUV002I',
ei: 0,
event: 'auto_update_version.update',
expires: '0001-01-01T00:00:00Z',
name: 'autoupdate-version',
success: true,
time: '2025-03-04T15:27:36.039Z',
uid: 'b7f9dde2-2899-46f1-bd4e-699d7b630e33',
updated_by:
'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user: 'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user_kind: 1,
},
{
'addr.remote': '127.0.0.1:50316',
cluster_name: 'autest.cloud.gravitational.io',
code: 'AUV003I',
ei: 0,
event: 'auto_update_version.delete',
expires: '0001-01-01T00:00:00Z',
name: 'autoupdate-version',
success: true,
time: '2025-03-04T15:25:44.805Z',
uid: 'c4d0d165-3a17-46ac-baa7-c7f521629997',
updated_by:
'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user: 'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user_kind: 1,
},
{
'addr.remote': '127.0.0.1:46790',
cluster_name: 'autest.cloud.gravitational.io',
code: 'AUC001I',
ei: 0,
event: 'auto_update_config.create',
expires: '0001-01-01T00:00:00Z',
name: 'autoupdate-config',
success: true,
time: '2025-03-04T15:49:31.946Z',
uid: '6fcbf7ed-b44c-4b83-bb70-02a574564e0b',
updated_by:
'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user: 'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user_kind: 1,
},
{
'addr.remote': '127.0.0.1:46798',
cluster_name: 'autest.cloud.gravitational.io',
code: 'AUC002I',
ei: 0,
event: 'auto_update_config.update',
expires: '0001-01-01T00:00:00Z',
name: 'autoupdate-config',
success: true,
time: '2025-03-04T15:49:37.633Z',
uid: '94c580a9-6f87-4a23-9fe5-f93de4390cff',
updated_by:
'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user: 'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user_kind: 1,
},
{
'addr.remote': '127.0.0.1:39518',
cluster_name: 'autest.cloud.gravitational.io',
code: 'AUC003I',
ei: 0,
event: 'auto_update_config.delete',
expires: '0001-01-01T00:00:00Z',
name: 'autoupdate-config',
success: true,
time: '2025-03-04T15:49:21.869Z',
uid: 'af17ab4a-d5a2-44a3-93ce-89390b50d52f',
updated_by:
'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user: 'b6eae9ed-bfde-40ba-a880-948a2c598b2b.autest.cloud.gravitational.io',
user_kind: 1,
},
].map(makeEvent);

// Do not add new events to this array, add it to `events` list.
Expand Down
42 changes: 42 additions & 0 deletions web/packages/teleport/src/services/audit/makeEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2029,6 +2029,48 @@ export const formatters: Formatters = {
return `Stable UNIX user for username [${username}] was created`;
},
},
[eventCodes.AUTOUPDATE_CONFIG_CREATE]: {
type: 'auto_update_config.create',
desc: 'Automatic Update Config Created',
format: ({ user }) => {
return `User ${user} created the Automatic Update Config`;
},
},
[eventCodes.AUTOUPDATE_CONFIG_UPDATE]: {
type: 'auto_update_config.update',
desc: 'Automatic Update Config Updated',
format: ({ user }) => {
return `User ${user} updated the Automatic Update Config`;
},
},
[eventCodes.AUTOUPDATE_CONFIG_DELETE]: {
type: 'auto_update_config.delete',
desc: 'Automatic Update Config Deleted',
format: ({ user }) => {
return `User ${user} deleted the Automatic Update Config`;
},
},
[eventCodes.AUTOUPDATE_VERSION_CREATE]: {
type: 'auto_update_version.create',
desc: 'Automatic Update Version Created',
format: ({ user }) => {
return `User ${user} created the Automatic Update Version`;
},
},
[eventCodes.AUTOUPDATE_VERSION_UPDATE]: {
type: 'auto_update_version.update',
desc: 'Automatic Update Version Updated',
format: ({ user }) => {
return `User ${user} updated the Automatic Update Version`;
},
},
[eventCodes.AUTOUPDATE_VERSION_DELETE]: {
type: 'auto_update_version.delete',
desc: 'Automatic Update Version Deleted',
format: ({ user }) => {
return `User ${user} deleted the Automatic Update Version`;
},
},
};

const unknownFormatter = {
Expand Down
42 changes: 42 additions & 0 deletions web/packages/teleport/src/services/audit/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ export const eventCodes = {
GIT_COMMAND: 'TGIT001I',
GIT_COMMAND_FAILURE: 'TGIT001E',
STABLE_UNIX_USER_CREATE: 'TSUU001I',
AUTOUPDATE_CONFIG_CREATE: 'AUC001I',
AUTOUPDATE_CONFIG_UPDATE: 'AUC002I',
AUTOUPDATE_CONFIG_DELETE: 'AUC003I',
AUTOUPDATE_VERSION_CREATE: 'AUV001I',
AUTOUPDATE_VERSION_UPDATE: 'AUV002I',
AUTOUPDATE_VERSION_DELETE: 'AUV003I',
} as const;

/**
Expand Down Expand Up @@ -1795,6 +1801,42 @@ export type RawEvents = {
};
}
>;
[eventCodes.AUTOUPDATE_CONFIG_CREATE]: RawEvent<
typeof eventCodes.AUTOUPDATE_CONFIG_CREATE,
{
user: string;
}
>;
[eventCodes.AUTOUPDATE_CONFIG_UPDATE]: RawEvent<
typeof eventCodes.AUTOUPDATE_CONFIG_UPDATE,
{
user: string;
}
>;
[eventCodes.AUTOUPDATE_CONFIG_DELETE]: RawEvent<
typeof eventCodes.AUTOUPDATE_CONFIG_DELETE,
{
user: string;
}
>;
[eventCodes.AUTOUPDATE_VERSION_CREATE]: RawEvent<
typeof eventCodes.AUTOUPDATE_VERSION_CREATE,
{
user: string;
}
>;
[eventCodes.AUTOUPDATE_VERSION_UPDATE]: RawEvent<
typeof eventCodes.AUTOUPDATE_VERSION_UPDATE,
{
user: string;
}
>;
[eventCodes.AUTOUPDATE_VERSION_DELETE]: RawEvent<
typeof eventCodes.AUTOUPDATE_VERSION_DELETE,
{
user: string;
}
>;
};

/**
Expand Down

0 comments on commit 15b2008

Please sign in to comment.