Add client metadata to PostgreSQL database session start event#50711
Merged
gabrielcorado merged 3 commits intomasterfrom Jan 6, 2025
Merged
Add client metadata to PostgreSQL database session start event#50711gabrielcorado merged 3 commits intomasterfrom
gabrielcorado merged 3 commits intomasterfrom
Conversation
greedy52
approved these changes
Jan 6, 2025
rosstimothy
reviewed
Jan 6, 2025
Comment on lines
+189
to
+191
| // Params contains parameters used during the session. This can hold, for | ||
| // example, PostgreSQL runtime parameters. | ||
| Params map[string]string |
Contributor
There was a problem hiding this comment.
This seems a bit generic for something that looks to only be for passing around an application name. Could we perhaps add a dedicated user agent field and punt runtime parameters to a future, more scoped PR that actually makes use of them in some meaningful way?
rosstimothy
approved these changes
Jan 6, 2025
|
@gabrielcorado See the table below for backport results.
|
gabrielcorado
added a commit
that referenced
this pull request
Jan 6, 2025
* feat: add client metadata to database session start event * refactor(test): update option to WithUserAgent
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jan 7, 2025
… (#50806) * feat: add client metadata to database session start event * refactor(test): update option to WithUserAgent
carloscastrojumo
pushed a commit
to carloscastrojumo/teleport
that referenced
this pull request
Feb 19, 2025
…tational#50711) * feat: add client metadata to database session start event * refactor(test): update option to WithUserAgent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #46810
Adds a new field to the database session start audit event to include client metadata (user agent). This is the field/flow used by other events, such as login and session recording access.
Motivation: Identify which client (user agent) was used to connect to the database in the audit. In addition, we'll also add this field to Prehog so we can track and analyze clients' usage, including the new Web UI client (
teleport-repl).New event (some fields were omitted):
{ "cluster_name": "root.teleport.dev", "code": "TDB00I", "db_name": "postgres", "db_origin": "config-file", "db_protocol": "postgres", "db_service": "pg", "db_type": "self-hosted", "db_uri": "localhost:5432", "db_user": "postgres", "event": "db.session.start", "sid": "4eabbc56-1563-48b8-a637-92e2afbeb15d", "success": true, "user": "alice", + "user_agent": "teleport-repl", "user_kind": 1 }changelog: Add
user_agentfield todb.session.startaudit events.