fix ph_hba

This commit is contained in:
Bernhard Radermacher
2026-02-19 13:01:34 +01:00
parent a5493c2553
commit b49a95fe25

View File

@@ -14,33 +14,22 @@ if [[ -z $UPSTREAM ]]; then
echo "max_wal_senders = 10" >> /var/lib/postgresql/data/postgresql.conf echo "max_wal_senders = 10" >> /var/lib/postgresql/data/postgresql.conf
echo "max_replication_slots = 10" >> /var/lib/postgresql/data/postgresql.conf echo "max_replication_slots = 10" >> /var/lib/postgresql/data/postgresql.conf
# ensure required entries in hba # ensure required entries in hba
local all all trust echo "local all all trust" > /var/lib/postgresql/data/pg_hba.conf
# IPv4 local connections: echo "local replication repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf
host all all 127.0.0.1/32 trust echo "host replication repmgr 127.0.0.1/32 trust" >> /var/lib/postgresql/data/pg_hba.conf
# IPv6 local connections: echo "host replication repmgr 100.64.0.0/10 trust" >> /var/lib/postgresql/data/pg_hba.conf
host all all ::1/128 trust echo "local repmgr repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf
# Allow replication connections from localhost, by a user with the echo "host repmgr repmgr 127.0.0.1/32 trust" >> /var/lib/postgresql/data/pg_hba.conf
# replication privilege. echo "host repmgr repmgr 100.64.0.0/10 trust" >> /var/lib/postgresql/data/pg_hba.conf
local replication all trust echo "host all all all scram-sha-256" >> /var/lib/postgresql/data/pg_hba.conf
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 replication repmgr 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 "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 "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 "host repmgr repmgr ${NETWORK:-100.64.0.0/10} trust" >> /var/lib/postgresql/data/pg_hba.conf
# create user for replication # 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 "CREATE DATABASE repmgr WITH OWNER repmgr;"
psql -c 'ALTER USER repmgr SET search_path TO repmgr, "$user", public;' psql -c 'ALTER USER repmgr SET search_path TO repmgr, "$user", public;'