PostgreSQL SSL Connection on EC2
I deployed Dataiku on an EC2 instance, it looks great!
Unfortunately, I can't connect to my Heroku PostgreSQL database because it forces the use of SSL.
How can I enable SSL for the PostgreSQL JDBC driver?
I have very little knowledge about servers beside ssh-ing into a machine.
I found this doc but I'm not even sure it's related at all: postgresql.org/docs/current/static/ssl-tcp.html
(here we just want the driver to connect through SSL not setup SSL for postgres I guess)
[Copy/Pasting the error message here to be referenced in Google when someone has the same issue: FATAL: no pg_hba.conf entry for host "....", user "...", database "...", SSL off]
Best Answer
-
Hi,
You need to add the "ssl" property (in the connection page) and set it to "true"
Note that you also need either to properly setup client certificates (as instructed here: https://jdbc.postgresql.org/documentation/91/ssl-client.html), or, if you want to disable validation (although this negates part of the security), add another property:
sslfactory = org.postgresql.ssl.NonValidatingFactory
Answers
-
Many thanks for the quick reply Clément! That worked!
(I tried the easy solution, disabling validation)