Files
mtusi2026lab7/infra/postgres/entrypoint.sh
T

19 lines
560 B
Bash
Executable File

#!/bin/sh
# Copies read-only mounted TLS material into container-private tmpfs with 0600
# key permissions required by PostgreSQL under non-root UID 70:70.
set -eu
cert_dir=/var/run/postgresql/certs
mkdir -p "$cert_dir"
chmod 0700 "$cert_dir"
cp /run/certs/ca.crt "$cert_dir/ca.crt"
cp /run/certs/ca.crl "$cert_dir/ca.crl"
cp /run/certs/server.crt "$cert_dir/server.crt"
cp /run/certs/server.key "$cert_dir/server.key"
chmod 0644 "$cert_dir/ca.crt" "$cert_dir/ca.crl" "$cert_dir/server.crt"
chmod 0600 "$cert_dir/server.key"
exec docker-entrypoint.sh "$@"