25 lines
898 B
Bash
Executable File
25 lines
898 B
Bash
Executable File
#!/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 "$@"
|