Admin-Ahead Community

Linux => Control Panels => cPanel => Topic started by: joseletk on April 28, 2018, 10:01:40 am

Title: cPanel overwriting pg_hba.conf file
Post by: joseletk on April 28, 2018, 10:01:40 am
This article describes and solves (work-around) a problems with PostgreSQL and cPanel. The issue is that cPanel modifies the file “/var/lib/pgsql/9.4/data/pg_hba.conf” setting it back to a default state.

By setting that file to your liking such as the following:

Code: [Select]
local all  all        md5
host samerole all  127.0.0.200   255.255.255.255   pam  pamservice=postgresql_cpses
host all all  127.0.0.1   255.255.255.255   md5
local all postgres        md5
host all postgres  127.0.0.1   255.255.255.255   md5

And setting it’s permissions to read-only:

Code: [Select]
chattr -ia /var/lib/pgsql/9.4/data/pg_hba.conf
If you need to make future changes to the above file, first reset it’s permissions using the following:

Code: [Select]
chattr +ia /var/lib/pgsql/9.4/data/pg_hba.conf
You should be able to move on without cPanel tripping you over in future.

You’ll need to restart PostgreSQL:

Code: [Select]
/etc/init.d/postgresql-9.4 status
/etc/init.d/postgresql-9.4 restart
===========================================================================