Skip to content

Commit 256f752

Browse files
authored
fix: don't use ACLs by default, set redis password for optimized ACLs config, fixes #43 (#44)
1 parent 927e85b commit 256f752

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@ Redis is available inside Docker containers with `redis:6379`.
3737

3838
## Redis Credentials
3939

40-
| Field | Value |
41-
|----------|-----------------------|
42-
| Username | `redis` |
43-
| Password | `` (empty by default) |
40+
By default, no authentication is required.
41+
42+
If you have the optimized config enabled (`ddev dotenv set .ddev/.env.redis --redis-optimized=true`), the credentials are:
43+
44+
| Field | Value |
45+
|----------|---------|
46+
| Username | `redis` |
47+
| Password | `redis` |
48+
49+
For more information about ACLs, see the [Redis documentation](https://redis.io/docs/latest/operate/oss_and_stack/management/security/acl/).
4450

4551
## Advanced Customization
4652

@@ -49,6 +55,11 @@ To apply an optimized configuration from `ddev/ddev-redis-7`:
4955
```bash
5056
ddev dotenv set .ddev/.env.redis --redis-optimized=true
5157
ddev add-on get ddev/ddev-redis
58+
59+
# (optional) if you have an existing Redis volume, delete it to avoid problems with Redis:
60+
ddev stop
61+
docker volume rm ddev-$(ddev status -j | docker run -i --rm ddev/ddev-utilities jq -r '.raw.name')_redis
62+
5263
ddev restart
5364
```
5465

@@ -59,6 +70,11 @@ To change the used Docker image:
5970
```bash
6071
ddev dotenv set .ddev/.env.redis --redis-docker-image=redis:7
6172
ddev add-on get ddev/ddev-redis
73+
74+
# (optional) if you have an existing Redis volume, delete it to avoid problems with Redis:
75+
ddev stop
76+
docker volume rm ddev-$(ddev status -j | docker run -i --rm ddev/ddev-utilities jq -r '.raw.name')_redis
77+
6278
ddev restart
6379
```
6480

commands/redis/redis-cli

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
## Example: "ddev redis-cli KEYS *" or "ddev redis-cli INFO" or "ddev redis-cli --version"
77
## Aliases: redis
88

9-
redis-cli -p 6379 -h redis -a "" --no-auth-warning "$@"
10-
9+
if [ -f /etc/redis/conf/security.conf ]; then
10+
redis-cli -p 6379 -h redis -a redis --no-auth-warning $@
11+
else
12+
redis-cli -p 6379 -h redis $@
13+
fi

commands/redis/redis-flush

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
## Usage: redis-flush
66
## Example: "ddev redis-flush"
77

8-
redis-cli -a "" --no-auth-warning FLUSHALL ASYNC
8+
if [ -f /etc/redis/conf/security.conf ]; then
9+
redis-cli -p 6379 -h redis -a redis --no-auth-warning FLUSHALL ASYNC
10+
else
11+
redis-cli -p 6379 -h redis FLUSHALL ASYNC
12+
fi

redis/redis.conf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,3 @@ maxmemory-policy allkeys-lfu
1111
# and uncomment the two lines below:
1212
#appendonly no
1313
#save ""
14-
15-
# user config ending with "on >" means empty password
16-
# user config ending with "on >redis" means "redis" password
17-
user default ~* &* +@all on >
18-
user redis ~* &* +@all on >

redis/security.conf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# can be easily a long string from /dev/urandom or whatever, so by using a
1010
# long and unguessable password no brute force attack will be possible.
1111

12-
# user config ending with "on >" means empty password
1312
# user config ending with "on >redis" means "redis" password
14-
user default ~* &* +@all on >
15-
user redis ~* &* +@all on >
13+
user default ~* &* +@all on >redis
14+
user redis ~* &* +@all on >redis

0 commit comments

Comments
 (0)