@@ -12,72 +12,37 @@ Traefik plugin to proxy requests to [owasp/modsecurity-crs](https://hub.docker.c
12
12
13
13
- [ Traefik Modsecurity Plugin] ( #traefik-modsecurity-plugin )
14
14
- [ Demo] ( #demo )
15
- - [ Full Configuration with docker-compose] ( #full-configuration-with-docker-compose )
16
- - [ How ?] ( #how- )
15
+ - [ Usage (docker-compose.yml)] ( #usage-docker-composeyml )
16
+ - [ How it works] ( #how-it-works )
17
+ - [ Local development (docker-compose.local.yml)] ( #local-development-docker-composelocalyml )
17
18
18
19
## Demo
19
20
20
21
Demo with WAF intercepting relative access in query param.
21
22
22
23
![ Demo] ( ./img/waf.gif )
23
24
24
- ## Full Configuration with docker-compose
25
-
26
- ``` yml
27
- version : " 3.7"
28
-
29
- services :
30
- traefik :
31
- image : traefik
32
- ports :
33
- - " 8000:80"
34
- - " 8080:8080"
35
- command :
36
- - --api.dashboard=true
37
- - --api.insecure=true
38
- - --pilot.token=$TRAEFIK_PILOT_TOKEN
39
- - --experimental.localPlugins.traefik-modsecurity-plugin.moduleName=github.com/acouvreur/traefik-modsecurity-plugin
40
- - --providers.docker=true
41
- - --entrypoints.http.address=:80
42
- volumes :
43
- - ' /var/run/docker.sock:/var/run/docker.sock'
44
- - ' .:/plugins-local/src/github.com/acouvreur/traefik-modsecurity-plugin'
45
- environment :
46
- - TRAEFIK_PILOT_TOKEN
47
- labels :
48
- - traefik.enable=true
49
- - traefik.http.services.traefik.loadbalancer.server.port=8080
50
- - traefik.http.middlewares.waf.plugin.traefik-modsecurity-plugin.modSecurityUrl=http://waf:80
51
-
52
- waf :
53
- image : owasp/modsecurity-crs:apache
54
- environment :
55
- - PARANOIA=1
56
- - ANOMALY_INBOUND=10
57
- - ANOMALY_OUTBOUND=5
58
- - BACKEND=http://dummy
59
-
60
- dummy :
61
- image : containous/whoami
62
-
63
- website :
64
- image : containous/whoami
65
- labels :
66
- - traefik.enable=true
67
- - traefik.http.routers.website.rule=PathPrefix(`/website`)
68
- - traefik.http.routers.website.middlewares=waf@docker
69
- ` ` `
25
+ ## Usage (docker-compose.yml)
26
+
27
+ See [ docker-compose.yml] ( docker-compose.yml )
70
28
71
29
1 . docker-compose up
72
30
2 . Go to http://localhost:8000/website , the request is received without warnings
73
31
3 . Go to http://localhost:8000/website?test=../etc , the request is intercepted and returned with 403 Forbidden by owasp/modsecurity
74
32
75
- ## How ?
33
+ ## How it works
76
34
77
35
This is a very simple plugin that proxies the query to the owasp/modsecurity apache container.
78
36
79
37
The plugin checks that the response from the waf container hasn't an http code > 400 before forwarding the request to the real service.
80
38
81
39
If it is > 400, then the error page is returned instead.
82
40
83
- The *dummy* service is created so the waf container forward the request to a service and respond with 200 OK all the time.
41
+ The * dummy* service is created so the waf container forward the request to a service and respond with 200 OK all the time.
42
+
43
+
44
+ ## Local development (docker-compose.local.yml)
45
+
46
+ See [ docker-compose.local.yml] ( docker-compose.local.yml )
47
+
48
+ ` docker-compose -f docker-compose.local.yml up ` to load the local plugin
0 commit comments