Skip to content

Commit 4b79b1a

Browse files
committed
📝 Fix exemple links and documentation for wicketkeeper
1 parent b9a845d commit 4b79b1a

File tree

4 files changed

+51
-38
lines changed

4 files changed

+51
-38
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The following captcha providers are supported now:
3939
- [hcaptcha](https://www.hcaptcha.com/)
4040
- [recaptcha](https://www.google.com/recaptcha/about/)
4141
- [turnstile](https://www.cloudflare.com/products/turnstile/)
42+
- [custom/wicketkeeper](https://github.com/a-ve/wicketkeeper)
4243

4344
There are 5 operating modes (CrowdsecMode) for this plugin:
4445

@@ -684,7 +685,7 @@ docker exec crowdsec cscli decisions remove --ip 10.0.0.10 -t captcha
684685

685686
#### 1. Behind another proxy service (ex: clouflare) [examples/behind-proxy/README.md](https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/blob/main/examples/behind-proxy/README.md)
686687

687-
#### 2. With Redis as an external shared cache [examples/redis-cache/README.md](https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/blob/main/examples/redis-cache/README.md)
688+
q#### 2. With Redis as an external shared cache [examples/redis-cache/README.md](https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/blob/main/examples/redis-cache/README.md)
688689

689690
#### 3. Using Trusted IP (ex: LAN OR VPN) that won't get filtered by crowdsec [examples/trusted-ips/README.md](https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/blob/main/examples/trusted-ips/README.md)
690691

@@ -702,6 +703,8 @@ docker exec crowdsec cscli decisions remove --ip 10.0.0.10 -t captcha
702703

703704
#### 10. Using Traefik with Custom Ban HTML Page [examples/custom-ban-page/README.md](https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/blob/main/examples/custom-ban-page/README.md)
704705

706+
#### 11. Using Traefik with Custom Captcha Whiketkeeper[examples/custom-captcha/README.md](https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/blob/main/examples/custom-captcha/README.md)
707+
705708
### Local Mode
706709

707710
Traefik also offers a developer mode that can be used for temporary testing of plugins not hosted on GitHub.

bouncer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func New(_ context.Context, next http.Handler, config *configuration.Config, nam
252252
config.CaptchaGracePeriodSeconds,
253253
)
254254
if err != nil {
255+
log.Error("CaptchaClient not valid " + err.Error())
255256
return nil, err
256257
}
257258

examples/custom-captcha/README.md

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ Read the example captcha before this, to better understand what is done here.
55
### Traefik configuration
66

77
The minimal configuration is defined below to implement custom captcha.
8-
This documentation use https://github.com/a-ve/wicketpeeker, a self-hosted captcha provider that have a similar API than big providers.
8+
This documentation use https://github.com/a-ve/wicketpeeker, a self-hosted captcha provider that have a similar API than big providers.
99

1010
Minimal API requirement:
11+
1112
- the JS file URL to load the captcha on the served `captcha.html`
1213
- the HTML className to tell to the JS where to display the challenge
1314
- the verify URL endpoint to send the response from the captcha
@@ -21,41 +22,45 @@ Minimal API requirement:
2122
labels:
2223
# Choose captcha provider
2324
- "traefik.http.middlewares.crowdsec.plugin.bouncer.captchaProvider=custom"
24-
# Define captcha grade period seconds
25+
# Define captcha grace period seconds
2526
- "traefik.http.middlewares.crowdsec.plugin.bouncer.captchaGracePeriodSeconds=1800"
27+
- "traefik.http.middlewares.crowdsec.plugin.bouncer.captchaCustomJsURL=http://captcha.localhost:8000/fast.js"
28+
# Inside Traefik container the plugin must be able to reach wicketkeeper service so we can go through a Traefik localhost
29+
# domain which would resolve traefik itself and the port for the dashboard
30+
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomValidateURL=http://wicketkeeper:8080/v0/siteverify"
31+
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomKey=wicketkeeper"
32+
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomResponse=wicketkeeper_solution"
2633
# Define captcha HTML file path
2734
- "traefik.http.middlewares.crowdsec.plugin.bouncer.captchaHTMLFilePath=/captcha.html"
28-
#
29-
- "traefik.http.middlewares.crowdsec.plugin.bouncer.captchaCustomJsURL=http://localhost:8080/fast.js"
30-
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomValidateURL=http://localhost:8080/v0/siteverify"
31-
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomKey=wicketpeeker"
32-
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomResponse=response"
3335
```
3436
35-
```yaml
36-
wicketkeeper:
37-
image: ghcr.io/a-ve/wicketkeeper:latest
38-
ports:
39-
- "8080:8080"
40-
environment:
41-
- ROOT_URL=http://localhost:8080
42-
- LISTEN_PORT=8080
43-
- REDIS_ADDR=redis:6379
44-
- DIFFICULTY=4
45-
- ALLOWED_ORIGINS=*
46-
- PRIVATE_KEY_PATH=/data/wicketkeeper.key
47-
volumes:
48-
- ./data:/data
49-
depends_on:
50-
- redis
51-
redis:
52-
image: redis/redis-stack-server:latest
37+
```yaml
38+
wicketkeeper:
39+
image: ghcr.io/a-ve/wicketkeeper:latest
40+
user: root
41+
ports:
42+
- "8080:8080"
43+
environment:
44+
- ROOT_URL=http://localhost:8080
45+
- LISTEN_PORT=8080
46+
- REDIS_ADDR=redis:6379
47+
- DIFFICULTY=4
48+
- ALLOWED_ORIGINS=*
49+
- PRIVATE_KEY_PATH=/data/wicketkeeper.key
50+
volumes:
51+
- ./data:/data
52+
depends_on:
53+
- redis
54+
redis:
55+
image: redis/redis-stack-server:latest
5356
```
5457
5558
## Exemple navigation
59+
5660
We can try to query normally the whoami server:
61+
5762
```bash
58-
curl http://localhost:8000
63+
curl http://localhost:8000/foo
5964
```
6065

6166
We can try to ban ourself and retry.
@@ -65,6 +70,7 @@ docker exec crowdsec cscli decisions add --ip 10.0.0.20 -d 10m --type captcha
6570
```
6671

6772
To play the demo environment run:
73+
6874
```bash
6975
make run_custom_captcha
70-
```
76+
```

examples/custom-captcha/docker-compose.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
traefik:
3-
image: "traefik:v3.0.0"
3+
image: "traefik:v3.5.0"
44
container_name: "traefik"
55
restart: unless-stopped
66
command:
@@ -11,15 +11,16 @@ services:
1111
- "--providers.docker=true"
1212
- "--providers.docker.exposedbydefault=false"
1313
- "--entrypoints.web.address=:80"
14+
- "--entrypoints.web.forwardedheaders.trustedips=172.18.0.0/24"
1415

15-
# - "--experimental.plugins.bouncer.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin"
16-
# - "--experimental.plugins.bouncer.version=v1.4.5"
17-
- "--experimental.localplugins.bouncer.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin"
16+
- "--experimental.plugins.bouncer.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin"
17+
- "--experimental.plugins.bouncer.version=v1.4.5"
18+
# - "--experimental.localplugins.bouncer.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin"
1819
volumes:
1920
- /var/run/docker.sock:/var/run/docker.sock:ro
2021
- logs-custom-captcha-enabled:/var/log/traefik
2122
- "./captcha.html:/captcha.html"
22-
- ./../../:/plugins-local/src/github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin
23+
# - ./../../:/plugins-local/src/github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin
2324
ports:
2425
- 8000:80
2526
- 8080:8080
@@ -45,10 +46,12 @@ services:
4546

4647
# Choose captcha provider
4748
- "traefik.http.middlewares.crowdsec.plugin.bouncer.captchaProvider=custom"
48-
- "traefik.http.middlewares.crowdsec.plugin.bouncer.captchaCustomJsURL=http://captcha.localhost:8080/fast.js"
49-
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomValidateURL=http://captcha.localhost:8080/v0/siteverify"
50-
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomKey=wicketpeeker"
51-
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomResponse=response"
49+
- "traefik.http.middlewares.crowdsec.plugin.bouncer.captchaCustomJsURL=http://captcha.localhost:8000/fast.js"
50+
# Inside Traefik container the plugin must be able to reach wicketkeeper service so we can go through a Traefik localhost
51+
# domain which would resolve traefik itself and the port for the dashboard
52+
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomValidateURL=http://wicketkeeper:8080/v0/siteverify"
53+
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomKey=wicketkeeper"
54+
- "traefik.http.middlewares.crowdsec.plugin.bouncer.CaptchaCustomResponse=wicketkeeper_solution"
5255
# Define captcha grade period seconds
5356
- "traefik.http.middlewares.crowdsec.plugin.bouncer.captchaGracePeriodSeconds=20"
5457
# Define captcha HTML file path
@@ -78,7 +81,7 @@ services:
7881
image: ghcr.io/maxlerebourg/wicketkeeper:latest
7982
container_name: "wicketkeeper"
8083
environment:
81-
- ROOT_URL=http://localhost:8080
84+
- ROOT_URL=http://captcha.localhost:8000
8285
- LISTEN_PORT=8080
8386
- REDIS_ADDR=redis:6379
8487
- DIFFICULTY=4

0 commit comments

Comments
 (0)