From 75e8d37d711638d7288d59f820e0031f56f33dc2 Mon Sep 17 00:00:00 2001 From: MMeent Date: Thu, 28 Nov 2019 14:56:41 +0100 Subject: [PATCH] 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. --- rootfs/etc/nginx/template/nginx.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootfs/etc/nginx/template/nginx.tmpl b/rootfs/etc/nginx/template/nginx.tmpl index e96259577..f0a1df16a 100755 --- a/rootfs/etc/nginx/template/nginx.tmpl +++ b/rootfs/etc/nginx/template/nginx.tmpl @@ -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 }}