From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Keep current ssl_sni setting on SSL config reload failure
Date: Tue, 06 Oct 2026 11:52:32 +0000
Message-ID: <E1xE3ii-00000000Y1O-1Nn9@gemulon.postgresql.org> (raw)
Keep current ssl_sni setting on SSL config reload failure
When reloading the SSL configuration fails, the existing config is
left in place to keep the server from being inaccessible. The GUC
backing SNI, ssl_sni, was however changed. This could lead to new
connections trying to access non-existing configurations. Fix by
storing the ssl_sni setting at the time of initialization in the
hosts context and only use the stored value during the handshake.
The patch submitted by the reporter has been significantly reworked
and expanded. Additional test cases written by Rui Zhao.
Author: Anthropic OSS program
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Rui Zhao <zhaorui126@gmail.com>
Reported-by: Anthropic OSS program
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Rui Zhao <zhaorui126@gmail.com>
Discussion: https://postgr.es/m/20260920211619.9c.noahmisch@microsoft.com
Backpatch-through: 19
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/b6adefc659c70a371d860f5a90160af2c254f357
Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 26 +++++-
src/test/ssl/t/004_sni.pl | 157 +++++++++++++++++++++++++++++++++-
src/test/ssl/t/SSL/Server.pm | 4 +
3 files changed, 184 insertions(+), 3 deletions(-)
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-committers@postgresql.org
Cc: dgustafsson@postgresql.org
Subject: Re: pgsql: Keep current ssl_sni setting on SSL config reload failure
In-Reply-To: <E1xE3ii-00000000Y1O-1Nn9@gemulon.postgresql.org>
References: <E1xE3ii-00000000Y1O-1Nn9@gemulon.postgresql.org>
* 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