🍱 remove alone mode

This commit is contained in:
Max Lerebourg
2022-10-11 19:28:57 +02:00
parent 4d7615dd19
commit 2e780b304d
2 changed files with 28 additions and 162 deletions
+3 -50
View File
@@ -23,7 +23,6 @@ There are 4 operating modes (CrowdsecMode) for this plugin:
| none | If the client IP is on ban list, it will get a http code 403 response. Otherwise, request will continue as usual. All request call the Crowdsec LAPI |
| live | If the client IP is on ban list, it will get a http code 403 response. Otherwise, request will continue as usual. The bouncer can leverage use of a local cache in order to reduce the number of requests made to the Crowdsec LAPI. It will keep in cache the status for each IP that makes queries. |
| stream | Stream Streaming mode allows you to keep in the local cache only the Banned IPs, every requests that does not hit the cache is authorized. Every minute, the cache is updated with news from the Crowdsec LAPI. |
| alone | Standalone mode, similar to the streaming mode but the blacklisted IPs are fetched on the CAPI. Every 2 hours, the cache is updated with news from the Crowdsec CAPI. It does not include any localy banned IP, but can work without a crowdsec service|
The recommanded mode for performance is the streaming mode, decisions are updated every 60 sec by default and that's the only communication between traefik and crowdsec. Every requests that happens hits the cache for quick decisions.
@@ -52,7 +51,7 @@ At each start of synchronisation, the middleware will wait a random number of se
- enable the plugin
- CrowdsecMode
- string
- default: `stream`, expected value are: `none`, `live`, `stream`, `alone`
- default: `stream`, expected value are: `none`, `live`, `stream`
- CrowdsecLapiScheme
- string
- default: `http`, expected value are: `http`, `https`
@@ -63,15 +62,6 @@ At each start of synchronisation, the middleware will wait a random number of se
- CrowdsecLapiKey
- string
- Crowdsec LAPI generated key for the bouncer : **must be unique by service**.
- CrowdsecCapiLogin
- string
- Used only in `alone` mode, login for Crowdsec CAPI
- CrowdsecCapiPwd
- string
- Used only in `alone` mode, password for Crowdsec CAPI
- CrowdsecCapiScenarios
- []string
- Used only in `alone` mode, scenarios for Crowdsec CAPI
- UpdateIntervalSeconds
- int64
- default: 60
@@ -126,17 +116,10 @@ http:
crowdsecLapiKey: privateKey
crowdsecLapiHost: crowdsec:8080
crowdsecLapiScheme: http
crowdsecCapiLogin: login
crowdsecCapiPwd: password
crowdsecCapiScenarios:
- scenario1
- scenario2
...
```
Except for the crowdsecLapiKey, crowdsecCapiLogin, crowdsecCapiPwd, crowdsecCapiScenarios, these are the default value of the plugin.
These are the default values of the plugin except for LapiKey.
#### Generate LAPI KEY (exept for `alone` mode)
#### 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/
@@ -165,36 +148,6 @@ You can then run all the containers:
docker-compose up -d
```
#### Generate CAPI credentials (only for `alone` mode)
You need to create a crowdsec API credentials for the CAPI.
You can follow the documentation here: https://docs.crowdsec.net/docs/central_api/intro
```bash
curl -X POST "https://api.crowdsec.net/v2/watchers" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"password\": \"PASSWORD\", \"machine_id\": \"LOGIN\"}"
```
These CAPI credentials must be set in your docker-compose.yml or in your config files
```yaml
...
traefik:
command:
...
- "--experimental.plugins.bouncer.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin"
- "--experimental.plugins.bouncer.version=v1.0.0"
...
whoami:
labels:
- "traefik.http.middlewares.crowdsec.plugin.bouncer.crowdseccapilogin=LOGIN"
- "traefik.http.middlewares.crowdsec.plugin.bouncer.crowdseccapipwd=PASSWORD"
- "traefik.http.middlewares.crowdsec.plugin.bouncer.crowdseccapiscenarios=scenario1, scenario2, ..."
- "traefik.http.middlewares.crowdsec.plugin.bouncer.enabled=true"
```
You can then run all the containers:
```bash
docker-compose up -d
```
#### Add manually an IP to the blocklist (testing purpose)
```bash