Skip to content

Commit 64a8e11

Browse files
committed
ENT-4231: Preserve the 'pg_hba.conf' file on upgrades
This file defines access control for PostgreSQL and must be preserved on upgrade. It may be granting extra access (e.g. in the HA setup), but it may also be blocking some of the defaults. Changelog: None
1 parent 0196880 commit 64a8e11

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packaging/common/cfengine-hub/postinstall.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,10 @@ if [ ! -d $PREFIX/state/pg/data ]; then
399399
cp -a "$new_pgconfig_file" $PREFIX/state/pg/data/postgresql.conf
400400
chown cfpostgres $PREFIX/state/pg/data/postgresql.conf
401401
else
402+
# Always use the original pg_hba.conf file, it defines access control to PostgreSQL
403+
cp -a "$BACKUP_DIR/data/pg_hba.conf" "$PREFIX/state/pg/data/pg_hba.conf"
404+
chown cfpostgres "$PREFIX/state/pg/data/pg_hba.conf"
405+
402406
# Determine which postgresql.conf file to use and put it in the right place.
403407
if [ -f "$BACKUP_DIR/data/postgresql.conf.modified" ]; then
404408
# User-modified file from the previous old version of CFEngine exists, try to use it.

0 commit comments

Comments
 (0)