-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Using oauth2_proxy with nginx k8s ingress #558
Comments
There is an example in the ingress-nginx repository using external auth: https://github.com/kubernetes/ingress-nginx/tree/master/docs/examples/external-auth |
To get deep linking to work I needed to add this patch, it is hacky as the nginx ingress does not encode the query pairs properly:
|
What exactly nginx does, and what it should do? Do you have an example? |
The nginx ingress controller requests auth using this statement: |
https://github.com/openresty/set-misc-nginx-module#set_escape_uri Can we use something like this? |
Also I've tried your patched and it didn't help |
My ingress setup look like this:
where auto-proxy-v1 is a service that exposes the oauth2-proxy instance. I will look at what is needed to get redirect to work if the oauth2-proxy is exposed on a separate external hostname to avoid having two ingresses for all exposed services. But that requires some more changes to the oauth2-proxy code it seems. |
EDIT: Deleted, since I misunderstood how cookies work. TIL |
Having the same issue. When trying to login using github I end up in a loop to login. If I go to URL/oauth2/sign_in without the ?rd=URL nginx attaches the login works fine. |
I have a working setup. Only thing is the nginx we are using is 0.9.0. |
@KaustubhKhati You'r DA MAN ! I'm on this since a long time now ... finally it's working by replacing Tested on the last Nginx Ingress controller version 0.12.0. |
Anyone who might want to protect multiple domains with github and oauth2_proxy, nginx config file has to be modified. But since i didnt have time i wrote a small NodeJS app with a static file that will help around the problem. https://github.com/KaustubhKhati/oauth2_node_proxy |
Has anyone encountered an issue where the authentication works just fine(based on the oauth2_proxy logs), but the ingress controller still denies access with a 403? It doesn't make any sense, I feel like I have tried literally everything(including the configs provided by @KaustubhKhati) and the outcome is still the same. |
@AquaZ Can you post your Oauth2_proxy Deployment YAML. For me it was the cookie domain |
@KaustubhKhati |
Anybody tried to check if |
@theobolo : setting If you want to go to Indeed, if I summarize for everyone:
With Hope that helps |
Hi! I noticed a few months ago that I was required to use Nginx None of the versions greater than this mentioned beta are working. It's written at the top of the Helm chart https://github.com/helm/charts/tree/master/stable/oauth2-proxy#oauth2-proxy . I was wondering if you succeeded in using a more recent Nginx image... ? I just tried with 0.19.0 , 0.18.0 and v0.9.0-beta.12 but it still doesn't work. Maybe I need to use another OAuth2 proxy image? Thank you, |
@sneko check a few post above 'theobolo' mentioned he was able to do it with 0.12.0. try building your own image or use https://hub.docker.com/r/colemickens/oauth2_proxy/ |
kubernetes nginx controller supports external auth via:
https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/annotations.md#external-authentication
However, I'm not sure how can I use it since I'm a beginner regarding nginx and k8s nginx controller.
The text was updated successfully, but these errors were encountered: