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

Enrich audit events with server information #48475

Merged
merged 1 commit into from
Nov 12, 2024
Merged

Conversation

rosstimothy
Copy link
Contributor

@rosstimothy rosstimothy commented Nov 5, 2024

Subsystem events did not include ServerMetadata, which results in any events generated for agentless hosts to contain limited information. For example, any sftp subsystem requests made in response to tsh scp for agentless nodes provided information about the proxy forwarding the requests, but no information about the target host.

Additionally, the way ServerMetadata information was being populated by using the ServerContext overrode only a subset of the information that was available. This lead to SessionData events emitted when an sftp operation was completed not populating any relevant information about agentless nodes either. To avoid this going forward, the GetServerMetadata receiver has been removed from ServerContext and instead the TargetMetadata must be used from the appropriate SSH server, which already populates the relevant information without omitting any.

Events prior to this change
{
  "addr.local": "127.0.0.1:50133",
  "addr.remote": "127.0.0.1:2022",
  "cluster_name": "local.dev",
  "code": "T3001I",
  "ei": 0,
  "event": "subsystem",
  "exitError": "",
  "login": "tim",
  "name": "sftp",
  "server_id": "",
  "time": "2024-11-05T17:22:44.192Z",
  "uid": "1b5e837d-5d4e-48e9-a0d7-e3b34167fe78",
  "user": "tim",
  "user_kind": 1
}
{
  "addr.local": "127.0.0.1:2022",
  "addr.remote": "127.0.0.1:50153",
  "cluster_name": "local.dev",
  "code": "T2006I",
  "ei": 2147483646,
  "event": "session.data",
  "login": "tim",
  "namespace": "default",
  "private_key_policy": "none",
  "rx": 5156,
  "server_id": "8fb5ba65-2479-4b0e-bc5d-96955af50ee7",
  "server_version": "17.0.0-alpha.4",
  "sid": "f9d4469c-a05a-4a06-8ba7-25fd0c14ab0c",
  "time": "2024-11-05T17:24:08.713Z",
  "tx": 6040,
  "uid": "5828657f-4b47-42de-876e-fd62576381e0",
  "user": "tim",
  "user_kind": 1
}
Events with this change
{
  "addr.local": "127.0.0.1:50759",
  "addr.remote": "127.0.0.1:2022",
  "cluster_name": "local.dev",
  "code": "T3001I",
  "ei": 0,
  "event": "subsystem",
  "exitError": "",
  "forwarded_by": "8fb5ba65-2479-4b0e-bc5d-96955af50ee7",
  "login": "tim",
  "name": "sftp",
  "namespace": "default",
  "server_addr": "127.0.0.1:2022",
  "server_hostname": "telebook",
  "server_id": "d481570f-955b-4ab4-a554-72a08a21e1be.local.dev",
  "server_sub_kind": "openssh",
  "server_version": "17.0.0-dev",
  "time": "2024-11-05T18:55:41.109Z",
  "uid": "cc7848f3-4be8-48ec-880d-305978ac9c63",
  "user": "tim",
  "user_kind": 1
}
{
  "addr.local": "127.0.0.1:2022",
  "addr.remote": "127.0.0.1:50756",
  "cluster_name": "local.dev",
  "code": "T2006I",
  "ei": 2147483646,
  "event": "session.data",
  "forwarded_by": "8fb5ba65-2479-4b0e-bc5d-96955af50ee7",
  "login": "tim",
  "namespace": "default",
  "private_key_policy": "none",
  "rx": 5156,
  "server_addr": "127.0.0.1:2022",
  "server_hostname": "telebook",
  "server_id": "d481570f-955b-4ab4-a554-72a08a21e1be.local.dev",
  "server_sub_kind": "openssh",
  "server_version": "17.0.0-dev",
  "sid": "46f91ee6-a104-424f-8e49-6893caebc3f4",
  "time": "2024-11-05T18:55:41.115Z",
  "tx": 6040,
  "uid": "3c4e5d54-52c6-458c-b4d8-178ad61c28c6",
  "user": "tim",
  "user_kind": 1
}

Changelog: Ensure that agentless server information is provided in all audit events

Subsystem events did not include ServerMetadata, which results in
any events generated for agentless hosts to contain limited
information. For example, any sftp subsystem requests made in
response to tsh scp for agentless nodes provided information about
the proxy forwarding the requests, but no information about the
target host.

