auth: impersonation between provider identities#1088
Open
matheuscscp wants to merge 2 commits intomainfrom
Open
auth: impersonation between provider identities#1088matheuscscp wants to merge 2 commits intomainfrom
matheuscscp wants to merge 2 commits intomainfrom
Conversation
Member
Author
|
Integration tests are passing: |
7dc9b7c to
2460aa6
Compare
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2460aa6 to
c81b73e
Compare
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Member
Author
|
I added integration tests for this feature (f0b372a). All tests are passing: |
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.
The
AssumeRoleandImpersonateAPIs are native AWS and GCP APIs, respectively, that allow for a native identity to impersonate another:The users of these two clouds are very used to these operations, and various opensource projects support performing them. In AWS, for example, AssumeRole is a very common pattern for cross-account access:
fluxcd/flux2#5708
While we do support cross-account access for AWS (docs), the current implementation has limitations.
Azure
Azure does not support this native operation. Impersonation is only supported via OIDC federation, which we already support.
Newly supported AWS use cases
EKS Pod Identity (i.e. controller permissions) calling AssumeRole
EKS Pod Identity only allows same-account IAM Roles to be assigned to EKS pods. But when calling AssumeRole, the target role can belong to any account. Config:
The above ServiceAccount should be used via
.spec.serviceAccountName(or.spec.kubeConfig.configMapRef->.data.serviceAccountName) in Flux resources.The advantage this approach has over this one is that each Flux object can have its own target role to assume. The approach described in this link supports only a single target role that is associated directly with the EKS Pod Identity entry created for the Flux controller pod.
Note: By design, this approach is not supported under workload identity multi-tenancy lockdown. Lockdown isolation is based on Kubernetes namespaces. The impersonation relationship between EKS Pod Identity and a target role has zero namespaces involved, so we can't allow it when lockdown is enabled.
Controller-level IRSA calling AssumeRole
This approach is similar to the above, except that the controller permissions come from IRSA and not EKS Pod Identity. Similarly, this approach is not supported under workload identity multi-tenancy lockdown for the same reason as the above. The ServiceAccount for the Flux object is identical.
Object-level IRSA calling AssumeRole
This is the strongest approach, as it is supported both with and without workload identity multi-tenancy lockdown. Config:
In this approach, we first exchange a ServiceAccount token for AWS creds representing the source account role, then we call AssumeRole for the target account role.
In my personal opinion, nothing beats the simplicity of the first example in this approach, but the EKS Pod Identity fans won't like it 🤷
Newly supported GCP use cases
Controller-level WIF calling Impersonate
In this approach, configure WIF for the Flux controller pod, then use the following ServiceAccount config for Flux objects:
Similarly to the controller-level approaches in AWS, this approach is not supported under workload identity multi-tenancy lockdown.
Object-level WIF calling Impersonate
In this approach, use the following ServiceAccount config for Flux objects: