Skip to content

[v18] identity activity center: Backport EKS audit logs#61651

Merged
camscale merged 12 commits intobranch/v18from
camh/v18/eks-audit-logs
Nov 24, 2025
Merged

[v18] identity activity center: Backport EKS audit logs#61651
camscale merged 12 commits intobranch/v18from
camh/v18/eks-audit-logs

Conversation

@camscale
Copy link
Contributor

@camscale camscale commented Nov 21, 2025

Backport the PRs for implementing EKS audit logs fetching and sending to access
graph for Identity Activity Center. This set of commits:

  • Adds an RPC method to the grpc AccessGraphService
  • Extends protobuf types for configuring Access Graph
  • Extends file configuration for configuring the new feature
  • Extends AWS sync discovery to discover EKS cluster for fetching logs
  • Adds a watcher/fetcher for fetching EKS logs and sends to Access Graph
  • Extends integration setup to add IAM permissions for fetching EKS logs from
    CloudWatch Logs

There are other PRs for access graph that implements its side of the feature, as
well as a documentation PR that is not in this backport. It will be backported
separately.

The only conflicts were with the auto-generated commits for the .proto files.
These were resolved by re-running the generation commands.

Also changed were the synctest tests as branch/v18 has Go 1.24 which has
a different synctest API.

Issue: https://github.com/gravitational/access-graph/issues/1589
Backport: #59566
Backport: #59567
Backport: #59568
Backport: #61364

@camscale camscale added the no-changelog Indicates that a PR does not require a changelog entry label Nov 21, 2025
@camscale camscale requested a review from juliaogris November 21, 2025 03:16
@camscale camscale changed the title identity activity center: Backport EKS audit logs [v18] identity activity center: Backport EKS audit logs Nov 21, 2025
@public-teleport-github-review-bot

@camscale - this PR will require admin approval to merge due to its size. Consider breaking it up into a series smaller changes.

@socket-security
Copy link

socket-security bot commented Nov 21, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgolang/​github.com/​aws/​aws-sdk-go-v2/​service/​cloudwatchlogs@​v1.58.998100100100100

View full report

@camscale camscale force-pushed the camh/v18/eks-audit-logs branch from 5e03e52 to 375414c Compare November 21, 2025 04:39
… Graph

Add a `KubeAuditLogsStream()` rpc to the `AccessGraphService` for
streaming Kubernetes apiserver audit logs from the Teleport discovery
service to access graph. This is intended for EKS audit logs which are
made available via CloudWatch, but can accommodate other k8s services.

The audit log messages are represented as a `google.protobuf.Struct` so
as to not depend on the k8s.io .proto files, but also as k8s typically
uses protos internally only - the expectation is that we'll receive the
apiserver audit logs as json-encoded strings. This encode easily as a
`google.protobuf.Struct`.
Generate proto and grpc code for changes to accessgraph/v1alpha1:

    make grpc/host

These changes add the `KubeAuditLogsStream()` rpc and associated types.
Add the `AccessGraphAWSSyncEKSAuditLogs` message used by new field in
`AccessGraphAWSSync` for specifying which EKS clusters should have
apiserver audit logs fetched and sent to Access Graph.
Generate proto code for `AccessGraphAWSSyncEKSAuditLogs` message:

    make grpc/host
    make derive
Extend the static config for Access Graph discovery to be able to
specify the EKS cluster for which apiserver audit logs should be fetched
and sent to Access Graph.
Add a watcher to start fetchers for all access graph EKS clusters that
are configured to have Kubernetes apiserver audit logs fetched and send
them to access graph. It receives the set of clusters to fetch audit
logs for from the AWS resource syncer as it discovers EKS clusters.
Those clusters are reconciled against the current set of log fetchers,
with no-longer-needed fetchers stopped and new fetchers started as
needed.

This commit requires go.mod be updated with:

    go get github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs@latest

It is left out of this commit for now as it makes rebasing/merging
master easier.
Run:

    go get github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs@latest
    make go-mod-tidy-all
    # Manually move the go.mod line back to the first section!?!?

This commit is kept separate for easier merging/rebasing.
Refactor the eksAuditLog{Watcher,Fetcher} and the aws_sync.Fetcher
cloudwatchlogs to be more testable:

* factor away eksAuditLogFetcher from eksAuditLogWatcher. The watcher
  just needs a factory function to create a fetcher, and all the watcher
  needs from that fetcher is a `Run()` method. Lift the cancel func out
  of the watcher and store it directly in the watcher, as only the
  watcher uses it.
* factor away aws_sync.Fetcher from eksAuditLogFetcher. All it needs
  from the sync fetcher it calls is one method to fetch cloudwatch logs.
  Make that an interface and use just that. This allows a fake source of
  cloudwatch logs to be provided for testing. While here, use protobuf
  getters rather than accessing fields directly.
* Use protobuf getters in aws_sync.Fetcher cloudwatchlogs instead of
  accessing fields directly. In future, we could pass in an interface
  with those getters to make the code more testable.
Add tests for `eksAuditLogWatcher` and `eksAuditLogFetcher`. Copy the
grpc stream testing util from the access graph repo into teleport as it
is useful for the bidirectional streaming methods uses by access graph,
and makes it easier to test on the client side.
Update the `teleport configure integration acces-graph aws-iam` command
to add a permission to access EKS audit logs via CloudWatch Logs if the
`--eks-audit-logs` flag is passed. This is necessary so that an
integration can pull the EKS audit logs if so configured in a discovery
access graph matcher.
Extend the web endpoint for the webscript for integrations configure
access-graph-cloud-sync-iam.sh to add the `eksAuditLogs` query param to
configure with EKS audit logs enabled. Add tests for this endpoint as
there were none.
Run `make go-generate` to update the `lib/utils/aws/region/regions.go`
file as something in the backport of EKS audit logs for Identity
Activity Center has changed what would be generated.
@camscale camscale force-pushed the camh/v18/eks-audit-logs branch from 375414c to df0fd8c Compare November 24, 2025 02:27
@camscale camscale added this pull request to the merge queue Nov 24, 2025
Merged via the queue into branch/v18 with commit aa627cb Nov 24, 2025
43 of 45 checks passed
@camscale camscale deleted the camh/v18/eks-audit-logs branch November 24, 2025 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport discovery no-changelog Indicates that a PR does not require a changelog entry size/xl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants