forked from mtusi2026/mtusi2026lab7
lab7: TLS ко всем зависимостям и телеметрии; раздельные роли PostgreSQL (GRANT по коду), ACL Valkey, AMQPS, HTTPS S3, mTLS Collector/Prometheus/Loki/Tempo/Grafana
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# Entry point of the compose service `valkey` (lab 7). Writes the ACL file from the Docker secret and
|
||||
# starts Valkey through the image's entrypoint (which drops root to the valkey user).
|
||||
# user default off no anonymous/shared-password access at all
|
||||
# user api SHA-256 of its password only (the plain password never lands in a file here),
|
||||
# keys session:* (sessions.py) and ratelimit:* (login limit), commands it uses:
|
||||
# GET/SET/DEL (sessions), INCR/PEXPIRE/PTTL in MULTI/EXEC (rate limit), PING
|
||||
# (readiness), CLIENT SETINFO (sent by redis-py on connect). FLUSHALL, CONFIG,
|
||||
# KEYS, DEBUG, ACL, ... are refused with NOPERM.
|
||||
set -eu
|
||||
umask 077
|
||||
mkdir -p /tmp/valkey
|
||||
hash="$(tr -d '\r\n' < /run/secrets/valkey_api_password | sha256sum | cut -d' ' -f1)"
|
||||
printf 'user default off\n' > /tmp/valkey/users.acl
|
||||
printf 'user api on #%s resetkeys ~session:* ~ratelimit:* resetchannels -@all +get +set +del +incr +pexpire +pttl +multi +exec +discard +ping +client|setinfo\n' \
|
||||
"$hash" >> /tmp/valkey/users.acl
|
||||
chown -R valkey /tmp/valkey
|
||||
exec docker-entrypoint.sh valkey-server /etc/valkey/valkey.conf
|
||||
Reference in New Issue
Block a user