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
Describe ingress setup for dynamic callback urls #109
Comments
|
I'm encountering the same problem, after successful oauth2 workflow the final URL is the oauth2-proxy URL, not the kubernetes dashboard ingress (trying to follow: https://thenewstack.io/single-sign-on-for-kubernetes-dashboard-experience/) |
|
you need to publish dashboard service on http not on https, this is how it worked for me.. after going through lot of blogs and forum, what i understood is.. oauth2 proxy do not understand how to pass token via header when dashboard is using selfsign certificate... your upstream will be dashboard service url http://kubernetes-dashboard.kube-system.svc.cluster.local.. if you still wish to ssl your dashboard.. you may use san certificate for oauth2 and set them up on ingress level to handle it properly. |
|
Hello everyone! Have the same idea. I want to have a domain like oauth.example.com, not specified path (/oauth2) for every Ingress I want to auth using oauth. Tried to explore something about X-Auth-Request-Redirect, but it didn't help. The main idea to set up the final redirect to the service requested OAuth in the start (for my case this is Kibana). |
|
Hi @elsesiy, I've had a look through your config and have two suggestions that might help, First off, make sure to set your cookie domain, it should be the parent domain off all subdomains you are protecting and I think it needs to include the OAuth2_Proxy as well, are your Authentication and protected service on the same parent domain? (eg Secondly, in your redirect, try adding the scheme to the beginning of the request, if you are Let me know how you get on! 😄 |
|
@JoelSpeed Works flawlessly now, thanks. The missing piece was the |
It really really does, but sadly no one has had time to do so yet |
|
@elsesiy it would be great, if you were able to describe it! |
|
i am also facing same challange, please let me know if there is any way available to add if(condition to ensure authentication is done) { rewrite URL} with below example to solve this https://kubernetes.github.io/ingress-nginx/examples/rewrite/#examples rather than nginx sidecar - https://www.callumpember.com/Kubernetes-A-Single-OAuth2-Proxy-For-Multiple-Ingresses/ This is my non working setting, where i am looking for condition to confirm authentication before redirect. with above setting, it redirect before authentication itself. Looking for : rewrite if(Authenticated) {/redirect/?(.*) https://$1 break}; |
|
@JoelSpeed @okgolove OK, I can create a PR. Shall I just add to the |
|
Until @JoelSpeed decides where to contribute, I published a blog post for now. |
|
@JoelSpeed comment should work for most people. setting cookie-domain does the trick. eg : whitelist-domain: .example.com This fixes the invalid redirects after the first login. scenario 1: go to app.example.com without cookies => you will need to login scenario 2: go to app.example.com with cookies ( you already logged in before )
|
|
I added |
|
The suggested solution |
|
Did someone try this scheme with Keycloak? |
|
Also curious if anyone got this working for GitLab? In my case, the redirect to GitLab works fine, but GitLab redirects to the base oauth2_proxy URL (https://oauth2.mycompany.com/) instead of following the redirect Any ideas? |
|
Nevermind, solved it. It was the |
|
Does anyone know how to redirect it to a host:port? My prometheus ingress: nginx.ingress.kubernetes.io/auth-url: https://oauth2-qa.staging.com:9043/oauth2/auth My |
|
@Swetad90 As far as I'm aware, the code that deals with the whitelists doesn't account for ports, maybe you could submit a PR to add it? |
|
@JoelSpeed I need a help please.. my oauth2 proxy config looks good, I get the login page , when I try to login it lets me in to the landing page as that is the flow for it but with access request module. My issue is the username I used it comes back appended like this "{Email:username@abc.com}" so my username looks like as if it has "email:" added to it. |
How are you retrieving this email from the proxy? There are various ways you can get the information like this out. Also, could you please open a new issue so we don't pollute this one, this seems like a separate problem |
|
@JoelSpeed I will do the needful, in the mean time is there any best practices I can follow please let me know. We are on a critical path so was asking.. can you please point out what you meant "There are various ways you can get the information like this out". |
|
@aseemmishra25 I was referring more to this comment from yourself
How did you read that value? Was it set in a header? If so which header? Also, does your OAuth2 Proxy directly proxy requests to upstream services or do you use it in the Nginx auth request style deployment? |
|
I'm banging my head on this and I can't make redirect work. I have: Service: svc.sub.domain.com auth-signin: https://oauth2-proxy.services.sub.domain.com/oauth2/start?rd=https://$host$request_uri cookie_domain = ".domain.com" I've also tried different combinations for whitelist_domain: Even tried to provide a list as: But nothing works and I'm still redirected to https://oauth2-proxy.services.sub.domain.com/ Can anyone suggest any ideas where I'm wrong? |
|
Figured out that the problem is the wrong parameter name. "whitelist_domains" in config and "whitelist-domain" as a flag. The documentation states only about cli options. |
This behavior is documented...
PS. I've also set with the wrong variable name and reached this issue :) |
|
Oops, you were talking about config file, not environment variables. |
|
This issue has been inactive for 60 days. If the issue is still relevant please comment to re-activate the issue. If no action is taken within 7 days, the issue will be marked closed. |
|
This thread has been closed for a while but I'm experiencing a 404 on my redirect. Here is my HelmRelease I have my ingress with the following annotations: I login to Github as expected, but the redirect just 404's I've done the recommendations as mentioned above but to no avail, would love any thoughts on what I might be missing? In my oauth2-proxy pod logs I can see the following: |
|
@xUnholy is there a reason you have "rd=$escaped_request_uri"? maybe it should be something else? |
|
@messiahUA that was what they showed in the docs |
|
@xUnholy I had the same issue while using nginx.ingress.kubernetes.io/auth-signin: "https://example.com/oauth2/start?rd=https://$host$request_uri" |
|
@JoelSpeed I'm facing one error. I have configured the domain abc.test.com and when I authenticate I get the error "AADSTS500111: The reply uri specified in the request has an invalid scheme." |
|
Please ensure you set the |
That is because in the documentation you are referring to is showcasing a scenario where same fqdn is used for both oauth and for service ingresses. It is different in your case.
Almost exactly my issue as well, thanks. |
Hi @JoelSpeed,
I'm facing the same issue described in #12 and have been trying to get the described setup working but the redirect to the downstream ingress doesn't work. Do you have some more documentation on how this exactly should look like?
Here's what I did:
By now browsing
https://login.mydomain.com/oauth2/sign_inworks as expected.Browsing
https://service.mydomain.comnow correctly redirects me to the Microsoft Login but still showshttps://login.mydomain.com/oauth2/callbackas the redirect_uri which then after successful authentication falls back todefault-backend.What am I missing?
Thanks a lot!!
The text was updated successfully, but these errors were encountered: