#!/bin/sh # Operator bootstrap, idempotent, nothing printed: local PKI, random service passwords, Redis ACL file, .env. All under ./secrets (0700, ignored by Git). set -eu cd "$(dirname "$0")/.." S="${SECRETS_DIR:-secrets}"; O="$S/ops" umask 077; mkdir -p "$O"; chmod 700 "$S" gen() { [ -s "$O/$1" ] || { openssl rand -base64 36 | tr -d '/+=\n' | cut -c1-32 > "$O/$1"; }; } for n in postgres_password db_api_password db_worker_password db_dispatcher_password db_sweeper_password \ redis_api_password redis_health_password s3_root_password s3_api_secret s3_worker_secret s3_sweeper_secret grafana_admin_password kafka_ssl_password; do gen "$n"; done sh scripts/pki.sh init [ -s "$O/s3_root_user" ] || printf 'root-%s' "$(openssl rand -hex 4)" > "$O/s3_root_user" h() { printf %s "$(cat "$O/$1")" | sha256sum | cut -d' ' -f1; } cat > "$O/redis_users.acl" <