-
Notifications
You must be signed in to change notification settings - Fork 8.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
nginx: annotations: authrequest: support "signin url" #190
Conversation
Please add an example of how to use this here: https://github.com/kubernetes/ingress/tree/master/examples (even if it's not part of a released image yet, please say that in the example and we can update it once 0.9.0 is out) |
controllers/nginx/rootfs/Dockerfile
Outdated
@@ -12,7 +12,7 @@ | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
|
|||
FROM gcr.io/google_containers/nginx-slim:0.13 | |||
FROM gcr.io/google_containers/nginx-slim:0.12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nginx-slim:0.13
is published now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. I've switched back to 0.13
now.
Where am I meant to add an example? It seems like all of the nginx annotation examples got left over and forgotten in I can just move over the |
1943f3f
to
b9d0878
Compare
Rebased. Still seeking clarification about where/how to add the example. |
Yes, please create a directory in examples (https://github.com/kubernetes/ingress/tree/master/examples) called auth, and write a README file describing how to use it, kind of like how we describe tls-termination (https://github.com/kubernetes/ingress/tree/master/examples/tls-termination) |
I already added a section for auth in the example overview, just needs filling in: https://github.com/kubernetes/ingress/tree/master/examples#auth |
@@ -235,6 +235,8 @@ http { | |||
{{ end }} | |||
{{ if not (empty $location.ExternalAuth.Method) }} | |||
proxy_method {{ $location.ExternalAuth.Method }}; | |||
proxy_set_header X-Original-URI $request_uri; | |||
proxy_set_header X-Scheme $scheme; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change $scheme
to $pass_access_scheme
@@ -301,6 +307,8 @@ http { | |||
proxy_set_header X-Forwarded-Host $host; | |||
proxy_set_header X-Forwarded-Port $pass_port; | |||
proxy_set_header X-Forwarded-Proto $pass_access_scheme; | |||
proxy_set_header X-Original-URI $request_uri; | |||
proxy_set_header X-Scheme $scheme; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Please change $scheme
to $pass_access_scheme
Updated:
|
Coverage decreased (-0.3%) to 43.92% when pulling 84003c4a381f1aa9cf410122ae78b3db3cb64ded on colemickens:colemickens-signin-url into b9d272a on kubernetes:master. |
Can I relax the URL check? I want to make the I want to make the annotation values |
ca1a4c9
to
7240359
Compare
Coverage decreased (-0.3%) to 43.92% when pulling 7240359066e70a75c7436689deedeb41d41b3129 on colemickens:colemickens-signin-url into b9d272a on kubernetes:master. |
Coverage decreased (-0.3%) to 43.92% when pulling 7240359066e70a75c7436689deedeb41d41b3129 on colemickens:colemickens-signin-url into b9d272a on kubernetes:master. |
Coverage decreased (-0.3%) to 43.92% when pulling 7240359066e70a75c7436689deedeb41d41b3129 on colemickens:colemickens-signin-url into b9d272a on kubernetes:master. |
Coverage decreased (-0.3%) to 43.92% when pulling 7240359066e70a75c7436689deedeb41d41b3129 on colemickens:colemickens-signin-url into b9d272a on kubernetes:master. |
7240359
to
f0709cb
Compare
Coverage decreased (-0.3%) to 43.92% when pulling f0709cb54bb5a07cc9cb0be5687a203f6460d47c on colemickens:colemickens-signin-url into b9d272a on kubernetes:master. |
Really hoping to get back to this tomorrow. For when I do... Is the I plan to add a simple chunk in one of the READMEs for deploying nginx-ingress-controller which could be linked to from the oauth2_proxy example I've written here. That would effectively make it a nice one-stop shop for setting up nginx-ingress-controller and oauth2_proxy and protecting kubernetes-dashboard. Might be out of scope for this repo though, so I wanted to ask. |
I think is a good example showing how to integrate an oauth2 app |
Thanks for this PR, works very well with coreOS's dex. question: I have 1 Ingress object that handles authentication - points to an oauth2 client that sits in front of dex at foo.bar.com/auth/oauth2 ...and I have another ingress object pointing to some application foo.bar.com/home But I keep getting 499 error codes when i try to add other ingress objects at like bar.foo.com or echo.bar.com that uses the annotation of the auth object at foo.bar.com/auth/oauth2 to check for authentication status. do I need to deploy a separate auth ingress object for each host name i want to authenticate? |
@colemickens ping |
f0709cb
to
245d7f8
Compare
I think it's nearly ready to go... except that Other than that, this is ready to go. The README doesn't go into extensive detail on each individual step, but the shell script is short and it's easy enough to figure out what it's doing. I tested with the helm path suggested in the README and then editted the nginx-ingress deployment to fix the flags and then pointed at an image I'd built a couple weeks ago... due to the aforementioned issues. I used the config examples that are in there, for Azure. But I've also used it with GitHub and anything in |
I can say it was between these commits at least, based on the |
Closing. Replaced by #410 |
I finally got around to trying to put together an OAuth2/OIDC reverse proxy using
nginx-ingress-controller
and CoreOS's fork of bitly'soauth2_proxy
. Initial support for thi scenario was added as a result of this issue: kubernetes-retired/contrib#1492I had to do a couple things to get it to work:
Build
nginx-ingress-controller
myself since it has not been published in quite a long time.Downgrade to a version of
nginx-slim
that is actually published (kind of weird)...Add a new annotation for
auth-signin
that tells nginx where to send 401s to.Add a couple extra
X-*
headers for things being reverse-proxied that expect them.As a bonus:
Parameterize
DOCKER
in the Makefile similar toPREFIX
andRELEASE
for those of us building and pushing to non-GCR repositories.Pulled out the URL parsing logic from the authrequest plugin to the parser since it seems to already hold util-type helpers.
cc: @aledbf