简体   繁体   中英

“HostName not verified error message” on SSL connection in postgresql

I created server.crt , server.key and root.crt files on Centos 7 and put the same onto the C:\\Users\\xxxx\\AppData\\Roaming\\postgresql folder in windows as i am running the postgresql server on windows. Now on running my applications using SSL, i am getting the error as

"The host name could not be verified"

Any help please.

I am using JetBrains Data Grip to access Postgres dbs on Heroku, and got the same error in the latest JDBC driver version. That's how I solved it (using answers provided here).

Set the following in the Advanced tab:

ssl=true

sslmode=require

sslfactory=org.postgresql.ssl.NonValidatingFactory

(I updated sslmode value from verify-ca to required because it works with Heroku Postgres now)

如果您不关心主机名验证但仍想使用证书,则可以使用附加参数sslmode=verify-ca作为连接参数或作为 URL 的一部分来禁用主机名验证,同时保留证书验证。

To use the PostgreSQL JDBC driver without server certificate validation, use

sslfactory=org.postgresql.ssl.NonValidatingFactory

as connection parameter or as part of the URL as described in the documentation .

With later versions of the JDBC driver, you have to specify

sslmode=require

because the default value verify-full means that the client wants to check the certificate and identity of the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM