Skip to content

[CELEBORN-2386] Pass peer hostname to SSLEngine for SNI support#3764

Open
shellfish007 wants to merge 1 commit into
apache:mainfrom
shellfish007:upstream-pr/ssl-sni-support
Open

[CELEBORN-2386] Pass peer hostname to SSLEngine for SNI support#3764
shellfish007 wants to merge 1 commit into
apache:mainfrom
shellfish007:upstream-pr/ssl-sni-support

Conversation

@shellfish007

@shellfish007 shellfish007 commented Jul 23, 2026

Copy link
Copy Markdown

What changes were proposed in this pull request?

Thread peer hostname/port from TransportClientFactory.internalCreateClient() through TransportContext.initializePipeline() to SSLFactory.createSSLEngine(). SSLFactory.createEngine() now calls jdkSslContext.createSSLEngine(peerHost, peerPort) for client connections, which makes the JDK include the SNI extension in the TLS ClientHello. Existing server-side and no-arg callers use backward-compatible overloads.

Why are the changes needed?

SSLFactory.createEngine() called jdkSslContext.createSSLEngine() with no arguments. The JDK only includes the SNI extension in the TLS ClientHello when a peer hostname is provided via createSSLEngine(host, port). Without SNI, TLS termination/routing that depends on server name (e.g. an SNI-based ingress/gateway such as Istio TLS PASSTHROUGH or SIMPLE mode) cannot route or differentiate connections by hostname. This fix is a prerequisite for shared-port multi-tenant routing through an SNI-based ingress gateway.

Does this PR introduce any user-facing change?

No. Client SSLEngine creation now includes SNI; server-side and existing no-arg callers are unaffected.

How was this patch tested?

Follows the existing SSLFactory/TransportContext call patterns with additive, backward-compatible overloads — no new config surface. Relies on CI for build/test verification.

SSLFactory.createEngine() called jdkSslContext.createSSLEngine() with
no arguments. The JDK only includes the SNI extension in the TLS
ClientHello when a peer hostname is provided via
createSSLEngine(host, port). Without SNI, TLS termination/routing
that depends on server name (e.g. Istio PASSTHROUGH/SIMPLE, or any
SNI-based multi-tenant ingress) cannot route or differentiate
connections.

Thread peer hostname/port from
TransportClientFactory.internalCreateClient() through
TransportContext.initializePipeline() to
SSLFactory.createSSLEngine(), which now calls
jdkSslContext.createSSLEngine(peerHost, peerPort) for client
connections. Existing server-side and no-arg callers are unaffected
via backward-compatible overloads.
@shellfish007 shellfish007 changed the title Pass peer hostname to SSLEngine for SNI support [CELEBORN-2386] Pass peer hostname to SSLEngine for SNI support Jul 23, 2026
@SteNicholas
SteNicholas requested a review from Copilot July 23, 2026 07:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Server Name Indication (SNI) support for TLS client connections by threading the peer hostname/port through the Netty transport initialization path into SSLFactory so the JDK can emit SNI in the TLS ClientHello.

Changes:

  • Add TransportContext.initializePipeline(...) overloads that accept peerHost/peerPort and pass them to SSL setup.
  • Update TransportClientFactory.internalCreateClient() to provide the remote peer host/port when initializing the client channel pipeline.
  • Extend SSLFactory.createSSLEngine(...) with a peer host/port overload and use SSLContext#createSSLEngine(host, port) for client engines.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
common/src/main/java/org/apache/celeborn/common/network/TransportContext.java Adds pipeline initialization overloads carrying peer host/port into SslHandler engine creation.
common/src/main/java/org/apache/celeborn/common/network/ssl/SSLFactory.java Introduces SSLEngine creation overload that uses createSSLEngine(peerHost, peerPort) for client-side SNI.
common/src/main/java/org/apache/celeborn/common/network/client/TransportClientFactory.java Passes remote address host/port into pipeline initialization for client connections.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +309 to 312
TransportChannelHandler clientHandler =
context.initializePipeline(
ch, decoder, true, address.getHostString(), address.getPort());
clientRef.set(clientHandler.getClient());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants