Add a Snippet for ModSecurity
Allows for the configuration of Mod Security rules via a Snippet.
This commit is contained in:
parent
a22c656f30
commit
95b3042b6e
5 changed files with 70 additions and 23 deletions
|
|
@ -98,7 +98,7 @@ You can add these Kubernetes annotations to specific Ingress objects to customiz
|
|||
|[nginx.ingress.kubernetes.io/enable-modsecurity](#modsecurity)|bool|
|
||||
|[nginx.ingress.kubernetes.io/enable-owasp-core-rules](#modsecurity)|bool|
|
||||
|[nginx.ingress.kubernetes.io/modsecurity-transaction-id](#modsecurity)|string|
|
||||
|
||||
|[nginx.ingress.kubernetes.io/modsecurity-snippet](#modsecurity)|string|
|
||||
|
||||
### Canary
|
||||
|
||||
|
|
@ -649,6 +649,7 @@ It can be enabled using the following annotation:
|
|||
```yaml
|
||||
nginx.ingress.kubernetes.io/enable-modsecurity: "true"
|
||||
```
|
||||
ModSecurity will run in "Detection-Only" mode using the [recommended configuration](https://github.com/SpiderLabs/ModSecurity/blob/v3/master/modsecurity.conf-recommended).
|
||||
|
||||
You can enable the [OWASP Core Rule Set](https://www.modsecurity.org/CRS/Documentation/) by
|
||||
setting the following annotation:
|
||||
|
|
@ -661,6 +662,23 @@ You can pass transactionIDs from nginx by setting up the following:
|
|||
nginx.ingress.kubernetes.io/modsecurity-transaction-id: "$request_id"
|
||||
```
|
||||
|
||||
You can also add your own set of modsecurity rules via a snippet:
|
||||
```yaml
|
||||
nginx.ingress.kubernetes.io/modsecurity-snippet: |
|
||||
SecRuleEngine On
|
||||
SecDebugLog /tmp/modsec_debug.log
|
||||
```
|
||||
|
||||
Note: If you use both `enable-owasp-core-rules` and `modsecurity-snippet` annotations together, only the
|
||||
`modsecurity-snippet` will take effect. If you wish to include the [OWASP Core Rule Set](https://www.modsecurity.org/CRS/Documentation/) or
|
||||
[recommended configuration](https://github.com/SpiderLabs/ModSecurity/blob/v3/master/modsecurity.conf-recommended) simply use the include
|
||||
statement:
|
||||
```yaml
|
||||
nginx.ingress.kubernetes.io/modsecurity-snippet: |
|
||||
Include /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf
|
||||
Include /etc/nginx/modsecurity/modsecurity.conf
|
||||
```
|
||||
|
||||
### InfluxDB
|
||||
|
||||
Using `influxdb-*` annotations we can monitor requests passing through a Location by sending them to an InfluxDB backend exposing the UDP socket
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue