Fix SSL direct mode connection failure with sslsni parameter #9537
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚨 Impact
SSL direct mode is completely broken when using the
sslsniparameter with PostgreSQL 14+ servers. Connections fail withSSL error: unexpected eof while reading.This affects any user attempting to use
PGSSLSNI=1(Server Name Indication) with direct SSL negotiation mode.Summary
Fixes the
sslsniconnection parameter handling by converting boolean values to integers before passing to libpq.Problem
The
sslsniparameter is stored as a boolean (true/false) in the UI and database, but libpq requires integer values (1/0) for this parameter. When a boolean value is passed to libpq, it results in SSL connection failures.Error:
Solution
Added boolean-to-integer conversion in
web/pgadmin/utils/driver/psycopg3/server_manager.pywhen creating the connection string. This ensures libpq receives the expected integer format.The conversion happens in
create_connection_string()method, right before parameters are passed tomake_conninfo():Changes
web/pgadmin/utils/driver/psycopg3/server_manager.py(+4 lines)sslcompressionandsslsniparameters consistentlyTesting
✅ Tested locally with pgAdmin 4 v9.11 on macOS
✅ Verified connection succeeds with
PGSSLSNI=1after fix✅ Applied as hotfix and confirmed working in production environment
Test case:
sslmode=require,sslnegotiation=direct,sslsni=1Related
min_server_version: '14')Request for Expedited Review
This is a minimal, critical fix (4 lines) that unblocks SSL direct mode functionality. Given the severity and low risk, requesting inclusion in pgAdmin 9.12.
Summary by CodeRabbit