I have got a Debian Jessie box with a PostgreSQL (9.4) database installed and configured to get SSL connection.
On Windows 10 box I'm writing a Java (1.8.0_111) application that connects to the database through SSL using PostgreSQL-JDBC driver (9.4.1211).
To let the application get a database certificate I did the following:
on the Debian Jessy box:
cp /etc/ssl/certs/ssl-cert-snakeoil.pem server.crt
openssl x509 -in server.crt -out server.crt.der -outform der
on the Windows 10 box:
cd C:\Program Files (x86)\Java\jre1.8.0_111\lib\security
keytool -keystore cacerts -alias postgresql -import -file server.crt.der
My application successfully connects to the database through SSL.
Than (to get more opportunities for debugging the application) I try to get connection to the database from Squirrel SQL (3.7.1) with the following configuration:
Squirrel SQL connection configuration:
Alias: hospice32_fr
Driver: PostgreSQL
URL: jdbc:postgresql://192.168.1.10/hospice_fr
User: hospice
Password: ****************
Squirrel SQL connection driver properties:
ssl: <checked> true
sslcert: <checked> C:\Program Files\Java\jre1.8.0_111\lib\security\cacerts
all the rest options are unchecked
Connection failed with such an error message:
java.util.concurrent.ExecutionException: java.lang.RuntimeException: org.postgresql.util.PSQLException: SSL error: sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[...]
I also tried to replace the sslcert property with <SOME_DIR>/server.crt.der and <SOME_DIR>/server.crt, to check PGDBNAME, PGHOST, PGPORT,user properties.
Result was the same: No connection.
Could anybody please help me to configure SquirrelSQL so than it can get connection to PostgreSQL through SSL.
Thank you, Mikhail.
|