fix(postgres): only enable SSL when cert and key files actually exist on disk#1197
Open
burnerlee wants to merge 1 commit into
Open
fix(postgres): only enable SSL when cert and key files actually exist on disk#1197burnerlee wants to merge 1 commit into
burnerlee wants to merge 1 commit into
Conversation
… on disk When USE_SSL is compiled in, ssl_enabled was hardcoded to true regardless of whether cert/key files were present. psql sends SSL_REQUEST first; the handler called makeSecureConnectionSSL() which invoked SSLManager::defaultServerContext() — this fails with no certs configured, dropping the connection with "SSL SYSCALL error: EOF detected". Fix: default ssl_enabled to false, check openSSL.server.certificateFile and openSSL.server.privateKeyFile at runtime in the factory constructor. Only set ssl_enabled=true when both files exist on disk. Fixes timeplus-io#824
|
|
chenziliang
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR checklist:
proton: starts/endsfor new code in existing community code base ? N/A (PostgreSQLHandlerFactory is not ClickHouse-inherited code)Please write user-readable short description of the changes:
Problem
Connecting to Proton's PostgreSQL port (5432) with
psqlfails immediately:This happens on any deployment where SSL certificate files are not present (the default).
Root Cause
PostgreSQLHandlerFactoryhardcodedssl_enabled = trueat compile time wheneverUSE_SSLwas set. Thepsqlclient always sends anSSL_REQUESTfirst before the startup message. The handler enteredmakeSecureConnectionSSL(), which calledPoco::Net::SSLManager::instance().defaultServerContext()— this throws/fails when no cert/key files are configured, and the connection drops with EOF before any error can be sent back to the client.Fix
Default
ssl_enabledtofalse. In the factory constructor, readopenSSL.server.certificateFileandopenSSL.server.privateKeyFilefrom the server config at runtime. Only setssl_enabled = truewhen both keys are non-empty and both files exist on disk.When
ssl_enabled = false, the handler correctly responds'N'toSSL_REQUEST, andpsqlfalls back to plaintext — the expected behavior for a server without SSL configured.Fixes #824