Re: “tlsv1 alert unknown ca” with PQconnectdb

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: M Tarkeshwar Rao <m(dot)tarkeshwar(dot)rao(at)ericsson(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>, Avinesh Kumar <avinesh(dot)kumar(at)ericsson(dot)com>, Kirti Dhar Upadhyay K <kirti(dot)k(dot)dhar(dot)upadhyay(at)ericsson(dot)com>, Neeraj Gupta G <neeraj(dot)g(dot)gupta(at)ericsson(dot)com>
Subject: Re: “tlsv1 alert unknown ca” with PQconnectdb
Date: 2021-08-04 17:38:41
Message-ID: 2004795.1628098721@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

M Tarkeshwar Rao <m(dot)tarkeshwar(dot)rao(at)ericsson(dot)com> writes:
> I am trying psql with following options where I am providing client certificates also. It is connected perfectly.
> psql "host= 10.10.11.18 sslmode=verify-ca sslrootcert=em-ca-crt.pem sslcert=em-client-crt.pem sslkey=em-client-key.pem port=5433 user=postgres dbname=postgres"

You do realize that those certificate parameters are path names, right?

> Same when we used with C api (PQconnectdb((const char *)str);) it is failing with following error message.
> “tlsv1 alert unknown ca” <https://serverfault.com/questions/793260/what-does-tlsv1-alert-unknown-ca-mean>

I think the most likely theory is that libpq is failing to load the root
cert because the program's current working directory isn't the same as
where you had been running psql. It does look like libpq will complain
if the given files aren't readable, so maybe the true situation is that
it's finding files by those names but they aren't the right ones.

In any case, you generally want to put absolute pathnames into these
connection parameters.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vijaykumar Jain 2021-08-04 17:50:09 Re: Unexpected block ID found when reading data
Previous Message M Tarkeshwar Rao 2021-08-04 14:08:59 “tlsv1 alert unknown ca” with PQconnectdb