Open oddsund opened 1 year ago
Action required from @Azure/aks-pm
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
@oddsund Thanks for reporting this.
AAD supports 200 groups claim in JWT, refer to doc.
If current user has <= 200 groups, the client token will already contain groups claim. Server side WILL NOT perform additional call to fetch the groups. This helps reducing unnecessary external calls. If current user has > 200 groups, the client token doesn't contain group claim but a claim source URL. Server side will perform additional call to this URL to fetch groups.
For your case, it matches the behavior when user has <= 200 groups, such that server side will use the built-in group token. It is expected behavior to update kubeconfig credential to get the JIT applied.
Thanks for the response @karataliu.
That's fine, but then this doc should be updated to clarify that; https://learn.microsoft.com/en-us/azure/aks/concepts-identity#azure-ad-integration
The docs currently states The server application uses user-provided credentials to query group memberships of the logged-in user from the MS Graph API.
, which is only true for user with > 200 groups.
Not sure if its a bug or wrong documentation.
Describe the bug When updating one of our clusters to use Azure AD authentication with Kubernetes RBAC, the observed behaviour is that the JWT is verified, but no call is done to the MS Graph for group memberships.
According to the following docs; https://learn.microsoft.com/en-us/azure/aks/concepts-identity#azure-ad-integration The JWT should be verified, and then Webhook Token Authentication should be performed to assert current group memberships.
Our specific scenario is using PIM for Groups to elevate access temporarily.
This worked when we were using Azure AD authentication with Azure RBAC, albeit with up to 5 minute delay due to cache TTL and PIM for Azure Role. After the switch however, we have to acquire a new access token with an updated groups claim for the change to be reflected when we call the AKS cluster.
This also means that any group membership is retained for the duration of the token, so a revoked group membership is delayed by 90 minutes in the worst case.
Checking the kubelet config on the nodes also indicates that this should work. The flags
--authentication-token-webhook=true --authorization-mode=Webhook --kubeconfig=/var/lib/kubelet/kubeconfig
are set in/etc/default/kubelet
, and the kubeconfig follows the spec as documented here: https://kubernetes.io/docs/reference/access-authn-authz/webhook/To Reproduce
az aks get-credentials -g <resourcegroup> -n <clustername>
kubectl get pods
to verify accesskubectl get secret supersecret
to verify that access is deniedsupersecret
via (Cluster)RoleBindingkubectl get secret supersecret
. Access is still not grantedkubelogin remove-tokens
kubectl get secret supersecret
again, perform any authentication necessary, and observe that access is grantedExpected behavior Access should be granted already in step 5, just like when using Azure AD authentication with Azure RBAC.
Environment (please complete the following information):