-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
Traefik auth forward #265
Traefik auth forward #265
Conversation
Michiel Vanderlee seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
I can't figure out how to get the CLA working. I have however accepted it |
Just realized that the URI is only the path. Would also need to get add these:
and somehow combine them into a URL object for the Matcher to understand |
Thank you for this PR. Obviously we'd like to avoid having one endpoint per proxy. Is there any other solution or workaround for this? If not, I think it would make sense to rewrite the decision endpoint and add e.g. Regarding the CLA, I'll look into it - sometimes the thing is buggy. |
There is no alternative from Traefik's side. I agree with the decision endpoint rewrite. |
I've updated the paths, and now include the protocol and host in the matcher url. |
api/decision.go
Outdated
@@ -30,7 +30,7 @@ import ( | |||
) | |||
|
|||
const ( | |||
DecisionPath = "/decisions" | |||
DecisionPath = "/decisions/generic" |
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.
We need to set up a redirect from /decisions/*
(excluding "/decisions/generic(|/*)" and /decisions/traefik(|/*)
) to /decisions/generic/$1
for backwards compatibility!
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.
I've handled this by simply relying on the middleware order.
This does present an issue for the metrics, and I'm not sure how to handle that.
Once the redirect is set up, I believe that all tests will pass again! :) |
Sorry, accidental close. |
Any update on the status of this ticket? |
@MichielVanderlee are you still up for this contribution? |
@jmt-vanderlee do you still plan to go forward with this PR? |
@jmt-vanderlee Are you still thinking of accepting the license agreement? Would love to see this hit production |
Hi @mvanderlee, I see that your gist is not available anymore. Many thanks in advance! |
We like the idea to make the decisions endpoint more configurable (e.g. define the header from which it should source host, uri, etc). We ran into the same issues with the nginx ingress controller and auth_request. Because we don't want to expose the decision endpoint via ingress we target the oathkeeper-api directly in the auth-url. However this leads oathkeeper to get his hostname as the host header (therefore it doesn't match the hostname in the rules anymore) and there is no way around this (when you want to keep using the "self-configurable" nginx controller). |
I might be able to tackle this and provide a generic structure for adding proxy specific decision endpoints |
Behaves identical to /decisions except that it gets the url and method from the headers. This allows integration with Traefik's ForwardAuth middleware.
Ensure we only accept GET for /decisions/traefik
87fa2ac
to
f19a4e7
Compare
Thank you! The CLA is sometimes buggy :) I take it the code is ready for review? :) |
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.
Superseded by #486 |
Behaves identical to /decisions except that it gets the url and method from the headers.
This allows integration with Traefik's ForwardAuth middleware.
Related issue
#263
Proposed changes
Add integration with Traefik by adding a new
/auth_forward
endpoint that behaves identical to/decisions
except that it gets the url and method from the following headers:X-Forwarded-Uri
X-Forwarded-Method
Checklist
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got green light (please contact
security@ory.sh) from the maintainers to push
the changes.
developer guide (if appropriate)
Further comments
I've copied the
decision.go
file, renamed where appropriate, and changed the rule matcher input. Found references toDecisionHandler
and added the newAuthForwardHandler
accordingly.I've tested locally with this config https://gist.github.com/MVanderlee/2dba10f1ed6c869630eab27847bc2d12
The endpoint only has to support GET but wasn't sure how that's achieved.
Please review carefully as I'm not familiar with GoLang.