From b49a95fe25476da5e6565d88f66d7618fbcc7c22 Mon Sep 17 00:00:00 2001 From: Bernhard Radermacher Date: Thu, 19 Feb 2026 13:01:34 +0100 Subject: [PATCH] fix ph_hba --- docker-entrypoint-initdb.d/00-main.sh | 37 ++++++++++----------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/docker-entrypoint-initdb.d/00-main.sh b/docker-entrypoint-initdb.d/00-main.sh index c88edcf..fef8363 100755 --- a/docker-entrypoint-initdb.d/00-main.sh +++ b/docker-entrypoint-initdb.d/00-main.sh @@ -14,33 +14,22 @@ if [[ -z $UPSTREAM ]]; then echo "max_wal_senders = 10" >> /var/lib/postgresql/data/postgresql.conf echo "max_replication_slots = 10" >> /var/lib/postgresql/data/postgresql.conf # ensure required entries in hba -local all all trust -# IPv4 local connections: -host all all 127.0.0.1/32 trust -# IPv6 local connections: -host all all ::1/128 trust -# Allow replication connections from localhost, by a user with the -# replication privilege. -local replication all trust -host replication all 127.0.0.1/32 trust -host replication all ::1/128 trust - -local replication repmgr trust -host replication repmgr 127.0.0.1/32 trust -host replication repmgr 100.64.0.0/10 trust -local repmgr repmgr trust -host repmgr repmgr 127.0.0.1/32 trust -host repmgr repmgr 100.64.0.0/10 trust -host all all all scram-sha-256 + echo "local all all trust" > /var/lib/postgresql/data/pg_hba.conf + echo "local replication repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf + echo "host replication repmgr 127.0.0.1/32 trust" >> /var/lib/postgresql/data/pg_hba.conf + echo "host replication repmgr 100.64.0.0/10 trust" >> /var/lib/postgresql/data/pg_hba.conf + echo "local repmgr repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf + echo "host repmgr repmgr 127.0.0.1/32 trust" >> /var/lib/postgresql/data/pg_hba.conf + echo "host repmgr repmgr 100.64.0.0/10 trust" >> /var/lib/postgresql/data/pg_hba.conf + echo "host all all all scram-sha-256" >> /var/lib/postgresql/data/pg_hba.conf - - echo "local replication repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf - echo "host replication repmgr ${NETWORK:-100.64.0.0/10} trust" >> /var/lib/postgresql/data/pg_hba.conf - echo "local repmgr repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf - echo "host repmgr repmgr ${NETWORK:-100.64.0.0/10} trust" >> /var/lib/postgresql/data/pg_hba.conf +# echo "local replication repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf +# echo "host replication repmgr ${NETWORK:-100.64.0.0/10} trust" >> /var/lib/postgresql/data/pg_hba.conf +# echo "local repmgr repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf +# echo "host repmgr repmgr ${NETWORK:-100.64.0.0/10} trust" >> /var/lib/postgresql/data/pg_hba.conf # create user for replication - psql -c "CREATE USER repmgr WITH REPLICATION ENCRYPTED PASSWORD '${REPLICATOR_PASSWORD}';" + psql -c "CREATE USER repmgr WITH SUPERUSER ENCRYPTED PASSWORD '${REPLICATOR_PASSWORD}';" psql -c "CREATE DATABASE repmgr WITH OWNER repmgr;" psql -c 'ALTER USER repmgr SET search_path TO repmgr, "$user", public;'