Re: Proposal for implementing OCSP Stapling in PostgreSQL

From: David Zhang <idrawone(at)gmail(dot)com>
To: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: Proposal for implementing OCSP Stapling in PostgreSQL
Date: 2024-08-06 23:33:21
Message-ID: 573b873b-5c84-41ef-a2f9-6c598f485bd3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks a lot Jacob for helping update the tests and sorry for the late
reply.

Based on previous discussion, I remove the document patch, and start to
focus on the v1 simple OCSP logic by checking the leaf/Postgres server
certificate's status only
(0001-v1-WIP-OCSP-support-certificate-status-check.patch). I also merge
your changes and simplify the test by testing the Postgres server
certificate's status only
(0002-v1-WIP-OCSP-simplify-.res-generation-and-regress-tes.patch).

On 2024-07-18 10:18 a.m., Jacob Champion wrote:
>>> A question from ignorance: how does the client decide that the
>>> signature on the OCSP response is actually valid for the specific
>>> chain in use?
>> If I understand correctly, the certificate used by the OCSP responder to
>> sign the OCSP response must be valid for the specific chain in use, or
>> the admins allow to load a new chain to validate the certificate used to
>> sign the OCSP response. I think it would be better to make this part to
>> be more open.
> Okay. That part needs more design work IMO, and solid testing.
Based on the RFC here,
https://datatracker.ietf.org/doc/html/rfc6960#section-4.2.2.2. My
understanding is that the OCSP responder's certificate should be
directly signed by the same CA which signed the Postgres Server's
certificate. It looks the openssl 3.0.14 implements in this way. In
other words, it the OCSP responder's certificate is signed by a
different branch of the chain, then openssl will report some errors.
Unless the end user explicitly provides the OCSP responder's certificate
with trust_other option. In this case it will skip the some certificate
verification. I think it should be simple enough for v1 by set
`OCSP_basic_verify(basic_resp, NULL, trusted_store, 0)`.  The key
function OCSP_basic_verify is documented at here,
https://docs.openssl.org/3.0/man3/OCSP_resp_find_status/

Thank you,
David

Attachment Content-Type Size
0002-v1-WIP-OCSP-simplify-.res-generation-and-regress-tes.patch text/plain 11.9 KB
0001-v1-WIP-OCSP-support-certificate-status-check.patch text/plain 14.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2024-08-06 23:40:51 Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements
Previous Message Tomas Vondra 2024-08-06 23:23:17 Re: Instability with incremental backup tests (pg_combinebackup, 003_timeline.pl)