head-vps/rustfs/start.sh

11 lines
513 B
Shell
Executable file

#!/bin/sh
# Starts RustFS as its own user (10001) with the root credentials from fnox.toml. Runs as root only to
# read the host age key; the key never reaches the rustfs user, only the two credentials do.
set -eu
cd /head
K="$(cat /run/secrets/age_key)"
RUSTFS_ACCESS_KEY="$(FNOX_AGE_KEY="$K" fnox get RUSTFS_ROOT_ACCESS_KEY)"
RUSTFS_SECRET_KEY="$(FNOX_AGE_KEY="$K" fnox get RUSTFS_ROOT_SECRET_KEY)"
unset K
export RUSTFS_ACCESS_KEY RUSTFS_SECRET_KEY
exec su -p -s /bin/sh rustfs -c 'exec /entrypoint.sh rustfs'