pg.ddx.io  pgbouncer/pgbouncer GitHub issues and pull requests  
help / color / mirror / Atom feed
From: dubee (@dubee) <noreply+dubee@github.com>
To: pgbouncer/pgbouncer <noreply+pgbouncer-pgbouncer@github.com>
Subject: Re: [pgbouncer/pgbouncer] PR #1584: feat: add support for upstream TLSDirect
Date: Thu, 03 Sep 2026 21:19:21 +0000
Message-ID: <gh-pgbouncer-pgbouncer-1584-c5532276483@github.com> (raw)
In-Reply-To: <gh-pgbouncer-pgbouncer-1584@github.com>
References: <gh-pgbouncer-pgbouncer-1584@github.com>

Thanks for working on this, direct TLS is exactly what I need for IBM Cloud VPE Postgres endpoints, which currently require an stunnel sidecar.

I hit one issue: the connection fails with tlsv1 alert no application protocol unless server_tls_sslmode is verify-full.

The cause is in sbuf_tls_connect(), src/sbuf.c:1461-1462:


	if (cf_server_tls_sslmode != SSLMODE_VERIFY_FULL)
		hostname = NULL;
The hostname passed from handle_connect() is correct, but this drops it before it reaches tls_connect_fds(), which is what sets SNI. That was harmless for STARTTLS, but with direct TLS the handshake is the first thing on the wire, so SNI is how the endpoint selects the backend. Without it the connection is rejected.

Removing those two lines fixes it, and doesn't weaken verification — setup_tls() already calls tls_config_insecure_noverifyname() for the modes below verify-full.

Confirmed with openssl s_client -alpn postgresql: succeeds with -servername, reproduces the alert with -noservername.

view thread (17+ messages)  latest in thread

Message-ID: <gh-pgbouncer-pgbouncer-1584-c5532276483@github.com>
Permalink:  ../gh-pgbouncer-pgbouncer-1584-c5532276483@github.com/

 · 


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