-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add Azure Workload Identity support for certificate credentials #2364
Conversation
Hey @tuunit . Looks like mentioned PR indeed allows me to use certificate credentials instead of secret for generic OIDC (Azure is OIDC compliant) so I would say - theoretically yes, however I couldn't test it due to But even if we could get #2305 working as expected, there is still an important reason to use Azure provider instead of OIDC, that is: Limit of 200 groups inside JWT. So in this corner case, we cannot fully rely on reading groups from the JWT claims, and need to call Graph API. Another (less important) reason could be a configuration experience for AKS users. |
Hi @jjlakis, it would be amazing if we could explore what would be necessary to get the https://github.com/oauth2-proxy/oauth2-proxy/blob/master/providers/keycloak_oidc.go#L24-L26 My hope is that we can generalize the logic even more and reduce the complexity inside the provider specific files. Overall this is a broader topic and doesn't only concern the Azure provider. |
Hey @tuunit , so let me dig into this topic deeper then 💪 . I see you will be taking over the client assertion changes in the OIDC provider, that's lovely 👌 |
Description
This pull request enables Workload Identity for Azure provider.
Instead of
client_secret
, the token exchange request includes a certificate credential parameters. Certificate credential is a JWT token, which claims has to match a corresponding Federated Identity Credential added to the App Registration.Azure Workload Identity Webhook Server running on the Kubernetes cluster, mutates the properly annotated pod and mounts the federated token in the default path stored in
$AZURE_FEDERATED_TOKEN_FILE
. Webhook server can be installed easily on AKS as well as elsewhere. See documentation of Azure Workload Identity.New flag is added: -
--azure-federated-token-auth-enabled
. When set, oauth2-proxy does not require theclient-secret
setting anymore. Instead, it expectsoauth2-proxy
to run in a pod mutated by Azure Workload Identity Webhook Server.oauth2-proxy
won't start if the flag is enabled but pod isn't properly configured.This change allows user to not store plain secrets on Kubernetes / GitOps repositories.
This is a revisited version of #2070, however this PR does include only the certificate credential changes and does not include any changes regarding reading user groups.
Motivation and Context
Currently, oauth2-proxy needs to have hardcoded secret configured, which causes security issues and requires maintenance like secret rotation. This PR closes #1979 .
How Has This Been Tested?
This was tested on on-premises cluster with Azure's workload-identity-webhook helm chart installed. Cluster has OIDC endpoint publicly available. App registration used for testing:
Values for oauth2-proxy helm chart (installed in
oauth2-proxy
namespace):Traefik middleware:
And ingress annotation for protected service:
TODO: