3

I am trying to connect a Postgres database which resides in a docker installed on Ubuntu virtual machine. Following exception is being thrown on the console.

org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "10.1.X.X", user "usrXXX", database "dbXXX", SSL off

After going through various posts, I realised that I have to update pg_hba.conf file. I have modified the file to include the following settings.

host dbXXX usrXXX 10.1.X.X/32 trust

(Note I tried with md5 as well.)

I verified the postgres database settings through psql and executed commands as specified in this post. This verified that I am editing correct file. To take a step further, I also verified the entry through pgAdmin (pgAdmin is installed locally on postgres host) and found the following query is returning records as entered in pg_hba.conf

table pg_hba_file_rules;

enter image description here

Not sure where I am going wrong. Here is the preview of how everything is deployed.

enter image description here

closed as unclear what you're asking by Colin 't Hart, Max Vernon, Mr.Brownstone, hot2use, Philᵀᴹ Nov 25 '18 at 14:52

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Just to add on : Keycloak is able to make a connection, create tables and insert data :( It's the Springboot application sitting on another laptop getting an error. – CuriousMind Nov 15 '18 at 10:11
  • You have /32 on the end of the network address: only that host will be let in. – Colin 't Hart Nov 15 '18 at 11:59
  • You most likely specified the wrong source pattern. This can be a problem when working with NAT and Proxies. I would start with 0.0.0.0/0 and go from there. (And never use trust or ident for remote tcp) – eckes Nov 15 '18 at 12:01
  • @eckes tried with 0.0.0.0/0 CIDR too, but that didn't work. I know trust is bad, but I am trying to figure out if the application can at least make a connection first. Once it is able to, I will update the settings. – CuriousMind Nov 15 '18 at 12:34
  • @Colin'tHart unfortunately that host is not able to connect and thats valid CIDR :( – CuriousMind Nov 15 '18 at 12:35