Hi there,
is it possible to include the iam user name in the role session name when assuming a role? This way, k8s api logs would include the original IAM user name in the k8s api logs, along with the session name. Currently, only the session name is included, which appears to be an arbitrary number that needs to be mapped with the AssumeRole events in CloudTrail.
For example, my aws-auth contains the following role mapping:
- rolearn: arn:aws:iam::123123123123:role/dev1-role
username: dev1-{{SessionName}}
groups:
- dev1-role
This leads to log events with user.username fields like dev1-123456789123456789.
Instead, I suggest session names that session names are set in a way that usernames loke like this dev1-JaneDoe-123456789123456789. This allows to query for all logs where user.username like "-JaneDoe-".
I believe basically this would have to be changed in token.go
userIDParts := strings.Split(*resp.UserId, ":")
if len(userIDParts) == 2 {
sessionSetters = append(sessionSetters, func(provider *stscreds.AssumeRoleProvider) {
provider.RoleSessionName = userIDParts[1]
})
}
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle rotten
+1
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
@fejta-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue with/reopen.
Mark the issue as fresh with/remove-lifecycle rotten.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
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.
+1.
Right now, a aws-auth entry like:
- rolearn: arn:aws:iam::xxxx:role/developer-user-role
username: developer:{{SessionName}}
groups:
- developers
Produces logs:
failed to query namespace "kube-system" from k8s API: namespaces "kube-system" is forbidden: User "developer:EKSGetTokenAuth" cannot get resource "namespaces" in API group "" in the namespace "kube-system"
Being able to use more data would be helpful here.
@ironhalik: You can't reopen an issue/PR unless you authored it or you are a collaborator.
In response to this:
/reopen
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.
When using federated users, the following setting seems to provide some of the need expressed by this issue:
https://github.com/kubernetes-sigs/aws-iam-authenticator#note-for-federated-users
Most helpful comment
+1