Skip to content

Emit events in CreateAuditStream for v13 clients#34667

Merged
atburke merged 3 commits intomasterfrom
atburke/session-event-cross-version
Nov 20, 2023
Merged

Emit events in CreateAuditStream for v13 clients#34667
atburke merged 3 commits intomasterfrom
atburke/session-event-cross-version

Conversation

@atburke
Copy link
Copy Markdown
Contributor

@atburke atburke commented Nov 16, 2023

This change fixes a regression where some session events (session.start, session.leave, session.end) were not being emitted when a v13 client is connected to a v14 auth server.

Fixes #34596.

Changelog: Fixed auth server not emitting session events for v13 clients

Comment thread lib/auth/grpcserver.go Outdated
case events.IsPermanentEmitError(err):
g.WithError(err).WithField("event", event).
Error("Failed to EmitAuditEvent due to a permanent error. Event wil be omitted.")
continue
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we return or continue at all?
Will it affect the session recording? Should we log and concurrently record the session to prevent the loss of remaining recordings?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is now, returning the error here matches the behavior of v13. If the RPC exits before all session events have been recorded, the caller will just resume the audit stream and try again.

Comment thread lib/auth/grpcserver.go Outdated
Comment thread lib/auth/grpcserver.go
Comment on lines +366 to 369
err = trace.NewAggregate(errors...)
if err != nil {
switch {
case events.IsPermanentEmitError(err):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to consider the aggregated errors or just the error from recording the event in IsPermanentEmitError?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v13 auth server considers the aggregated errors, so I figured we should do that here too.

@atburke atburke added this pull request to the merge queue Nov 20, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 20, 2023
@atburke atburke added this pull request to the merge queue Nov 20, 2023
Merged via the queue into master with commit cb4d73f Nov 20, 2023
@atburke atburke deleted the atburke/session-event-cross-version branch November 20, 2023 17:52
@public-teleport-github-review-bot
Copy link
Copy Markdown

@atburke See the table below for backport results.

Branch Result
branch/v14 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incomplete Audit Events with Teleport v14.1.1 and v13.x Agents with node-sync session recording mode.

4 participants