Re: [HACKERS] Trust intermediate CA for client certificates

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Ian Pilcher <arequipeno(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us, stellr(at)vt(dot)edu, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Trust intermediate CA for client certificates
Date: 2013-03-18 01:54:34
Message-ID: 514673DA.4030000@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 03/09/2013 04:52 PM, Ian Pilcher wrote:
> 3. Once the root CA certificate is trusted, however, the "bad" client
> can also connect by using a certificate chain that includes the
> Server CA certificate --"cat bad-client.crt server-ca.crt >
> ~/.postgresql/postgresql.crt".
>
> After looking at be-secure.c and investigating the way that OpenSSL
> validates certificates, I do not believe that there is any way of
> achieving the desired behavior with the current codebase.
I'm testing this and looking into it now.

At first glance this looks like a genuine problem. We need to be storing
the certs used for validating client cert auth separately from the
certificate chain that links those certs to trusted self-signed CA
roots. I was under the strong impression that OpenSSL would do this if
the client validation certs were in root.crt and the certificate chain
was in OpenSSL's certificate search path and am testing that now. Even
if that's the case we need to at least document this issue and
preferably detect the case where root.crt contains a certificate chain.

If this tests out as expected you need to consider the effects it'd have
on people who're not using self-signed CAs, but are instead using certs
signed by big CAs. *Any other customer of the same CA could potentially
connect to your server with a genuine, valid client cert issued to them
by the CA*. Ouch.

I'm going through and reproducing the problem now and will also test
OpenSSL certificate chain lookup path configurations to see if there's a
way to set things up correctly with the current backend code. I'll
report back shortly.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adam Zegelin 2013-03-18 04:09:22 Enforcing Parameterised Nested Loop Join Order for Foreign Table Joins
Previous Message Pawel Veselov 2013-03-17 21:57:13 ORDER BY expression required in SELECT if DISTINCT

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-03-18 02:52:11 Re: Strange Windows problem, lock_timeout test request
Previous Message Greg Smith 2013-03-18 00:50:11 Re: Enabling Checksums