Additionally, the way ServerMetadata information was being populated
by using the ServerContext overrode only a subset of the information
that was available. This lead to SessionData events emitted when
an sftp operation was completed not populating any relevant information
about agentless nodes either. To avoid this going forward, the
GetServerMetadata receiver has been removed from ServerContext and
instead the TargetMetadata must be used from the appropriate SSH
server, which already populates the relevant information without
omitting any.
@rosstimothy rosstimothy force-pushed the tross/server_metadata branch from 5d23716 to 27af0fb Compare November 5, 2024 21:16
@rosstimothy rosstimothy marked this pull request as ready for review November 5, 2024 23:13
@github-actions github-actions bot requested review from hugoShaka and rudream November 5, 2024 23:13
@github-actions github-actions bot added audit-log Issues related to Teleports Audit Log size/sm labels Nov 5, 2024
@rosstimothy rosstimothy requested a review from Joerger November 7, 2024 17:57
@rosstimothy
Copy link
Contributor Author

Friendly ping @rudream @Joerger

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from rudream November 12, 2024 18:07
@rosstimothy rosstimothy added this pull request to the merge queue Nov 12, 2024
Merged via the queue into master with commit 1f94d93 Nov 12, 2024
45 checks passed
@rosstimothy rosstimothy deleted the tross/server_metadata branch November 12, 2024 18:25
@public-teleport-github-review-bot

@rosstimothy See the table below for backport results.

Branch Result
branch/v15 Failed
branch/v16 Failed
branch/v17 Create PR

rosstimothy added a commit that referenced this pull request Nov 12, 2024
Subsystem events did not include ServerMetadata, which results in
any events generated for agentless hosts to contain limited
information. For example, any sftp subsystem requests made in
response to tsh scp for agentless nodes provided information about
the proxy forwarding the requests, but no information about the
target host.

Additionally, the way ServerMetadata information was being populated
by using the ServerContext overrode only a subset of the information
that was available. This lead to SessionData events emitted when
an sftp operation was completed not populating any relevant information
about agentless nodes either. To avoid this going forward, the
GetServerMetadata receiver has been removed from ServerContext and
instead the TargetMetadata must be used from the appropriate SSH
server, which already populates the relevant information without
omitting any.
rosstimothy added a commit that referenced this pull request Nov 12, 2024
Subsystem events did not include ServerMetadata, which results in
any events generated for agentless hosts to contain limited
information. For example, any sftp subsystem requests made in
response to tsh scp for agentless nodes provided information about
the proxy forwarding the requests, but no information about the
target host.

Additionally, the way ServerMetadata information was being populated
by using the ServerContext overrode only a subset of the information
that was available. This lead to SessionData events emitted when
an sftp operation was completed not populating any relevant information
about agentless nodes either. To avoid this going forward, the
GetServerMetadata receiver has been removed from ServerContext and
instead the TargetMetadata must be used from the appropriate SSH
server, which already populates the relevant information without
omitting any.
github-merge-queue bot pushed a commit that referenced this pull request Nov 13, 2024
Subsystem events did not include ServerMetadata, which results in
any events generated for agentless hosts to contain limited
information. For example, any sftp subsystem requests made in
response to tsh scp for agentless nodes provided information about
the proxy forwarding the requests, but no information about the
target host.

Additionally, the way ServerMetadata information was being populated
by using the ServerContext overrode only a subset of the information
that was available. This lead to SessionData events emitted when
an sftp operation was completed not populating any relevant information
about agentless nodes either. To avoid this going forward, the
GetServerMetadata receiver has been removed from ServerContext and
instead the TargetMetadata must be used from the appropriate SSH
server, which already populates the relevant information without
omitting any.
github-merge-queue bot pushed a commit that referenced this pull request Nov 13, 2024
Subsystem events did not include ServerMetadata, which results in
any events generated for agentless hosts to contain limited
information. For example, any sftp subsystem requests made in
response to tsh scp for agentless nodes provided information about
the proxy forwarding the requests, but no information about the
target host.

Additionally, the way ServerMetadata information was being populated
by using the ServerContext overrode only a subset of the information
that was available. This lead to SessionData events emitted when
an sftp operation was completed not populating any relevant information
about agentless nodes either. To avoid this going forward, the
GetServerMetadata receiver has been removed from ServerContext and
instead the TargetMetadata must be used from the appropriate SSH
server, which already populates the relevant information without
omitting any.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants