Fix issue in logic of modsec template

according to go templates: `(and ((not false) false))` == `true`

the only way to remove the owasp rules from every location is to disable modsec on that location, or to enable owasp globally, both not-so-great choices.

This commit fixes the logic issue by fixing the and-clause in the if-statement. As a result this reduces global resource usages when modsecurity is configured globally, but not on every location.
This commit is contained in:
MMeent 2019-11-28 14:56:41 +01:00 committed by GitHub
parent de12fc16f0
commit 75e8d37d71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1041,7 +1041,7 @@ stream {
modsecurity_rules '
{{ $location.ModSecurity.Snippet }}
';
{{ else if (and ((not $all.Cfg.EnableOWASPCoreRules) $location.ModSecurity.OWASPRules))}}
{{ else if (and (not $all.Cfg.EnableOWASPCoreRules) ($location.ModSecurity.OWASPRules))}}
modsecurity_rules_file /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf;
{{ end }}