-
Notifications
You must be signed in to change notification settings - Fork 290
[Question]: nginx location configuration #183
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
Comments
Hi @aledbf, Can you give us further detail on the configuration? Whats is your server/http/location configuration? |
@zimmerle apologies for the delay: nginx.conf
Test configuration:
The test should return 403. NGINX log:
NGINX version:
|
From the behavior I see:
Not sure if this works as expected, i.e., if I include |
@zimmerle here is a test that reproduces the issue
|
If I uncomment any |
@zimmerle friendly ping |
@zimmerle friendly ping |
In my queue. Sorry for the delay. |
I've run into the same issue. |
@zimmerle friendly ping :) |
There are some changes in the rules load approach for 3.1. As of now, we are dealing with an issue that is likely to be a consequence of rules merging (see owasp-modsecurity/ModSecurity#2374 and owasp-modsecurity/ModSecurity#2376 for further info). At the commit e0dc84cba5074509275820d79ce3d333658f20c7 we have changed the behavior of SecDefaultAction to overwrite a configuration inside a child RuleSet (subdomain or folder). Those upcoming changes will hit the release status eventually before that, it will hit the v3/master. Respecting the configuration hierarchy the changes in a child configuration should just reflect in the child itself, it is not propagated to the father. The child of a child (or grandchild) should contemplate the configuration of the grandfather and father. What could be happing in your use case scenario is the fact that modsecurity_rules_file and modsecurity_rules are two different Nginx configurations, as such, one has precedence to another; The configurations are not being applied in the order that you read but in the precedence order. Having said that: By using only one option: modsecurity_rules_file or modsecurity_rules do you happen to notice a difference? |
@zimmerle thank you for the feedback
I am going to test this :) |
This means we cannot merge this configurations? (modsecurity_rules_file in the server block and modsecurity_rules in a location) Is possible to define a "global" behavior and change something in a location? (not sure that is possible) |
It is possible. What I am suggesting - for testing - is to stick to one option: modsecurity_rules_file or modsecurity_rules. You can have multiple entries of modsecurity_rules_file, in that case, the appearance order in the file will be respected. I am suspecting that mixing modsecurity_rules_file and modsecurity_rules may have caused you the issue. Instead of:
Use modsecurity_rules_file pointing to a file with that same content and let me know if that works. |
Closing. Avoiding the mix of Edit: This is not fixed in ingress-nginx (yet). |
This PR should fix the issue |
I am using this configuration:
The issue here is related to
modsecurity_rules
configuration. There is no enforced mode in the locationIs this the right way to configure the module?
How is it possible to debug this misconfiguration?
Thanks
The text was updated successfully, but these errors were encountered: