24 lines
811 B
Bash
Executable File
24 lines
811 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
umask 077
|
|
mkdir -p secrets/lab4
|
|
if [ ! -f .env.lab4 ]; then
|
|
{ printf 'POSTGRES_PASSWORD='; openssl rand -hex 24
|
|
printf 'REDIS_PASSWORD='; openssl rand -hex 24
|
|
printf 'HOST_PORT=18081\nAPI_REPLICAS=2\n'
|
|
} > .env.lab4
|
|
fi
|
|
if [ ! -f secrets/lab4/private_key.pem ]; then
|
|
openssl genrsa -out secrets/lab4/private_key.pem 2048 2>/dev/null
|
|
fi
|
|
if [ ! -f secrets/lab4/public_key.pem ]; then
|
|
openssl rsa -in secrets/lab4/private_key.pem -pubout -out secrets/lab4/public_key.pem 2>/dev/null
|
|
fi
|
|
# Only synthetic stand keys, readable by the non-root application inside containers.
|
|
chmod 755 secrets secrets/lab4
|
|
chmod 444 secrets/lab4/*.pem
|
|
printf '%s\n' 'Local lab4 settings and synthetic keys ready; existing files preserved.'
|
|
|
|
python3 scripts/bootstrap-storage.py
|