-
-
Notifications
You must be signed in to change notification settings - Fork 352
WIP: Add Support for SPOE #460
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
base: main
Are you sure you want to change the base?
Conversation
To avoid having Anubis handle all traffic in scenarios where HAProxy is intended to be the main reverse proxy, allow Anubis to act as a SPOE informing HAProxy whether a request has already been validated. ACLs in HAProxy can then be used to route these requests to the desired backend without involving Anubis as a reverse proxy. Signed-off-by: Georg Pfuetzenreuter <[email protected]>
I have based this PR on the work by @tacerus. I am not happy yet with its state, but I want some feedback first, since i see some major issues ahead, which should be addressed before a merge. Hence I have not yet completed the checklist either. Currently there is no way to meet the decision on how to proceed without providing a full http request. I therefore suggest to change to a custom data structure like this. Since this is a major change in the architecture i want some feedback first: type RequestMetadata {
source net.IP
user_agent string
} Any check would then only have the data to decide upon, so if a future release requires additional data, it would need manual configuration on the haproxy side. The checks would then return a verdict, instead of directly working with http responses and the http response would be generated at a centralized location. Do you have any better ideas? Unfortunately you have to explicitly specify which data to send to the SPOA |
Thanks for continuing my patch! |
@Xe a quick poke for the pending design review in case you didn't take a look at it yet because it is still marked as draft :) |
Hi, I'll take a look after I release v1.18.0. Thanks! |
Anubis will need at minimum the following information:
Ideally everything in net/http#Request. |
Thanks for having a look! My worry was the "all headers" part as to my knowledge (as of an hour ago) it is only possible to send specific headers, but after some more research this seems possible using the |
Previously rule evalution would directly work with http,Request. This changes introduces an additional level of abstraction in anticipation of adding SPOE support, where there is no http.Request, available, even though most metadata it would contain is still present.
HAProxy can now perform a detailed query to find out if it should forward the request to anubis
Include configuration options added by previous commits
@tacerus since you originally submitted the patch, are you interested in testing my implementation (and documentation)? Tests are still missing, I'll have to figure out how to properly implement useful test cases. Once thats done I can add testcases and then this PR would be ready for review. I also have a couple failures in the playwright tests, although I am unsure why. Possibly explained by Xes comment?
|
Hi, I briefly tested it, a few comments so far:
|
If needed, reproducer for my last point:
Anubis panic output
|
Thanks very much for the feedback!
|
Fair, I assume for new users, the whole
I thought Anubis accepts both,
Thanks, with the original library it seems to not have been an issue, there it would disconnect the faulty client but not panic. |
TBH is that X- header even used as part of the SPOE handling? I would assume not. |
It is not used for the SPOE part, but it is used once the request gets routed to anubis to provide the challenge. (And anubis will throw an error if you don't set it) I haven't had the time to check on this yet though and it is unlikely that i get to addressing the open issues before the end of the month. (having said that, it should be in a working state, so if anyone wants to test it and provide feedback, feel free to) |
Hello, |
I've been very busy with life recently and my little free time has been consumed by some time critical projects, so it will likely be a month or two before I find time to continue this PR. Open points are mostly the things tacerus pointed out and whatever Xe would like to be changed as part of the review. I've been in contact with the maintainer for the spoe library and they claim the crash should be fixed, that needs to be updated and tested as well. Other than that, it should be ready to use. I am currently using it myself and it hasn't caused any issues so far, if you want to test it, feel very welcome. Maybe I can spare a minute or two later and rebase this PR, since Anubis has obviously gotten a lot of work in recently. |
Just curious ... if it is working. couldnt you remove the WIP flag? |
Oh, I wasn't aware this was ready for review. It's marked as draft and WIP so I figured it was still in the cooker. |
Sorry, i wasn't sure if this was considered "ready for review" - different projects, different standards. I've removed the WIP tag. |
btw: did you see the comment about performance in #236 (comment) ? |
Yes, this PR uses the library from the DropMorePackets project, one of the changes i did from the original work from tacerus |
that is not what your go.mod file says... well it mentions you use both. so you can clean it up maybe. |
This PR adds support for HAProxys SPOE (Stream Processing Offloading Engine), which roughly speaking is its plugin system. Basically haproxy can offload decision making to some external program (like anubis!) which then can further be used within haproxy. A typical configuration for a tool like anubis would look like this:
The full HTTP request is only sent to anubis in the third case and in fact the request is never proxied through anubis (if we ignore og passthrough)
I still have some issues with the implementation, further details in a comment below.
Fixes #236
Checklist:
[Unreleased]
section of docs/docs/CHANGELOG.mdnpm run test:integration
(unsupported on Windows, please use WSL)