How to overcome database connection failure for Postgres DB collectors in RSA Via Lifecycle and Governance
2 years ago
Originally Published: 2016-06-27
Article Number
000049573
Applies To
RSA Product Set: RSA Via Lifecycle and Governance (RSA Via L&G)
RSA Version/Condition: All Versions
Platform: Linux
O/S Version: Red Hat Enterprise Linux 6.8
Issue
When testing a Postgres DB collector (click on the collector definition -> click on Test), the database connection fails for the Postgres database with the following error:
 
Caused by: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "<IP address of host>", user "rbacxintegration", database "infosecdata", SSL off at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:415) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:188)
Cause
PostgreSQL has a list of allowed IP addresses that are configured in pg_hba.conf, that allow access to the database server. This error occurs because there is a missing entry for the host. The error indicates that the authentication settings you are trying to use are not matched on the endpoint pg_hba.conf file.
Resolution
Add the following as the first line of pg_hba.conf. It allows access to all databases for all users with an encrypted password:
# TYPE DATABASE USER CIDR-ADDRESS  METHOD
host  all  all 0.0.0.0/0 md5


You need to enter the IP address of the computer on which your application is running.  For example, if your IP address is 192.168.123.250, enter it in pg_hba.conf as 192.168.123.0. The .0 acts a wildcard in case your computer is assigned a new IP address at a later time (hopefully it will be in the same range as the original.)

Once the above line is added in pg_hba.conf, PostgreSQL needs to be restarted using the command:

/etc/init.d/postgresql restart