forked from mtusi2026/mtusi2026lab7
solution
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
dir /data
|
||||
appendonly yes
|
||||
appendfsync always
|
||||
maxmemory 256mb
|
||||
maxmemory-policy noeviction
|
||||
port 0
|
||||
tls-port 6379
|
||||
tls-cert-file /run/tls/server.crt
|
||||
tls-key-file /run/tls/server.key
|
||||
tls-ca-cert-file /run/tls/ca.crt
|
||||
tls-auth-clients no
|
||||
tls-protocols "TLSv1.2 TLSv1.3"
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
password_hash=$(tr -d '\r\n' </run/secrets/redis_password | sha256sum | cut -d ' ' -f 1)
|
||||
mkdir -p /run/redis
|
||||
umask 077
|
||||
printf 'user session on #%s ~session:* +get +set +del +ping +hello +select +client|setinfo\n' "$password_hash" >/run/redis/users.acl
|
||||
if [ -r /run/secrets/test_redis_password ]; then
|
||||
test_hash=$(sha256sum </run/secrets/test_redis_password | cut -d ' ' -f 1)
|
||||
printf 'user default reset on #%s ~* &* +@all\n' "$test_hash" >>/run/redis/users.acl
|
||||
else
|
||||
printf 'user default off\n' >>/run/redis/users.acl
|
||||
fi
|
||||
chown redis:redis /run/redis/users.acl
|
||||
chmod 600 /run/redis/users.acl
|
||||
exec /usr/local/bin/docker-entrypoint.sh redis-server /usr/local/etc/redis/redis.conf --aclfile /run/redis/users.acl
|
||||
Reference in New Issue
Block a user