Skip to content

Commit 6594a77

Browse files
author
Maya Baya
committed
docs: Add info about WAF using ingress-nginx
1 parent d9c2b1d commit 6594a77

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

README.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Roadmap
3333
- [ ] Support WAF (Web Application Firewall) with [OWASP CRS](https://owasp.org/www-project-modsecurity-core-rule-set/)
3434
- [x] Real liveness and readiness checks
3535
- [ ] PHP-FPM chroot (to verify first)
36+
- [ ] Support for WP Super Cache plugin (https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/#wp-super-cache)
3637

3738
Changing basic auth password or disabling it at all
3839
---------------------------------------------------
@@ -210,8 +211,8 @@ backups:
210211
211212
```
212213
213-
Enabling WAF protection (Kubernetes only)
214-
-----------------------------------------
214+
Enabling WAF protection using waf-proxy (Kubernetes only)
215+
---------------------------------------------------------
215216
216217
> :warning: This is experimental and may not work yet.
217218
@@ -234,6 +235,51 @@ waf:
234235
#DEBUG: true
235236
```
236237

238+
Enabling WAF protecting using ingress-nginx (Kubernetes only)
239+
-------------------------------------------------------------
240+
241+
> :information_source: Works only if you are using [ingress-nginx](https://artifacthub.io/packages/helm/ingress-nginx/ingress-nginx) as Ingress Controller.
242+
243+
[ingress-nginx](https://artifacthub.io/packages/helm/ingress-nginx/ingress-nginx) has a built-in mod_security v3, that needs to be enabled on global configuration level using those helm values:
244+
245+
```yaml
246+
controller:
247+
config:
248+
enable-modsecurity: "true"
249+
enable-owasp-modsecurity-crs: "true"
250+
modsecurity-snippet: |
251+
SecRuleEngine On
252+
```
253+
254+
> :warning: This will enable mod_security and OWASP Core RuleSet on all ingress resources by default! According to documentation you need to set ingress annotation `nginx.ingress.kubernetes.io/enable-modsecurity: "false"` in every ingress, where you want the WAF to be disabled
255+
256+
**WordPress requires additional tweaking, this can be done using Helm values of our Helm Chart as follows:**
257+
258+
```yaml
259+
ingresses:
260+
- name: wp-https
261+
className: nginx
262+
annotations:
263+
cert-manager.io/cluster-issuer: letsencrypt-staging
264+
265+
# WAF provided by Ingress NGINX
266+
nginx.ingress.kubernetes.io/enable-modsecurity: "true"
267+
nginx.ingress.kubernetes.io/enable-owasp-core-rules: "true"
268+
nginx.ingress.kubernetes.io/modsecurity-transaction-id: "$request_id"
269+
nginx.ingress.kubernetes.io/modsecurity-snippet: |
270+
SecRuleEngine On
271+
SecAction "id:900130,phase:1,nolog,pass,t:none,setvar:tx.crs_exclusions_drupal=0,setvar:tx.crs_exclusions_wordpress=1,setvar:tx.crs_exclusions_nextcloud=0,setvar:tx.crs_exclusions_dokuwiki=0,setvar:tx.crs_exclusions_cpanel=0"
272+
hosts:
273+
- host: my-domain.org
274+
paths:
275+
- path: /
276+
pathType: ImplementationSpecific
277+
tls:
278+
- hosts: ["my-domain.org"]
279+
secretName: my-domain-tls
280+
```
281+
282+
237283
Access log and error log
238284
------------------------
239285

0 commit comments

Comments
 (0)