mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 11:38:59 +02:00
✨ add support for appsec in crowdsec (#123)
* ✨ add support for appsec in crowdsec * 🐛 lint * 🐛 fix lint * 🐛 fix lint * 🐛 fix lint * fix: comments * 🐛 lint and doc * 🐛 fix comment and lint * 📝 Start documentation for appsec with exemple * 📝 Fix readme typos and update example * 🚨 Fix Lint --------- Co-authored-by: Mathieu Hanotaux <mathieu@hanotaux.fr>
This commit is contained in:
co-authored by
Mathieu Hanotaux
parent
fc3da2fc2d
commit
b68c692ed1
@@ -0,0 +1,28 @@
|
||||
# Example
|
||||
## Enabling AppSec WAF feature from crowdsec
|
||||
|
||||
You mostly need to configure Crowdsec for this to work by enabling virtual patching and configuring some custom rules.
|
||||
In the example we use a whoami container protected by crowdsec with virtual patching enabled.
|
||||
|
||||
The Traefik instance just needs to know where appsec engine is located
|
||||
```yaml
|
||||
labels:
|
||||
|
||||
- "traefik.http.middlewares.crowdsec-bar.plugin.bouncer.crowdsecappsecenabled=true"
|
||||
- "traefik.http.middlewares.crowdsec-bar.plugin.bouncer.crowdsecappsechost=crowdsec:7422"
|
||||
```
|
||||
We can try to query normally the whoami server:
|
||||
```bash
|
||||
curl http://localhost:8000/foo
|
||||
```
|
||||
|
||||
And then we verify that a malicious request will be blocked:
|
||||
```bash
|
||||
curl http://localhost:8000/foo/rpc2
|
||||
```
|
||||
You should get a 403 on http://localhost:8000/foo/rpc2
|
||||
|
||||
To play the demo environment run:
|
||||
```bash
|
||||
make run_appsec
|
||||
```
|
||||
Reference in New Issue
Block a user