-
Notifications
You must be signed in to change notification settings - Fork 424
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 Logs with additional AWS Identity details (via audit logs' "extra" map) #372
Conversation
Welcome @adrianosela! |
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/cc @wongma7 |
Thanks @adrianosela, it seems reasonable and helpful to have more information in audit logs. |
/lgtm |
/cc @micahhausler |
Will wait for another reviewer before approving. |
makes sense to me. you can map multiple IAM users/roles to the same kubernetes user/group, plus different sessions may make use* of same role. So without this info it is difficult/impossible from audit log to determine i.e. audit what IAM entity actually made a given request. /lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adrianosela, nckturner The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Enrich Audit Logs with additional AWS Identity details (via audit logs' "extra" map)
Purpose
It would be helpful for consumers of Kubernetes Audit logs to be presented with all available information about the identity performing a given action against the k8s api.
The
Identity
struct intoken.go
contains all of:ARN
(string): ARN is the raw Amazon Resource Name returned by sts:GetCallerIdentityCanonicalARN
(string): CanonicalARN is the Amazon Resource Name converted to a more canonical representation. In particular, STS assumed role ARNs like "arn:aws:sts::ACCOUNTID:assumed-role/ROLENAME/SESSIONNAME" are converted to their IAM ARN equivalent "arn:aws:iam::ACCOUNTID:role/NAME"AccountID
(string): AccountID is the 12 digit AWS account number.UserID
(string): UserID is the unique user/role ID (e.g., "AROAAAAAAAAAAAAAAAAAA").SessionName
(string): SessionName is the STS session name (or "" if this is not a session-based identity). For EC2 instance roles, this will be the EC2 instance ID (e.g., "i-0123456789abcdef0"). You should only rely on it if you trust that only EC2 is allowed to assume the IAM Role. If IAM users or other roles are allowed to assume the role, they can provide (nearly) arbitrary strings here.AccessKeyID
(string): The AWS Access Key ID used to authenticate the request. This can be used in conjuction with CloudTrail to determine the identity of the individual if the individual assumed an IAM role before making the request.Everything in the
Identity
struct is now being logged:AccessKeyID
is/was already logged in the extra map.AccountID
andUserID
is/was already logged as theuid
in the audit log.ARN
,CanonicalARN
andSessionName
are newly added to the extra map.Testing
Before this change the helper function tokenReview took only the accesskeyid string as an argument:
tokenReview(username, uid string, groups []string, accesskeyid string) authenticationv1beta1.TokenReview
Now, the function takes in the entire "extra" map as an arg, to verify the newly logged parts of the identity:
tokenReview(username, uid string, groups []string, extrasMap map[string]authenticationv1beta1.ExtraValue) authenticationv1beta1.TokenReview
.Tests were modified to check the whole map and not just one field.