From: Thomas Guyot <tguyot@gmail.com>
To: Rejo Oommen <rejo.oommen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Is Client connections via ca.crt only possible?
Date: Wed, 3 Aug 2022 17:31:22 -0400
Message-ID: <d8b05b17-544e-13c5-a4df-d03d0a9e4761@gmail.com> (raw)
In-Reply-To: <CAFiZ60hyT7wJ+jtSiJ3UjE92jCK43cqOF0cxmmkwq8Q+EnkSqw@mail.gmail.com>
References: <CAFiZ60hyT7wJ+jtSiJ3UjE92jCK43cqOF0cxmmkwq8Q+EnkSqw@mail.gmail.com>
On 2022-08-01 04:12, Rejo Oommen wrote:
> Requirement is to use only ca.crt and connect to postgres
>
> Server.crt, Server.key and ca.crt are configured at the postgres
> server for tls connection.
>
> Connection successful while using
> psql ‘host=172.29.21.222 dbname=test user=postgres sslmode=verify-ca
> sslcert=/tmp/server.crt sslkey=/tmp/server.key sslrootcert=/tmp/ca.crt
> port=5432’
>
> For clients to connect, can they use only ca.crt and connect to the
> DB. Tried and got the below error
>
> psql ‘host=172.29.21.222 dbname=test user=postgres sslmode=verify-ca
> sslrootcert=/tmp/ca.crt port=5432’
> psql: error: connection to server at “172.29.21.222”, port 50001
> failed: FATAL: connection requires a valid client certificate
>
Hi Rejo,
I don't think you understand fully how mutual TLS auth works. For the
client to authenticate using a certificate, it needs a valid certificate
and key too, where the certificate is signed by a CA your server trusts
(usually the same CA that signed your server cert) and with a proper
subject (that bears the certificate owner's user name, the user you will
use to grant privileges in the database). You shouldn't even need to
pass a username, it will be in the certificate.
I'm talking purely from a generic view, I'm not familiar with any of the
specifics of PostgreSQL configuration but TLS authentication requires a
secret and a CA certificate isn't secret. Your server certificate
authenticates the server, but nothing authenticates the client.
Regards,
--
Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tguyot@gmail.com, rejo.oommen@gmail.com
Subject: Re: Is Client connections via ca.crt only possible?
In-Reply-To: <d8b05b17-544e-13c5-a4df-d03d0a9e4761@gmail.com>
References: <CAFiZ60hyT7wJ+jtSiJ3UjE92jCK43cqOF0cxmmkwq8Q+EnkSqw@mail.gmail.com> <d8b05b17-544e-13c5-a4df-d03d0a9e4761@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox