From 63152368d71f99fad22a7117f4be1c106b342a42 Mon Sep 17 00:00:00 2001 From: besha100 Date: Wed, 15 Dec 2021 20:22:42 +0100 Subject: [PATCH] Fixed the condition also in ingress controller template --- internal/ingress/controller/template/template.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/ingress/controller/template/template.go b/internal/ingress/controller/template/template.go index ae5ec259a..d8d275caa 100644 --- a/internal/ingress/controller/template/template.go +++ b/internal/ingress/controller/template/template.go @@ -1530,6 +1530,9 @@ func buildModSecurityForLocation(cfg config.Configuration, location *ingress.Loc %v '; `, location.ModSecurity.Snippet)) + } else { + buffer.WriteString(`modsecurity_rules_file /etc/nginx/modsecurity/modsecurity.conf; +`) } if location.ModSecurity.TransactionID != "" { @@ -1537,11 +1540,6 @@ func buildModSecurityForLocation(cfg config.Configuration, location *ingress.Loc `, location.ModSecurity.TransactionID)) } - if !isMSEnabled { - buffer.WriteString(`modsecurity_rules_file /etc/nginx/modsecurity/modsecurity.conf; -`) - } - if !cfg.EnableOWASPCoreRules && location.ModSecurity.OWASPRules { buffer.WriteString(`modsecurity_rules_file /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf; `)