forked from mtusi2026/mtusi2026lab7
skeleton lab7 and tasks for grade 3
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
for role in api worker publisher cleanup; do
|
||||
# psql читает пароль из файла. SQL и значения остаются внутри контейнера.
|
||||
ROLE="$role" psql --no-psqlrc --quiet --set=ON_ERROR_STOP=1 \
|
||||
--username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<'SQL'
|
||||
\getenv role ROLE
|
||||
SELECT format('CREATE ROLE %I LOGIN PASSWORD %L', :'role',
|
||||
trim(pg_read_file('/run/roles/' || :'role'))) \gexec
|
||||
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
|
||||
SQL
|
||||
done
|
||||
@@ -0,0 +1,3 @@
|
||||
local all all trust
|
||||
hostssl all all all scram-sha-256
|
||||
hostnossl all all all reject
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
install -d -m 0700 -o postgres -g postgres /run/postgres-tls
|
||||
install -m 0600 -o postgres -g postgres /run/tls/server.key /run/postgres-tls/server.key
|
||||
exec /usr/local/bin/docker-entrypoint.sh postgres \
|
||||
-c ssl=on -c ssl_min_protocol_version=TLSv1.2 \
|
||||
-c ssl_cert_file=/run/tls/server.crt -c ssl_key_file=/run/postgres-tls/server.key \
|
||||
-c hba_file=/etc/postgres/pg_hba.conf
|
||||
Reference in New Issue
Block a user