Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

psql: SSL error: certificate verify failed

I'm encountering a frustrating problem connecting to Heroku Postgres using psql and in psycopg2, on sslmode=require.

When connecting with the next examples on debian (python 2.7.13) I'm encountering the same problem of

psql: SSL error: certificate verify failed

psql:

psql "host=<MyHost> sslmode=require" --port=5432 --username=<MyUser> --password

Psycopg2:

import psycopg2
db_url =  "postgres://User:Pwd@Host:5432/DB?sslmode=require"
psycopg2.connect(db_url)

I tried to change the postgresql.conf and pg_hba.conf as described here: PSQL: SSL error: unknown protocol

No Luck.

My versions:

psycopg2=-2.6.2
OpenSSL=1.1.0j  20 Nov 2018
postgres=9.6
like image 814
Alon Reznik Avatar asked Jul 09 '26 23:07

Alon Reznik


1 Answers

Ok. I figured out that in my system, somehow there is a root.crt file in the ~/postgresql dir. The .crt file made the whole problem (it wasn't certificated to Heroku) and when I deleted it, the connection worked.

FYI

like image 130
Alon Reznik Avatar answered Jul 13 '26 20:07

Alon Reznik