-
Notifications
You must be signed in to change notification settings - Fork 269
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
Coraza support #964
Coraza support #964
Conversation
Great job. I still need to have a closer look and want to run it myself on a local env, but for now I have two suggestions:
|
@jcmoraisjr I can help with some testing too. |
Ah sorry forgot to mention the defaults.go thing. If I move the file back to where it was, I get an import cycle error:
The cycle is "instance_test.go" imports "pkg/converters/ingress" and "pkg/converters/ingress/ingress.go" imports "pkg/haproxy", which is where instance_test.go is. Seems either defaults.go needs to move or instance_test.go needs to move so neither gets accidentally imported when the parent folder is imported. Open to other ideas though! |
Ok, so I set this up on my cluster, and verified the configuration suggested works. I am able to intercept attacks and read them in the coraza sidecar container.
One thing I noticed is that it is not passing the hostname to the logs, but I don't know if that needs to be addressed in the SPOA code vs the ingress controller code. |
@sealneaward ah good catch, I will investigate that |
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.
Thanks again for the contribution! See some comments below. Mostly good, just bothering a bit about where to place the use-coraza config key.
I'm also proposing not to move the defaults.go file, which would create another large commit, so try to squash everything into a single commit - or a few more commits with incremental steps if you prefer.
@sealneaward The missing |
@jcmoraisjr sorry for the force-push spam. I removed the custom |
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.
Awesome thanks! A few other comments below.
sorry for the force-push spam
No problem at all, keep pushing =)
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.
A few other findings after run an e2e locally. Other than that LGTM and we're ready to go.
Lgtm, thanks! Merging now. |
This PR adds a new config value,
modsecurity-use-coraza
, which changes the WAF/SPOE configuration to support https://github.com/corazawaf/coraza-spoaSpecifically, this config matches the "experimental" branch of coraza-spoa. Slight changes in the args may be required in the future as the API stabilizes, so we do not provide default args in the source code (only in the docs).
To use, just set these values in the helm chart:
The above values will mount a ConfigMap for Coraza's config.yaml, which must be created separately. Here is that configmap:
Note the
default_application
line, that is from this PR: corazawaf/coraza-spoa#36That PR is needed because I set the
app
arg to be theHost
header, so you need a default_application to configure WAF rules for all hosts. Otherwise, you'd need a different config block for every single Ingress hostname in your cluster.