Re: Adding support for SSLKEYLOGFILE in the frontend

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, Abhishek Chanda <abhishek(dot)becs(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding support for SSLKEYLOGFILE in the frontend
Date: 2025-03-26 22:28:44
Message-ID: A5B2694E-5862-4535-9A1E-BE6044CCCF69@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 20 Mar 2025, at 10:39, Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:

> In initialize_SSL(), the test for conn->sslkeylogfile is inside the
> #ifdef for the existance of the SSL function. I think it's better to
> log a message (probably just a warning) that says "this feature is not
> supported with this TLS library" rather than doing nothing. Silently
> failing to act is just painful for the user who then has to go to our
> source file to figure out why the setting isn't taking effect.

The only cases when the function isn't defined are the two oldest LibreSSL
versions we support, but even with a LibreSSL version that does have the
function the code is dead since LibreSSL only implements stubs for OpenSSL
compatibility. This is documented in our docs, but we might as well help the
user further by logging a warning as you suggest. The attached v10 adds a
version for the two cases when key logging won't happen (in reality it will be
just one case for LibreSSL but with this we can handle a purpose built OpenSSL
without the callback).

--
Daniel Gustafsson

Attachment Content-Type Size
v10-0001-libpq-Add-support-for-dumping-SSL-keylog-to-file.patch application/octet-stream 9.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-03-26 22:34:19 Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available
Previous Message Michael Paquier 2025-03-26 22:20:25 Re: Remove useless casts to (char *)