Skip to content

Commit 3ca404d

Browse files
authored
waf: readme (#282)
Address #279 (review). We can then discuss on how to simplify the process and eventually rely on https://github.com/corazawaf/coraza-coreruleset Signed-off-by: Matteo Pace <pace.matteo96@gmail.com>
1 parent 4c2d5be commit 3ca404d

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

extensions/composer/waf/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# WAF Extension
2+
3+
This extension implements a Web Application Firewall using [OWASP Coraza](https://coraza.io/) and comes with rules from the [OWASP Core Rule Set (CRS)](https://coreruleset.org/) already embedded and ready to use.
4+
5+
## Upgrading CRS
6+
7+
The CRS rules are located under [coraza/rules/](coraza/rules/) and embedded into the binary at build time in [coraza/rule_fs.go](coraza/rule_fs.go) via Go's `//go:embed` directive.
8+
9+
To upgrade to a new CRS version:
10+
11+
1. Download the new CRS release minimal archive from the [coreruleset releases page](https://github.com/coreruleset/coreruleset/releases).
12+
1. Replace the contents of `coraza/rules/owasp_crs/` with the `.conf` and `.data` files from the new release `rules/` directory.
13+
1. Update `coraza/rules/crs-setup.conf` with the new `crs-setup.conf.example` available in the new release root folder, reviewing any changes and merging them into the existing `crs-setup.conf` as needed. Note that some configurations are specific for this repository, and this should not be overwritten.
14+
15+
## Upgrading Coraza
16+
17+
To upgrade to a new Coraza version:
18+
19+
1. Bump the Coraza dependency version in `go.mod` to the new version. You can find the latest Coraza version on the [Coraza releases page](https://github.com/corazawaf/coraza/releases).
20+
```sh
21+
go get github.com/corazawaf/coraza/v3@<new-version>
22+
go mod tidy
23+
```
24+
1. Update `coraza/rules/recommended.conf` with the new `recommended.conf.example` available in upstream repository at [coraza.conf-recommended](https://github.com/corazawaf/coraza/blob/main/coraza.conf-recommended) checking out the new version. Review any changes and merge them into the existing `recommended.conf` as needed. Note that some configurations are specific for this repository, and this should not be overwritten.

0 commit comments

Comments
 (0)