diff --git a/exemples/redis-cache/docker-compose.redis.yml b/exemples/redis-cache/docker-compose.redis.yml index 5d8e616..df4f796 100644 --- a/exemples/redis-cache/docker-compose.redis.yml +++ b/exemples/redis-cache/docker-compose.redis.yml @@ -2,7 +2,7 @@ version: "3.8" services: traefik: - image: "traefik:v2.9.6" + image: "traefik:v2.9.8" container_name: "traefik" restart: unless-stopped command: @@ -15,7 +15,7 @@ services: - "--entrypoints.web.address=:80" - "--experimental.plugins.bouncer.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin" - - "--experimental.plugins.bouncer.version=v1.1.7" + - "--experimental.plugins.bouncer.version=v1.1.11-beta2" # - "--experimental.localplugins.bouncer.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro @@ -26,16 +26,17 @@ services: - 8080:8080 depends_on: - crowdsec - - redis + - redis-insecure + - redis-secure - whoami-foo: + whoami-redis-insecure: image: traefik/whoami container_name: "simple-service-foo" restart: unless-stopped labels: - "traefik.enable=true" # Definition of the router - - "traefik.http.routers.router-foo.rule=Path(`/foo`)" + - "traefik.http.routers.router-foo.rule=Path(`/redis-insecure`)" - "traefik.http.routers.router-foo.entrypoints=web" - "traefik.http.routers.router-foo.middlewares=crowdsec-foo@docker" # Definition of the service @@ -45,16 +46,18 @@ services: # crowdseclapikey must be uniq to the middleware attached to the service - "traefik.http.middlewares.crowdsec-foo.plugin.bouncer.crowdseclapikey=40796d93c2958f9e58345514e67740e5" - "traefik.http.middlewares.crowdsec-foo.plugin.bouncer.rediscacheenabled=true" + # Contact redis-unsecure without a password + - "traefik.http.middlewares.crowdsec-foo.plugin.bouncer.redisCacheHost=redis-insecure:6379" - "traefik.http.middlewares.crowdsec-foo.plugin.bouncer.loglevel=DEBUG" - whoami-bar: + whoami-redis-secure: image: traefik/whoami container_name: "simple-service-bar" restart: unless-stopped labels: - "traefik.enable=true" # Definition of the router - - "traefik.http.routers.router-bar.rule=Path(`/bar`)" + - "traefik.http.routers.router-bar.rule=Path(`/redis-secure`)" - "traefik.http.routers.router-bar.entrypoints=web" - "traefik.http.routers.router-bar.middlewares=crowdsec-bar@docker" # Definition of the service @@ -64,11 +67,14 @@ services: # crowdseclapikey must be uniq to the middleware attached to the service - "traefik.http.middlewares.crowdsec-bar.plugin.bouncer.crowdseclapikey=44c36dac5c4140af9f06f397508e82c7" - "traefik.http.middlewares.crowdsec-bar.plugin.bouncer.rediscacheenabled=true" + - "traefik.http.middlewares.crowdsec-bar.plugin.bouncer.redisCachePassword=FIXME" + # Contact redis-secure with password + - "traefik.http.middlewares.crowdsec-bar.plugin.bouncer.redisCacheHost=redis-secure:6379" - "traefik.http.middlewares.crowdsec-bar.plugin.bouncer.loglevel=DEBUG" crowdsec: - image: crowdsecurity/crowdsec:v1.4.3 + image: crowdsecurity/crowdsec:v1.4.6 container_name: "crowdsec" restart: unless-stopped environment: @@ -84,18 +90,27 @@ services: labels: - "traefik.enable=false" - redis: - image: "redis:7.0.5-alpine" - container_name: "redis" + redis-secure: + image: "redis:7.0.9-alpine" + container_name: "redis-secure" + hostname: redis-secure restart: unless-stopped - command: "redis-server --save 60 1" + command: "redis-server --save 60 1 --loglevel debug --requirepass FIXME" volumes: - - redis-data:/data - ports: - - 6379:6379 + - redis-secure-data:/data + + redis-insecure: + image: "redis:7.0.9-alpine" + container_name: "redis-insecure" + hostname: redis-unsecure + restart: unless-stopped + command: "redis-server --save 60 1 --loglevel debug" + volumes: + - redis-unsecure-data:/data volumes: logs-redis: crowdsec-db-redis: crowdsec-config-redis: - redis-data: + redis-unsecure-data: + redis-secure-data: diff --git a/go.mod b/go.mod index 04f2937..cb79c13 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.19 require ( github.com/leprosus/golang-ttl-map v1.1.7 - github.com/maxlerebourg/simpleredis v1.0.5 + github.com/maxlerebourg/simpleredis v1.0.6 ) diff --git a/go.sum b/go.sum index 53f61ad..18ebd7d 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ github.com/leprosus/golang-ttl-map v1.1.7 h1:cF4AAFDDnJTFSV+/42sKLhmMluvLdRlCGS2UaifH6UM= github.com/leprosus/golang-ttl-map v1.1.7/go.mod h1:4QWHJPeVBbrkhOhXdhCv9IEiyj/YzkO04/iexy4vSe0= -github.com/maxlerebourg/simpleredis v1.0.5 h1:1ubyIpTgIb+dadpILivAxuhZTHOOapEHRhcMakveuYY= -github.com/maxlerebourg/simpleredis v1.0.5/go.mod h1:/DH8zOK6kDskSqoX/m5CJJdNGfkIQZd/ERBJgytDDSk= +github.com/maxlerebourg/simpleredis v1.0.6 h1:dKd0hgKk7uGKjujWUMuPTVOAONYdlCys5Iqh6w3dOU4= +github.com/maxlerebourg/simpleredis v1.0.6/go.mod h1:/DH8zOK6kDskSqoX/m5CJJdNGfkIQZd/ERBJgytDDSk= diff --git a/vendor/github.com/maxlerebourg/simpleredis/README.md b/vendor/github.com/maxlerebourg/simpleredis/README.md index 30fd3fe..284dade 100644 --- a/vendor/github.com/maxlerebourg/simpleredis/README.md +++ b/vendor/github.com/maxlerebourg/simpleredis/README.md @@ -1,6 +1,7 @@ # simpleredis Minimal go redis with only `get`, `set` and `delete` operation. -With **NO** extern dependencies. +It supports password authentication with redis. +With **NO** external dependencies. ## Example ```go @@ -26,4 +27,5 @@ if err != nil { ``` ## Author -Max Lerebourg @ [Primadviz.com](https://primadviz.com) \ No newline at end of file +Max Lerebourg @ [Primadviz.com](https://primadviz.com) +Mathieu Hanotaux \ No newline at end of file diff --git a/vendor/github.com/maxlerebourg/simpleredis/simpleredis.go b/vendor/github.com/maxlerebourg/simpleredis/simpleredis.go index ec21873..dff464c 100644 --- a/vendor/github.com/maxlerebourg/simpleredis/simpleredis.go +++ b/vendor/github.com/maxlerebourg/simpleredis/simpleredis.go @@ -81,8 +81,9 @@ func askRedis(sr *SimpleRedis, cmd redisCmd, channel chan redisCmd) { channel <- redisCmd{Error: fmt.Errorf(RedisNoAuth)} return } - break } + // breaks out of for + break } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 7045931..dccd597 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,6 +1,6 @@ # github.com/leprosus/golang-ttl-map v1.1.7 ## explicit; go 1.15 github.com/leprosus/golang-ttl-map -# github.com/maxlerebourg/simpleredis v1.0.5 +# github.com/maxlerebourg/simpleredis v1.0.6 ## explicit; go 1.19 github.com/maxlerebourg/simpleredis