-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
“unable to create provider: oidc: issuer did not match the issuer returned by provider” with keycloak idp #25024
Comments
I've just hit the same problem as well when deploying to docker desktop. I can't connect to keycloak using the public host name as that keeps getting resolved to 127.0.0.1. As above, I set the oidc_discovery_url to the internal host name but I get the miss match issuer error message |
quick update on this issue. i'm in contact with hashicorp support. What we've established so far:
|
I encountered an issue where Vault needed to resolve the Keycloak domain (keycloak.example.com) to an internal IP, but the domain points to an external IP. Here's how I solved it:
|
Were you able to get support on this? Would you be willing to share the ticket ID with me? You can email it to me, my full name at hashicorp dot com. Thanks! |
It is a solution indeed thanks for your input. We are deployed on VM so we could simply override the DNS resolution through /etc/hosts. However, if the keycloak IP changes then we need to think of changing this configuration too. It is not the ideal solution |
Still waiting for support on this... Sent the ticket id to you by email, thanks for your interest in this issue. |
Describe the bug
When configuring a
jwt_auth_backend
in vault with a provider that vault reaches through a different URL than theissuer
URL, vault fails withunable to create provider: oidc: issuer did not match the issuer returned by provider
To Reproduce
When configuring vault with keycloak IPD so that keycloak authenticates vault users through oidc, we have a problem with a verification that vault makes on the issuer field.
We have a specific setup with keycloak:
With this setup, keycloak considers the issuer as a frontend element: in the .well-known/openid-configuration discovery URL, the
issuer
field ishttps://<frontend-keycloak-hostname>/auth/realms/myrealm
Upon initializing the oidc configuration (when building the auth backend), vault makes a verification about the issuer that makes the process fail : it seems that vault is trying to guess what the issuer should be by concatenating
https://<backend-keycloak-hostname>
/auth/realms/myrealm
We can see in vault logs:
The assumption that the
issuer
must have the same hostname as theoidc_discovery_url
address is incorrect when the idp can be reached from different URLS.The error appears even when
bound_issuer
is configured in the auth backend. Vault could simply compare the value ofbound_issuer
with theissuer
given by the discovery URL in that case rather than assuming what theissuer
hostname should be.Setup:
vault (terraform)
keycloak:
KC_HOSTNAME_STRICT=false
: backend urls are built based on the requestKC_HOSTNAME_URL=https://<frontend-keycloak-hostname>/auth
: The front-end url is forced in keycloak with so that end users are not redirected to the backend URLWith this setup, accessing to
https://<backend-keycloak-hostname>/auth/realm/myrealm/.well-known/openid-configuration
displays the issuer ashttps://<frontend-keycloak-hostname>/auth/realm/myrealm
Issue could be circumvented by making vault access keycloak through the public URL
https://<frontend-keycloak-hostname>
but it’s not what we want to do from a network point of view.Another solution would be to not use the discovery URL but
jwks_url
instead but that doesn't seem to be working at the moment: seeFYI related discussions on keycloak side:
Expected behavior
Vault should be able to log users authenticated through keycloak using oidc
Environment:
Additional context
The text was updated successfully, but these errors were encountered: