mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-09-02 20:28:50 +02:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c2ac9830d | ||
|
|
b985f2d748 |
@@ -137,6 +137,33 @@ You can then run all the containers:
|
|||||||
docker-compose -f docker-compose-local.yml up -d
|
docker-compose -f docker-compose-local.yml up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Generate LAPI-KEY
|
||||||
|
You need to generate a crowdsec API key for the LAPI.
|
||||||
|
You can follow the documentation here: https://docs.crowdsec.net/docs/user_guides/lapi_mgmt/
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose-local.yml up -d crowdsec
|
||||||
|
docker exec crowdsec cscli bouncers add crowdsecBouncer
|
||||||
|
```
|
||||||
|
|
||||||
|
This LApi key must be set where is noted FIXME-LAPI-KEY in the docker-compose-test.yml
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
whoami:
|
||||||
|
labels:
|
||||||
|
- "traefik.http.middlewares.crowdsec.plugin.bouncer.crowdseclapikey=FIXME-LAPI-KEY"
|
||||||
|
...
|
||||||
|
crowdsec:
|
||||||
|
environment:
|
||||||
|
BOUNCER_KEY_TRAEFIK: FIXME-LAPI-KEY
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
You can then run all the containers:
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose-local.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
#### Add manually an IP to the blocklist
|
#### Add manually an IP to the blocklist
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
traefik:
|
||||||
|
image: "traefik:v2.8.7"
|
||||||
|
container_name: "traefik"
|
||||||
|
command:
|
||||||
|
# - "--log.level=DEBUG"
|
||||||
|
- "--accesslog"
|
||||||
|
- "--accesslog.filepath=/var/log/traefik/traefik.log"
|
||||||
|
- "--api.insecure=true"
|
||||||
|
- "--providers.docker=true"
|
||||||
|
- "--providers.docker.exposedbydefault=false"
|
||||||
|
- "--entrypoints.web.address=:80"
|
||||||
|
|
||||||
|
- "--experimental.localplugins.bouncer.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin"
|
||||||
|
volumes:
|
||||||
|
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||||
|
- "logs:/var/log/traefik"
|
||||||
|
- ./:/plugins-local/src/github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin
|
||||||
|
ports:
|
||||||
|
- 8000:80
|
||||||
|
- 8080:8080
|
||||||
|
|
||||||
|
whoami:
|
||||||
|
image: traefik/whoami
|
||||||
|
container_name: "simple-service"
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.whoami.rule=Host(`localhost`)"
|
||||||
|
- "traefik.http.routers.whoami.entrypoints=web"
|
||||||
|
- "traefik.http.routers.whoami.middlewares=crowdsec@docker"
|
||||||
|
- "traefik.http.middlewares.crowdsec.plugin.bouncer.enabled=true"
|
||||||
|
- "traefik.http.middlewares.crowdsec.plugin.bouncer.crowdseclapikey=FIXME-LAPI-KEY"
|
||||||
|
|
||||||
|
crowdsec:
|
||||||
|
image: crowdsecurity/crowdsec:v1.4.1
|
||||||
|
container_name: "crowdsec"
|
||||||
|
command: rm -rf /etc/crowdsec/acquis.yaml
|
||||||
|
environment:
|
||||||
|
COLLECTIONS: crowdsecurity/traefik
|
||||||
|
CUSTOM_HOSTNAME: crowdsec
|
||||||
|
BOUNCER_KEY_TRAEFIK: FIXME-LAPI-KEY
|
||||||
|
depends_on:
|
||||||
|
- 'traefik'
|
||||||
|
volumes:
|
||||||
|
- ./acquis.yaml:/etc/crowdsec/acquis.yaml:ro
|
||||||
|
- logs:/var/log/traefik:ro
|
||||||
|
- crowdsec-db:/var/lib/crowdsec/data/
|
||||||
|
- crowdsec-config:/etc/crowdsec/
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
logs:
|
||||||
|
crowdsec-db:
|
||||||
|
crowdsec-config:
|
||||||
Reference in New Issue
Block a user