-
Notifications
You must be signed in to change notification settings - Fork 271
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
fix coraza configuration to use the action variable #1094
Conversation
Thanks for the contribution! A few questions:
|
Not tested, but I thing you get the point. http-response is useless then.
The problem with master has nothing to do with this fix. We were not able to test this fix on master (v0.15) as haproxy wasn't able to be bind to network socket there. |
082a0f3
to
d6993b0
Compare
Like I mentioned, we used the snippet from the issue's op and just verified that it doesn't do anything harmful and is actually working but we didn't really check what he did in the snippet. If I check the official coraza docs (https://coraza.io/connectors/coraza-spoa/#haproxy-configuration) they also do it for both request and response and according to the flow diagram on their website (https://owasp.org/www-project-coraza-web-application-firewall/) coraza will not only check the request but also the response.
The first issue was with our configuration and the newer haproxy version used in master (the http-use-htx option was removed). Since this option is the default value in newer versions, I was able to fix that by simply removing the option from our config. The second issue (that I wasn't able to resolve) is a permission denied error while trying to bind 80/443, even after manually adding the NET_BIND_SERVICE capability. Do we need to change anything besides replacing the image version to make the new version work? I've switched the base to master |
Ah this really makes sense, thanks for pointing it out.
Great thanks, we in fact need to remove this deprecated option.
This is somewhat expected since we started to run haproxy ingress as non root on v0.15. How did you add the capability? Are you running the embedded haproxy or configuring an external one via a sidecar? |
We are running with the internal haproxy instance. I guess you are already providing a fix for this in #1096? |
This is more like a "best effort" than a fix, because capabilities rely on extended attributes, and it doesn't work properly on all file systems and controller runtime environments. I'll provide a proper doc and link in the v0.15 release notes, with all the options and their issues. |
Lgtm, merging now. |
This is a fix for #1085
The snippet used in the fix was provided by the issue's op (@tomklapka)
It uses txn.coraza.action instead of the txn.coraza.fail and allow for a more fine grained control about how requests should be rejected and fixes the issue that with the current coraza version all requests are rejected (txn.coraza.fail is most likely not set anymore).
I've based this fix of 0.14 because I wasn't able to get master running in our testing environment. Please let me know if I need to change anything here.