forked from mtusi2026/mtusi2026lab7
lab7: PKI, mTLS infra, OpenBao non-dev, hardening, lifecycle scripts
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# Seeds minimal /data/users.acl on a fresh Redis volume (user default off,
|
||||
# redis_admin, redis_health) without printing secrets, then starts redis-server.
|
||||
# Application ACL user (messenger_api) is converged by scripts/openbao-bootstrap.sh
|
||||
# via live `ACL SETUSER` + `ACL SAVE`.
|
||||
set -eu
|
||||
|
||||
acl_file=/data/users.acl
|
||||
if [ ! -s "$acl_file" ]; then
|
||||
IFS= read -r admin_pass < /run/secrets/redis_admin_password || [ -n "$admin_pass" ]
|
||||
IFS= read -r health_pass < /run/secrets/redis_health_password || [ -n "$health_pass" ]
|
||||
(
|
||||
umask 077
|
||||
tmp="${acl_file}.tmp.$$"
|
||||
{
|
||||
printf 'user default off\n'
|
||||
printf 'user redis_admin on >%s ~* &* +@all\n' "$admin_pass"
|
||||
printf 'user redis_health on >%s -@all +ping +hello +client|setinfo +quit\n' "$health_pass"
|
||||
} > "$tmp"
|
||||
mv "$tmp" "$acl_file"
|
||||
)
|
||||
fi
|
||||
|
||||
exec redis-server "$@"
|
||||
Reference in New Issue
Block a user