Skip to content

Commit 26e17a6

Browse files
author
Maya Baya
committed
fix: Fix WAF configuration - temporarily disable it until issue reported by external contributor - corazawaf/coraza-caddy#10 will not be resolved
1 parent ab1bddc commit 26e17a6

File tree

4 files changed

+43
-12
lines changed

4 files changed

+43
-12
lines changed

helm/wordpress-hardened/templates/deployment.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ spec:
7474
{{- end }}
7575
{{- end }}
7676

77+
volumeMounts:
78+
# allows to add extra directives
79+
- name: waf-custom-config
80+
mountPath: /etc/caddy/rules/custom.conf
81+
subPath: custom.conf
82+
7783
ports:
7884
- name: http-waf
7985
containerPort: 8090
@@ -147,6 +153,13 @@ spec:
147153
scheme: HTTP
148154
port: http
149155
{{- end }}
156+
startupProbe:
157+
httpGet:
158+
path: /liveness.php
159+
scheme: HTTP
160+
port: http
161+
failureThreshold: 10
162+
periodSeconds: 5
150163
resources:
151164
{{- toYaml .Values.resources | nindent 20 }}
152165
volumes:
@@ -160,3 +173,8 @@ spec:
160173
persistentVolumeClaim:
161174
claimName: {{ .Values.pv.wp_content.claimName }}
162175
{{- end }}
176+
{{- if .Values.waf.enabled }}
177+
- name: waf-custom-config
178+
configMap:
179+
name: {{ include "wordpress-hardened.fullname" . }}-waf-custom-config
180+
{{- end }}

helm/wordpress-hardened/templates/ingress.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{{ $_ := set $ingress.annotations "kubernetes.io/ingress.class" $ingress.className}}
99
{{ end }}
1010
{{ end }}
11-
{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
11+
{{ if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
1212
apiVersion: networking.k8s.io/v1
1313
{{- else if semverCompare ">=1.14-0" $.Capabilities.KubeVersion.GitVersion -}}
1414
apiVersion: networking.k8s.io/v1beta1
@@ -53,7 +53,7 @@ spec:
5353
backend:
5454
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
5555
service:
56-
name: {{ if $.Values.waf.enabled }}{{ $fullName }}-waf-protected{{ else }}{ $fullName }}{{ end }}
56+
name: {{ if $.Values.waf.enabled }}{{ $fullName }}-waf-protected{{ else }}{{ $fullName }}{{ end }}
5757
port:
5858
number: 80
5959
{{- else }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if .Values.waf.enabled }}
2+
---
3+
apiVersion: v1
4+
kind: ConfigMap
5+
metadata:
6+
name: {{ include "wordpress-hardened.fullname" . }}-waf-custom-config
7+
data:
8+
custom.conf: |
9+
{{ .Values.waf.directives }}
10+
{{- end }}

helm/wordpress-hardened/values.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,23 @@ waf:
114114
enabled: true
115115
image:
116116
repository: ghcr.io/riotkit-org/waf-proxy
117-
tag: 2.5.1-coraza-v1.2.0-bv0.0.10
117+
tag: snapshot
118118
env:
119119
ENABLE_RULE_WORDPRESS: true
120-
WP_CLIENT_IP: x-forwarded-for
121-
WP_ENABLE_BRUTEFORCE_MITIGATION: true
122-
WP_BRUTEFORCE_TIMESPAN: 300
123-
WP_BRUTEFORCE_THRESHOLD: 5
124-
WP_BRUTEFORCE_BAN_PERIOD: 300
125-
WP_ENABLE_XMLRPC: true
126-
WP_ENABLE_USER_ENUMERATION: false
127-
WP_ENABLE_DOS_PROTECTION: true
128-
WP_HARDENED: true
129120
ENABLE_CRS: true
121+
ENABLE_RATE_LIMITER: true
122+
RATE_LIMIT_EVENTS: "30"
123+
RATE_LIMIT_WINDOW: "5s"
130124

125+
# due to bug temporarily the CORAZA WAF is disabled, it will be enabled by default in future releases
126+
ENABLE_CORAZA_WAF: false
127+
128+
directives: |
129+
#SecDefaultAction "phase:4,allow,log"
130+
#SecAction "id:1,pass,log"
131+
#SecAuditLog /dev/stdout
132+
#SecDebugLog /dev/stdout
133+
#SecDebugLogLevel 5
131134
health:
132135
liveness:
133136
enabled: true

0 commit comments

Comments
 (0)