From 161d6786d4c3af3074b299f0b5a412e7a77f5a0b Mon Sep 17 00:00:00 2001 From: Andrew Lytvynov Date: Thu, 12 Nov 2020 20:30:36 +0000 Subject: [PATCH] Add KUBE_REQUEST event and improve existing k8s events (#190) * Add KUBE_REQUEST event and improve existing k8s events * Propagate the cluster name and make EXEC event special-case k8s sessions. Co-authored-by: Alexey Kontsevoy --- .../src/Audit/EventList/EventTypeCell.tsx | 35 +- .../__snapshots__/Audit.story.test.tsx.snap | 74 +++- .../teleport/src/Audit/fixtures/index.ts | 27 ++ .../teleport/src/services/audit/makeEvent.ts | 322 ++--------------- .../teleport/src/services/audit/types.ts | 341 +----------------- 5 files changed, 138 insertions(+), 661 deletions(-) diff --git a/web/packages/teleport/src/Audit/EventList/EventTypeCell.tsx b/web/packages/teleport/src/Audit/EventList/EventTypeCell.tsx index ac7e1fdd17ea6..72e9c8411943b 100644 --- a/web/packages/teleport/src/Audit/EventList/EventTypeCell.tsx +++ b/web/packages/teleport/src/Audit/EventList/EventTypeCell.tsx @@ -66,40 +66,7 @@ const EventIconMap = { [CodeEnum.USER_LOCAL_LOGINFAILURE]: Icons.Info, [CodeEnum.USER_SSO_LOGIN]: Icons.Info, [CodeEnum.USER_SSO_LOGINFAILURE]: Icons.Info, - [CodeEnum.G_ALERT_CREATED]: Icons.NotificationsActive, - [CodeEnum.G_ALERT_DELETED]: Icons.NotificationsActive, - [CodeEnum.G_APPLICATION_INSTALL]: Icons.AppInstalled, - [CodeEnum.G_APPLICATION_ROLLBACK]: Icons.AppRollback, - [CodeEnum.G_APPLICATION_UNINSTALL]: Icons.PhonelinkErase, - [CodeEnum.G_APPLICATION_UPGRADE]: Icons.PhonelinkSetup, - [CodeEnum.G_AUTHGATEWAY_UPDATED]: Icons.Config, - [CodeEnum.G_LICENSE_EXPIRED]: Icons.NoteAdded, - [CodeEnum.G_LICENSE_UPDATED]: Icons.NoteAdded, - [CodeEnum.G_LOGFORWARDER_CREATED]: Icons.ForwarderAdded, - [CodeEnum.G_LOGFORWARDER_DELETED]: Icons.ForwarderAdded, - [CodeEnum.G_OPERATION_ENV_COMPLETE]: Icons.Memory, - [CodeEnum.G_OPERATION_ENV_FAILURE]: Icons.Memory, - [CodeEnum.G_OPERATION_ENV_START]: Icons.NoteAdded, - [CodeEnum.G_OPERATION_EXPAND_COMPLETE]: Icons.SettingsOverscan, - [CodeEnum.G_OPERATION_EXPAND_START]: Icons.SettingsOverscan, - [CodeEnum.G_OPERATION_INSTALL_COMPLETE]: Icons.Unarchive, - [CodeEnum.G_OPERATION_INSTALL_FAILURE]: Icons.Unarchive, - [CodeEnum.G_OPERATION_INSTALL_START]: Icons.Unarchive, - [CodeEnum.G_OPERATION_SHRINK_COMPLETE]: Icons.Shrink, - [CodeEnum.G_OPERATION_SHRINK_FAILURE]: Icons.Shrink, - [CodeEnum.G_OPERATION_SHRINK_START]: Icons.Shrink, - [CodeEnum.G_REMOTE_SUPPORT_DISABLED]: Icons.LanAlt, - [CodeEnum.G_REMOTE_SUPPORT_ENABLED]: Icons.LanAlt, - [CodeEnum.G_SMTPCONFIG_CREATED]: Icons.EmailSolid, - [CodeEnum.G_SMTPCONFIG_DELETED]: Icons.EmailSolid, - [CodeEnum.G_TLSKEYPAIR_CREATED]: Icons.Keypair, - [CodeEnum.G_TLSKEYPAIR_DELETED]: Icons.Keypair, - [CodeEnum.G_TOKEN_CREATED]: Icons.Stars, - [CodeEnum.G_TOKEN_DELETED]: Icons.Stars, - [CodeEnum.G_UPDATES_DISABLED]: Icons.Restore, - [CodeEnum.G_UPDATES_DOWNLOADED]: Icons.Restore, - [CodeEnum.G_UPDATES_ENABLED]: Icons.Restore, - [CodeEnum.G_USER_INVITE_CREATED]: Icons.Info, + [CodeEnum.KUBE_REQUEST]: Icons.Kubernetes, }; export default function TypeCell(props) { diff --git a/web/packages/teleport/src/Audit/__snapshots__/Audit.story.test.tsx.snap b/web/packages/teleport/src/Audit/__snapshots__/Audit.story.test.tsx.snap index 7f7fe91fca06b..8617e39940ab4 100644 --- a/web/packages/teleport/src/Audit/__snapshots__/Audit.story.test.tsx.snap +++ b/web/packages/teleport/src/Audit/__snapshots__/Audit.story.test.tsx.snap @@ -447,12 +447,12 @@ exports[`loaded 1`] = ` - - 34 + 36 of - 34 + 36
+ + +
+ + Kubernetes Request +
+ + + User [alex] made a request to kubernetes cluster [clusterOne] + + + 2020-10-30 17:28:14 + + + + + + + +
+ + Command Execution +
+ + + User [alex] executed a command on kubernetes cluster [clusterOne] + + + 2020-10-30 17:28:14 + + + + +
`Access request [${id}] has been created and is ${state}`, }, - [CodeEnum.ACCESS_REQUEST_UPDATED]: { desc: 'Access Request Updated', format: ({ id, state }) => `Access request [${id}] has been updated to ${state}`, }, - - [CodeEnum.G_SAML_CONNECTOR_CREATED]: { - desc: 'SAML Connector Created', - format: ({ user, name }) => - `User [${user}] created SAML connector [${name}]`, - }, - - [CodeEnum.G_SAML_CONNECTOR_DELETED]: { - desc: 'SAML Connector Deleted', - format: ({ user, name }) => - `User [${user}] deleted SAML connector [${name}]`, - }, - [CodeEnum.SESSION_COMMAND]: { desc: 'Session Command', format: ({ program, sid }) => `Program [${program}] has been executed within a session [${sid}]`, }, - [CodeEnum.SESSION_DISK]: { desc: 'Session File Access', format: ({ path, sid, program }) => `Program [${program}] accessed a file [${path}] within a session [${sid}]`, }, - [CodeEnum.SESSION_NETWORK]: { desc: 'Session Network Connection', format: ({ sid, program, src_addr, dst_addr, dst_port }) => `Program [${program}] opened a connection [${src_addr} <-> ${dst_addr}:${dst_port}] within a session [${sid}]`, }, - [CodeEnum.SESSION_DATA]: { desc: 'Session Data', format: ({ sid }) => @@ -75,87 +58,34 @@ export const formatters: Formatters = { desc: 'User Updated', format: ({ name }) => `User [${name}] has been updated`, }, - [CodeEnum.RESET_PASSWORD_TOKEN_CREATED]: { desc: 'Reset Password Token Created', format: ({ name, user }) => `User [${user}] created a password reset token for user [${name}]`, }, - - [CodeEnum.G_ALERT_CREATED]: { - desc: 'Alert Created', - format: ({ user, name }) => - `User [${user}] created Monitoring Alert [${name}]`, - }, - [CodeEnum.G_ALERT_DELETED]: { - desc: 'Alert Deleted', - format: ({ user, name }) => - `User [${user}] deleted monitoring alert [${name}]`, - }, - [CodeEnum.G_ALERT_TARGET_CREATED]: { - desc: 'Alert Target Created', - format: ({ user }) => `User [${user}] updated monitoring alert target`, - }, - [CodeEnum.G_ALERT_TARGET_DELETED]: { - desc: 'Alert Target Deleted', - format: ({ user }) => `User [${user}] deleted monitoring alert target`, - }, - [CodeEnum.G_APPLICATION_INSTALL]: { - desc: 'Application Installed', - format: ({ releaseName, name, version }) => - `Application release ${releaseName} ([${name}]:${version}) has been installed`, - }, - [CodeEnum.G_APPLICATION_UPGRADE]: { - desc: 'Application Upgraded', - format: ({ releaseName, name, version }) => - `Application release ${releaseName} has been upgraded to [${name}]:${version}`, - }, - [CodeEnum.G_APPLICATION_ROLLBACK]: { - desc: 'Application Rolledbacked', - format: ({ releaseName, name, version }) => - `Application release ${releaseName} has been rolled back to [${name}]:${version}`, - }, - [CodeEnum.G_APPLICATION_UNINSTALL]: { - desc: 'Application Uninstalled', - format: ({ releaseName, name, version }) => - `Applicaiton release ${releaseName} ([${name}]:${version}) has been uninstalled`, - }, [CodeEnum.AUTH_ATTEMPT_FAILURE]: { desc: 'Auth Attempt Failed', format: ({ user, error }) => `User [${user}] failed auth attempt: ${error}`, }, - [CodeEnum.G_AUTHGATEWAY_UPDATED]: { - desc: 'Auth Gateway Updated', - format: ({ user }) => - `User [${user}] updated cluster authentication gateway settings`, - }, - [CodeEnum.G_AUTHPREFERENCE_UPDATED]: { - desc: 'Auth Preferences Updated', - format: ({ user }) => - `User [${user}] updated cluster authentication preference`, - }, [CodeEnum.CLIENT_DISCONNECT]: { desc: 'Client Disconnected', format: ({ user, reason }) => `User [${user}] has been disconnected: ${reason}`, }, - [CodeEnum.G_CLUSTER_HEALTHY]: { - desc: 'Cluster Healthy', - format: () => `Cluster has become healthy`, - }, - [CodeEnum.G_CLUSTER_UNHEALTHY]: { - desc: 'Cluster Unhealthy', - format: ({ reason }) => `Cluster is degraded: ${reason}`, - }, - [CodeEnum.G_ENDPOINTS_UPDATED]: { - desc: 'Endpoints Updated', - format: ({ user }) => `User [${user}] updated Ops Center endpoints`, - }, [CodeEnum.EXEC]: { desc: 'Command Execution', - format: ({ user, ...rest }) => - `User [${user}] executed a command on node ${rest['addr.local']}`, + format: event => { + const { proto, kubernetes_cluster, user = '' } = event; + if (proto === 'kube') { + if (!kubernetes_cluster) { + return `User [${user}] executed a kubernetes command`; + } + return `User [${user}] executed a command on kubernetes cluster [${kubernetes_cluster}]`; + } + + return `User [${user}] executed a command on node ${event['addr.local']}`; + }, }, [CodeEnum.EXEC_FAILURE]: { desc: 'Command Execution Failed', @@ -172,39 +102,6 @@ export const formatters: Formatters = { format: ({ user, name }) => `User [${user}] deleted Github connector [${name}]`, }, - [CodeEnum.G_GITHUB_CONNECTOR_CREATED]: { - desc: 'GITHUB Auth Connector Created', - format: ({ user, name }) => - `User [${user}] created Github connector [${name}]`, - }, - [CodeEnum.G_GITHUB_CONNECTOR_DELETED]: { - desc: 'GITHUB Auth Connector Deleted', - format: ({ user, name }) => - `User [${user}] deleted Github connector [${name}]`, - }, - [CodeEnum.G_LICENSE_GENERATED]: { - desc: 'Cluster License Generated', - format: ({ maxNodes }) => - `License for max nodes ${maxNodes} has been generated`, - }, - [CodeEnum.G_LICENSE_EXPIRED]: { - desc: 'Cluster License Expired', - format: () => `Cluster license has expired`, - }, - [CodeEnum.G_LICENSE_UPDATED]: { - desc: 'Cluster License Updated', - format: () => `Cluster license has been updated`, - }, - [CodeEnum.G_LOGFORWARDER_CREATED]: { - desc: 'Log Forwarder Created', - format: ({ user, name }) => - `User [${user}] created log forwarder [${name}]`, - }, - [CodeEnum.G_LOGFORWARDER_DELETED]: { - desc: 'Log Forwarder Deleted', - format: ({ user, name }) => - `User [${user}] deleted log forwarder [${name}]`, - }, [CodeEnum.OIDC_CONNECTOR_CREATED]: { desc: 'OIDC Auth Connector Created', format: ({ user, name }) => @@ -215,119 +112,6 @@ export const formatters: Formatters = { format: ({ user, name }) => `User [${user}] deleted OIDC connector [${name}]`, }, - [CodeEnum.G_OIDC_CONNECTOR_CREATED]: { - desc: 'OIDC Auth Connector Created', - format: ({ user, name }) => - `User [${user}] created OIDC connector [${name}]`, - }, - [CodeEnum.G_OIDC_CONNECTOR_DELETED]: { - desc: 'OIDC Auth Connector Deleted', - format: ({ user, name }) => - `User [${user}] deleted OIDC connector [${name}]`, - }, - [CodeEnum.G_OPERATION_CONFIG_COMPLETE]: { - desc: 'Cluster Configuration Completed', - format: () => `Cluster configuration has been updated`, - }, - [CodeEnum.G_OPERATION_CONFIG_FAILURE]: { - desc: 'Cluster Configuration Failed', - format: () => `Failed to update the cluster configuration`, - }, - [CodeEnum.G_OPERATION_CONFIG_START]: { - desc: 'Cluster Configuration Started', - format: () => `Updating the cluster configuration`, - }, - [CodeEnum.G_OPERATION_ENV_COMPLETE]: { - desc: 'Environment Update Completed', - format: () => `Cluster runtime environment has been updated`, - }, - [CodeEnum.G_OPERATION_ENV_FAILURE]: { - desc: 'Environment Update Failed', - format: () => `Failed to update the cluster runtime environment`, - }, - [CodeEnum.G_OPERATION_ENV_START]: { - desc: 'Environment Update Started', - format: () => `Updating the cluster runtime environment`, - }, - [CodeEnum.G_OPERATION_EXPAND_START]: { - desc: 'Cluster Expand Started', - format: ({ hostname, ip, role }) => - `Node ${hostname} (${ip}) with role ${role} is joining the cluster`, - }, - [CodeEnum.G_OPERATION_EXPAND_COMPLETE]: { - desc: 'Cluster Expand Completed', - format: ({ hostname, ip, role }) => - `Node ${hostname} (${ip}) with role ${role} has joined the cluster`, - }, - [CodeEnum.G_OPERATION_EXPAND_FAILURE]: { - desc: 'Cluster Expand Failed', - format: ({ hostname, ip, role }) => - `Node ${hostname} (${ip}) with role ${role} has failed to join the cluster`, - }, - [CodeEnum.G_OPERATION_GC_START]: { - desc: 'GC Started', - format: () => 'Running garbage collection on the cluster', - }, - [CodeEnum.G_OPERATION_GC_COMPLETE]: { - desc: 'GC Completed', - format: () => 'Garbage collection on the cluster has finished', - }, - [CodeEnum.G_OPERATION_GC_FAILURE]: { - desc: 'GC Failed', - format: () => 'Garbage collection on the cluster has failed', - }, - [CodeEnum.G_OPERATION_INSTALL_START]: { - desc: 'Cluster Install Started', - format: ({ cluster }) => `Cluster ${cluster} is being installed`, - }, - [CodeEnum.G_OPERATION_INSTALL_COMPLETE]: { - desc: 'Cluster Install Completed', - format: ({ cluster }) => `Cluster ${cluster} has been installed`, - }, - [CodeEnum.G_OPERATION_INSTALL_FAILURE]: { - desc: 'Cluster Install Failed', - format: ({ cluster }) => `Cluster ${cluster} install has failed`, - }, - [CodeEnum.G_OPERATION_SHRINK_START]: { - desc: 'Cluster Shrink Started', - format: ({ hostname, ip, role }) => - `Node ${hostname} (${ip}) with role ${role} is leaving the cluster`, - }, - [CodeEnum.G_OPERATION_SHRINK_COMPLETE]: { - desc: 'Cluster Shrink Completed', - format: ({ hostname, ip, role }) => - `Node ${hostname} (${ip}) with role ${role} has left the cluster`, - }, - [CodeEnum.G_OPERATION_SHRINK_FAILURE]: { - desc: 'Cluster Shrink Failed', - format: ({ hostname, ip, role }) => - `Node ${hostname} (${ip}) with role ${role} has failed to leave the cluster`, - }, - [CodeEnum.G_OPERATION_UNINSTALL_START]: { - desc: 'Cluster Uninstall Started', - format: () => `Cluster is being uninstalled`, - }, - [CodeEnum.G_OPERATION_UNINSTALL_COMPLETE]: { - desc: 'Cluster Uninstall Completed', - format: () => `Cluster has been uninstalled`, - }, - [CodeEnum.G_OPERATION_UNINSTALL_FAILURE]: { - desc: 'Cluster Uninstall Failed', - format: () => `Cluster uninstall has failed`, - }, - [CodeEnum.G_OPERATION_UPDATE_COMPLETE]: { - desc: 'Cluster Update Completed', - format: ({ version }) => `Cluster has been updated to version ${version}`, - }, - [CodeEnum.G_OPERATION_UPDATE_FAILURE]: { - desc: 'Cluster Update Failed', - format: ({ version }) => - `Cluster has failed to update to version ${version}`, - }, - [CodeEnum.G_OPERATION_UPDATE_START]: { - desc: 'Cluster Update Started', - format: ({ version }) => `Cluster update to version ${version} has started`, - }, [CodeEnum.PORTFORWARD]: { desc: 'Port Forwarding Started', format: ({ user }) => `User [${user}] started port forwarding`, @@ -337,24 +121,6 @@ export const formatters: Formatters = { format: ({ user, error }) => `User [${user}] port forwarding request failed: ${error}`, }, - [CodeEnum.G_REMOTE_SUPPORT_ENABLED]: { - desc: 'Remote Support Enabled', - format: ({ user, hub }) => - `User [${user}] enabled remote support with Gravity Hub ${hub}`, - }, - [CodeEnum.G_REMOTE_SUPPORT_DISABLED]: { - desc: 'Remote Support Disabled', - format: ({ user, hub }) => - `User [${user}] disabled remote support with Gravity Hub ${hub}`, - }, - [CodeEnum.G_ROLE_CREATED]: { - desc: 'Role Created', - format: ({ user, name }) => `User [${user}] created role [${name}]`, - }, - [CodeEnum.G_ROLE_DELETED]: { - desc: 'Role Deleted', - format: ({ user, name }) => `User [${user}] deleted role [${name}]`, - }, [CodeEnum.SAML_CONNECTOR_CREATED]: { desc: 'SAML Connector Created', format: ({ user, name }) => @@ -396,6 +162,13 @@ export const formatters: Formatters = { const node = event.server_hostname || event.server_addr || event.server_id; + if (event.proto === 'kube') { + if (!event.kubernetes_cluster) { + return `User [${user}] has ended a kubernetes session [${event.sid}]`; + } + return `User [${user}] has ended a session [${event.sid}] on kubernetes cluster [${event.kubernetes_cluster}]`; + } + if (!event.interactive) { return `User [${user}] has ended a non-interactive session [${event.sid}] on node [${node}] `; } @@ -435,14 +208,6 @@ export const formatters: Formatters = { desc: 'App Session Data', format: ({ sid }) => `New app session data created [${sid}]`, }, - [CodeEnum.G_SMTPCONFIG_CREATED]: { - desc: 'SMTP Config Created', - format: ({ user }) => `User [${user}] updated cluster SMTP configuration`, - }, - [CodeEnum.G_SMTPCONFIG_DELETED]: { - desc: 'SMTP Config Deleted', - format: ({ user }) => `User [${user}] deleted cluster SMTP configuration`, - }, [CodeEnum.SUBSYSTEM]: { desc: 'Subsystem Requested', format: ({ user, name }) => `User [${user}] requested subsystem [${name}]`, @@ -457,39 +222,6 @@ export const formatters: Formatters = { format: ({ user, sid }) => `User [${user}] resized the session [${sid}] terminal`, }, - [CodeEnum.G_TLSKEYPAIR_CREATED]: { - desc: 'TLS Keypair Created', - format: ({ user }) => `User [${user}] installed cluster web certificate`, - }, - [CodeEnum.G_TLSKEYPAIR_DELETED]: { - desc: 'TLS Keypair Deleted', - format: ({ user }) => `User [${user}] deleted cluster web certificate`, - }, - [CodeEnum.G_TOKEN_CREATED]: { - desc: 'User Token Created', - format: ({ user, owner }) => - `User [${user}] created token for user ${owner}`, - }, - [CodeEnum.G_TOKEN_DELETED]: { - desc: 'User Token Deleted', - format: ({ user, owner }) => - `User [${user}] deleted token for user ${owner}`, - }, - [CodeEnum.G_UPDATES_ENABLED]: { - desc: 'Periodic Updates Enabled', - format: ({ user, hub }) => - `User [${user}] enabled periodic updates with Gravity Hub ${hub}`, - }, - [CodeEnum.G_UPDATES_DISABLED]: { - desc: 'Periodic Updates Disabled', - format: ({ user, hub }) => - `User [${user}] disabled periodic updates with Gravity Hub ${hub}`, - }, - [CodeEnum.G_UPDATES_DOWNLOADED]: { - desc: 'Update Downloaded', - format: ({ hub, name, version }) => - `Downloaded new version [${name}]:${version} from Gravity Hub ${hub}`, - }, [CodeEnum.USER_CREATED]: { desc: 'User Created', format: ({ name }) => `User [${name}] has been created`, @@ -498,19 +230,6 @@ export const formatters: Formatters = { desc: 'User Deleted', format: ({ name }) => `User [${name}] has been deleted`, }, - [CodeEnum.G_USER_CREATED]: { - desc: 'User Created', - format: ({ user, name }) => `User [${user}] created user [${name}]`, - }, - [CodeEnum.G_USER_DELETED]: { - desc: 'User Deleted', - format: ({ user, name }) => `User [${user}] deleted user [${name}]`, - }, - [CodeEnum.G_USER_INVITE_CREATED]: { - desc: 'Invite Created', - format: ({ user, name, roles }) => - `User [${user}] invited user [${name}] with roles ${roles}`, - }, [CodeEnum.USER_LOCAL_LOGIN]: { desc: 'Local Login', format: ({ user }) => `Local user [${user}] successfully logged in`, @@ -549,6 +268,11 @@ export const formatters: Formatters = { format: ({ user, name }) => `User [${user}] has deleted a trusted relationship with cluster [${name}]`, }, + [CodeEnum.KUBE_REQUEST]: { + desc: 'Kubernetes Request', + format: ({ user, kubernetes_cluster }) => + `User [${user}] made a request to kubernetes cluster [${kubernetes_cluster}]`, + }, }; const unknownFormatter = { diff --git a/web/packages/teleport/src/services/audit/types.ts b/web/packages/teleport/src/services/audit/types.ts index a2eea6da6df97..1299e7fa09536 100644 --- a/web/packages/teleport/src/services/audit/types.ts +++ b/web/packages/teleport/src/services/audit/types.ts @@ -40,6 +40,7 @@ export const CodeEnum = { APP_SESSION_CHUNK: 'T2008I', SUBSYSTEM_FAILURE: 'T3001E', SUBSYSTEM: 'T3001I', + KUBE_REQUEST: 'T3009I', TERMINAL_RESIZE: 'T2002I', USER_LOCAL_LOGIN: 'T1000I', USER_LOCAL_LOGINFAILURE: 'T1000W', @@ -63,128 +64,32 @@ export const CodeEnum = { TRUSTED_CLUSTER_TOKEN_CREATED: 'T7002I', TRUSTED_CLUSTER_CREATED: 'T7000I', TRUSTED_CLUSTER_DELETED: 'T7001I', - - // Gravity - G_ALERT_CREATED: 'G1007I', - G_ALERT_DELETED: 'G2007I', - G_ALERT_TARGET_CREATED: 'G1008I', - G_ALERT_TARGET_DELETED: 'G2008I', - G_APPLICATION_INSTALL: 'G4000I', - G_APPLICATION_ROLLBACK: 'G4002I', - G_APPLICATION_UNINSTALL: 'G4003I', - G_APPLICATION_UPGRADE: 'G4001I', - G_AUTHGATEWAY_UPDATED: 'G1009I', - G_AUTHPREFERENCE_UPDATED: 'G1005I', - G_CLUSTER_HEALTHY: 'G3001I', - G_CLUSTER_UNHEALTHY: 'G3000W', - G_LOGFORWARDER_CREATED: 'G1003I', - G_LOGFORWARDER_DELETED: 'G2003I', - G_OPERATION_CONFIG_COMPLETE: 'G0016I', - G_OPERATION_CONFIG_FAILURE: 'G0016E', - G_OPERATION_CONFIG_START: 'G0015I', - G_OPERATION_ENV_COMPLETE: 'G0014I', - G_OPERATION_ENV_FAILURE: 'G0014E', - G_OPERATION_ENV_START: 'G0013I', - G_OPERATION_EXPAND_COMPLETE: 'G0004I', - G_OPERATION_EXPAND_FAILURE: 'G0004E', - G_OPERATION_EXPAND_START: 'G0003I', - G_OPERATION_GC_COMPLETE: 'G0012I', - G_OPERATION_GC_FAILURE: 'G0012E', - G_OPERATION_GC_START: 'G0011I', - G_OPERATION_INSTALL_COMPLETE: 'G0002I', - G_OPERATION_INSTALL_FAILURE: 'G0002E', - G_OPERATION_INSTALL_START: 'G0001I', - G_OPERATION_SHRINK_COMPLETE: 'G0006I', - G_OPERATION_SHRINK_FAILURE: 'G0006E', - G_OPERATION_SHRINK_START: 'G0005I', - G_OPERATION_UNINSTALL_COMPLETE: 'G0010I', - G_OPERATION_UNINSTALL_FAILURE: 'G0010E', - G_OPERATION_UNINSTALL_START: 'G0009I', - G_OPERATION_UPDATE_COMPLETE: 'G0008I', - G_OPERATION_UPDATE_FAILURE: 'G0008E', - G_OPERATION_UPDATE_START: 'G0007I', - G_ROLE_CREATED: 'GE1000I', - G_ROLE_DELETED: 'GE2000I', - G_SMTPCONFIG_CREATED: 'G1006I', - G_SMTPCONFIG_DELETED: 'G2006I', - G_TLSKEYPAIR_CREATED: 'G1004I', - G_TLSKEYPAIR_DELETED: 'G2004I', - G_TOKEN_CREATED: 'G1001I', - G_TOKEN_DELETED: 'G2001I', - G_USER_CREATED: 'G1000I', - G_USER_DELETED: 'G2000I', - G_USER_INVITE_CREATED: 'G1010I', - G_ENDPOINTS_UPDATED: 'GE1003I', - G_LICENSE_EXPIRED: 'GE3003I', - G_LICENSE_GENERATED: 'GE3002I', - G_LICENSE_UPDATED: 'GE3004I', - G_GITHUB_CONNECTOR_CREATED: 'G1002I', - G_GITHUB_CONNECTOR_DELETED: 'G2002I', - G_OIDC_CONNECTOR_CREATED: 'GE1001I', - G_OIDC_CONNECTOR_DELETED: 'GE2001I', - G_REMOTE_SUPPORT_DISABLED: 'GE3001I', - G_REMOTE_SUPPORT_ENABLED: 'GE3000I', - G_SAML_CONNECTOR_CREATED: 'GE1002I', - G_SAML_CONNECTOR_DELETED: 'GE2002I', - G_UPDATES_DISABLED: 'GE3006I', - G_UPDATES_DOWNLOADED: 'GE3007I', - G_UPDATES_ENABLED: 'GE3005I', } as const; /** * Describes all raw event types */ export type RawEvents = { - [CodeEnum.G_ALERT_CREATED]: RawEventAlert; - [CodeEnum.G_ALERT_DELETED]: RawEventAlert; [CodeEnum.ACCESS_REQUEST_CREATED]: RawEventAccess< typeof CodeEnum.ACCESS_REQUEST_CREATED >; [CodeEnum.ACCESS_REQUEST_UPDATED]: RawEventAccess< typeof CodeEnum.ACCESS_REQUEST_UPDATED >; - [CodeEnum.G_ALERT_TARGET_CREATED]: RawEventAlert< - typeof CodeEnum.G_ALERT_TARGET_CREATED - >; - [CodeEnum.G_ALERT_TARGET_DELETED]: RawEvent< - typeof CodeEnum.G_ALERT_TARGET_DELETED - >; - [CodeEnum.G_APPLICATION_INSTALL]: RawEventApplication< - typeof CodeEnum.G_APPLICATION_INSTALL - >; - [CodeEnum.G_APPLICATION_UPGRADE]: RawEventApplication< - typeof CodeEnum.G_APPLICATION_UPGRADE - >; - [CodeEnum.G_APPLICATION_ROLLBACK]: RawEventApplication< - typeof CodeEnum.G_APPLICATION_ROLLBACK - >; - [CodeEnum.G_APPLICATION_UNINSTALL]: RawEventApplication< - typeof CodeEnum.G_APPLICATION_UNINSTALL - >; - [CodeEnum.AUTH_ATTEMPT_FAILURE]: RawEventAuthFailure< typeof CodeEnum.AUTH_ATTEMPT_FAILURE >; - [CodeEnum.G_AUTHGATEWAY_UPDATED]: RawEvent< - typeof CodeEnum.G_AUTHGATEWAY_UPDATED - >; - [CodeEnum.G_AUTHPREFERENCE_UPDATED]: RawEvent< - typeof CodeEnum.G_AUTHPREFERENCE_UPDATED - >; [CodeEnum.CLIENT_DISCONNECT]: RawEvent< typeof CodeEnum.CLIENT_DISCONNECT, { reason: string } >; - [CodeEnum.G_CLUSTER_HEALTHY]: RawEvent< - typeof CodeEnum.G_CLUSTER_HEALTHY, - { reason: string } - >; - [CodeEnum.G_CLUSTER_UNHEALTHY]: RawEvent< - typeof CodeEnum.G_CLUSTER_UNHEALTHY, - { reason: string } + [CodeEnum.EXEC]: RawEvent< + typeof CodeEnum.EXEC, + { + proto: 'kube'; + kubernetes_cluster: string; + } >; - [CodeEnum.G_ENDPOINTS_UPDATED]: RawEvent; - [CodeEnum.EXEC]: RawEvent; [CodeEnum.EXEC_FAILURE]: RawEvent< typeof CodeEnum.EXEC_FAILURE, { exitError: string } @@ -195,138 +100,12 @@ export type RawEvents = { [CodeEnum.GITHUB_CONNECTOR_DELETED]: RawEventConnector< typeof CodeEnum.GITHUB_CONNECTOR_DELETED >; - [CodeEnum.G_GITHUB_CONNECTOR_CREATED]: RawEventConnector< - typeof CodeEnum.G_GITHUB_CONNECTOR_CREATED - >; - [CodeEnum.G_GITHUB_CONNECTOR_DELETED]: RawEventConnector< - typeof CodeEnum.G_GITHUB_CONNECTOR_DELETED - >; - [CodeEnum.G_LICENSE_GENERATED]: RawEvent< - typeof CodeEnum.G_LICENSE_GENERATED, - { maxNodes: number } - >; - [CodeEnum.G_LICENSE_EXPIRED]: RawEvent; - [CodeEnum.G_LICENSE_UPDATED]: RawEvent; - [CodeEnum.G_LOGFORWARDER_CREATED]: RawEvent< - typeof CodeEnum.G_LOGFORWARDER_CREATED, - HasName - >; - - [CodeEnum.G_LOGFORWARDER_DELETED]: RawEvent< - typeof CodeEnum.G_LOGFORWARDER_DELETED, - HasName - >; [CodeEnum.OIDC_CONNECTOR_CREATED]: RawEventConnector< typeof CodeEnum.OIDC_CONNECTOR_CREATED >; [CodeEnum.OIDC_CONNECTOR_DELETED]: RawEventConnector< typeof CodeEnum.OIDC_CONNECTOR_DELETED >; - [CodeEnum.G_OIDC_CONNECTOR_CREATED]: RawEventConnector< - typeof CodeEnum.G_OIDC_CONNECTOR_CREATED - >; - [CodeEnum.G_OIDC_CONNECTOR_DELETED]: RawEventConnector< - typeof CodeEnum.G_OIDC_CONNECTOR_DELETED - >; - [CodeEnum.G_OPERATION_CONFIG_COMPLETE]: RawEvent< - typeof CodeEnum.G_OPERATION_CONFIG_COMPLETE - >; - [CodeEnum.G_OPERATION_CONFIG_FAILURE]: RawEvent< - typeof CodeEnum.G_OPERATION_CONFIG_FAILURE - >; - [CodeEnum.G_OPERATION_CONFIG_START]: RawEvent< - typeof CodeEnum.G_OPERATION_CONFIG_START - >; - [CodeEnum.G_OPERATION_ENV_COMPLETE]: RawEvent< - typeof CodeEnum.G_OPERATION_ENV_COMPLETE - >; - [CodeEnum.G_OPERATION_ENV_FAILURE]: RawEvent< - typeof CodeEnum.G_OPERATION_ENV_FAILURE - >; - [CodeEnum.G_OPERATION_ENV_START]: RawEvent< - typeof CodeEnum.G_OPERATION_ENV_START - >; - [CodeEnum.G_OPERATION_EXPAND_START]: RawEventOperation< - typeof CodeEnum.G_OPERATION_EXPAND_START - >; - [CodeEnum.G_OPERATION_EXPAND_COMPLETE]: RawEventOperation< - typeof CodeEnum.G_OPERATION_EXPAND_COMPLETE - >; - [CodeEnum.G_OPERATION_EXPAND_FAILURE]: RawEventOperation< - typeof CodeEnum.G_OPERATION_EXPAND_FAILURE - >; - [CodeEnum.G_OPERATION_GC_START]: RawEvent< - typeof CodeEnum.G_OPERATION_GC_START - >; - [CodeEnum.G_OPERATION_GC_COMPLETE]: RawEvent< - typeof CodeEnum.G_OPERATION_GC_COMPLETE - >; - [CodeEnum.G_OPERATION_GC_FAILURE]: RawEvent< - typeof CodeEnum.G_OPERATION_GC_FAILURE - >; - [CodeEnum.G_OPERATION_INSTALL_START]: RawEvent< - typeof CodeEnum.G_OPERATION_INSTALL_START, - HasCluster - >; - [CodeEnum.G_OPERATION_INSTALL_COMPLETE]: RawEvent< - typeof CodeEnum.G_OPERATION_INSTALL_COMPLETE, - HasCluster - >; - [CodeEnum.G_OPERATION_INSTALL_FAILURE]: RawEvent< - typeof CodeEnum.G_OPERATION_INSTALL_FAILURE, - HasCluster - >; - [CodeEnum.G_OPERATION_SHRINK_START]: RawEvent< - typeof CodeEnum.G_OPERATION_SHRINK_START, - { - hostname: string; - ip: string; - role: string; - } - >; - [CodeEnum.G_OPERATION_SHRINK_COMPLETE]: RawEvent< - typeof CodeEnum.G_OPERATION_SHRINK_COMPLETE, - { - hostname: string; - ip: string; - role: string; - } - >; - [CodeEnum.G_OPERATION_SHRINK_FAILURE]: RawEvent< - typeof CodeEnum.G_OPERATION_SHRINK_FAILURE, - { - hostname: string; - ip: string; - role: string; - } - >; - [CodeEnum.G_OPERATION_UNINSTALL_START]: RawEvent< - typeof CodeEnum.G_OPERATION_UNINSTALL_START - >; - [CodeEnum.G_OPERATION_UNINSTALL_COMPLETE]: RawEvent< - typeof CodeEnum.G_OPERATION_UNINSTALL_COMPLETE - >; - [CodeEnum.G_OPERATION_UNINSTALL_FAILURE]: RawEvent< - typeof CodeEnum.G_OPERATION_UNINSTALL_FAILURE - >; - [CodeEnum.G_OPERATION_UPDATE_COMPLETE]: RawEvent< - typeof CodeEnum.G_OPERATION_UPDATE_COMPLETE, - { - version: string; - } - >; - [CodeEnum.G_OPERATION_UPDATE_FAILURE]: RawEvent< - typeof CodeEnum.G_OPERATION_UPDATE_FAILURE, - { - version: string; - } - >; - [CodeEnum.G_OPERATION_UPDATE_START]: RawEvent< - typeof CodeEnum.G_OPERATION_UPDATE_START, - { - version: string; - } - >; [CodeEnum.PORTFORWARD]: RawEvent; [CodeEnum.PORTFORWARD_FAILURE]: RawEvent< typeof CodeEnum.PORTFORWARD_FAILURE, @@ -334,26 +113,12 @@ export type RawEvents = { error: string; } >; - [CodeEnum.G_REMOTE_SUPPORT_ENABLED]: RawEvent< - typeof CodeEnum.G_REMOTE_SUPPORT_ENABLED, - HasHub - >; - [CodeEnum.G_REMOTE_SUPPORT_DISABLED]: RawEvent< - typeof CodeEnum.G_REMOTE_SUPPORT_DISABLED, - HasHub - >; [CodeEnum.SAML_CONNECTOR_CREATED]: RawEventConnector< typeof CodeEnum.SAML_CONNECTOR_CREATED >; [CodeEnum.SAML_CONNECTOR_DELETED]: RawEventConnector< typeof CodeEnum.SAML_CONNECTOR_DELETED >; - [CodeEnum.G_SAML_CONNECTOR_CREATED]: RawEventConnector< - typeof CodeEnum.G_SAML_CONNECTOR_CREATED - >; - [CodeEnum.G_SAML_CONNECTOR_DELETED]: RawEventConnector< - typeof CodeEnum.G_SAML_CONNECTOR_DELETED - >; [CodeEnum.SCP_DOWNLOAD]: RawEvent< typeof CodeEnum.SCP_DOWNLOAD, { @@ -406,6 +171,8 @@ export type RawEvents = { participants?: string[]; server_hostname: string; interactive: boolean; + proto: string; + kubernetes_cluster: string; } >; [CodeEnum.SESSION_LEAVE]: RawEvent< @@ -442,12 +209,6 @@ export type RawEvents = { typeof CodeEnum.APP_SESSION_CHUNK, { sid: string } >; - [CodeEnum.G_SMTPCONFIG_CREATED]: RawEvent< - typeof CodeEnum.G_SMTPCONFIG_CREATED - >; - [CodeEnum.G_SMTPCONFIG_DELETED]: RawEvent< - typeof CodeEnum.G_SMTPCONFIG_DELETED - >; [CodeEnum.SUBSYSTEM]: RawEvent< typeof CodeEnum.SUBSYSTEM, { @@ -465,40 +226,6 @@ export type RawEvents = { typeof CodeEnum.TERMINAL_RESIZE, { sid: string } >; - [CodeEnum.G_TLSKEYPAIR_CREATED]: RawEvent< - typeof CodeEnum.G_TLSKEYPAIR_CREATED - >; - [CodeEnum.G_TLSKEYPAIR_DELETED]: RawEvent< - typeof CodeEnum.G_TLSKEYPAIR_DELETED - >; - [CodeEnum.G_TOKEN_CREATED]: RawEvent< - typeof CodeEnum.G_TOKEN_CREATED, - { - owner: string; - } - >; - [CodeEnum.G_TOKEN_DELETED]: RawEvent< - typeof CodeEnum.G_TOKEN_DELETED, - { - owner: string; - } - >; - [CodeEnum.G_UPDATES_ENABLED]: RawEvent< - typeof CodeEnum.G_UPDATES_ENABLED, - HasHub - >; - [CodeEnum.G_UPDATES_DISABLED]: RawEvent< - typeof CodeEnum.G_UPDATES_DISABLED, - HasHub - >; - [CodeEnum.G_UPDATES_DOWNLOADED]: RawEvent< - typeof CodeEnum.G_UPDATES_DOWNLOADED, - { - hub: string; - name: string; - version: string; - } - >; [CodeEnum.USER_CREATED]: RawEventUser; [CodeEnum.USER_DELETED]: RawEventUser; [CodeEnum.USER_UPDATED]: RawEventUser; @@ -509,15 +236,6 @@ export type RawEvents = { [CodeEnum.RESET_PASSWORD_TOKEN_CREATED]: RawEventPasswordToken< typeof CodeEnum.RESET_PASSWORD_TOKEN_CREATED >; - [CodeEnum.G_USER_CREATED]: RawEvent; - [CodeEnum.G_USER_DELETED]: RawEvent; - [CodeEnum.G_USER_INVITE_CREATED]: RawEvent< - typeof CodeEnum.G_USER_INVITE_CREATED, - { - name: string; - roles: string; - } - >; [CodeEnum.USER_LOCAL_LOGIN]: RawEvent; [CodeEnum.USER_LOCAL_LOGINFAILURE]: RawEvent< typeof CodeEnum.USER_LOCAL_LOGINFAILURE, @@ -534,8 +252,6 @@ export type RawEvents = { >; [CodeEnum.ROLE_CREATED]: RawEvent; [CodeEnum.ROLE_DELETED]: RawEvent; - [CodeEnum.G_ROLE_CREATED]: RawEvent; - [CodeEnum.G_ROLE_DELETED]: RawEvent; [CodeEnum.TRUSTED_CLUSTER_TOKEN_CREATED]: RawEvent< typeof CodeEnum.TRUSTED_CLUSTER_TOKEN_CREATED >; @@ -551,6 +267,12 @@ export type RawEvents = { name: string; } >; + [CodeEnum.KUBE_REQUEST]: RawEvent< + typeof CodeEnum.KUBE_REQUEST, + { + kubernetes_cluster: string; + } + >; }; /** @@ -562,14 +284,6 @@ type HasName = { name: string; }; -type HasHub = { - hub: string; -}; - -type HasCluster = { - cluster: string; -}; - /** * Merges properties of 2 types and returns a new "clean" type (using "infer") */ @@ -661,13 +375,6 @@ type RawEventAccess = RawEvent< } >; -type RawEventAlert = RawEvent< - T, - { - name: string; - } ->; - type RawEventPasswordToken = RawEvent< T, { @@ -691,15 +398,6 @@ type RawEventConnector = RawEvent< } >; -type RawEventApplication = RawEvent< - T, - { - releaseName: string; - name: string; - version: string; - } ->; - type RawEventAuthFailure = RawEvent< T, { @@ -707,15 +405,6 @@ type RawEventAuthFailure = RawEvent< } >; -type RawEventOperation = RawEvent< - T, - { - hostname: string; - ip: string; - role: string; - } ->; - /** * A map of event formatters that provide short and long description */