GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [fix][broker] Request TLS client certificates only when they are required or used by lhotari · Pull Request #27046 · apache/pulsar

Conversation

@lhotari

@lhotari lhotari commented Oct 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Fixes #27036

Motivation

Pulsar TLS servers (broker, proxy, websocket proxy, functions worker; binary and web listeners) always requested a
client certificate. tlsRequireTrustedClientCertOnConnect=false only downgraded "require" to "want". Each TLS
CertificateRequest carries the names of every trust anchor in certificate_authorities:

  • With tlsTrustCertsFilePath pointing at an operating-system CA bundle (~120 CAs), the CertificateRequest is
    about 16 KB. The TLS 1.3 server flight (EncryptedExtensions + CertificateRequest + Certificate +
    CertificateVerify + Finished) then spans two TLS records. That is valid TLS, but some clients mishandle it:
    a .NET client on Windows stopped connecting after a base-image CA bundle update added two CAs. No error was
    logged by the broker or the proxy.
  • With no trust file, the server trusts the JVM default anchors and lists them all: JDK 25's cacerts has 146 CAs,
    15,734 bytes of names.

This happened in deployments that never authenticate clients by certificate (token or OAuth 2.0 only), where
requesting a client certificate serves no purpose.

Modifications

  • New tlsClientAuthMode setting (NONE, OPTIONAL, REQUIRE) on the broker, proxy, websocket proxy and
    functions worker (TlsClientAuthMode in pulsar-common). It applies to all TLS listeners, binary and web.
    When unset, it is resolved for compatibility as follows:

    • REQUIRE if tlsRequireTrustedClientCertOnConnect=true;
    • OPTIONAL if authenticationEnabled=true and AuthenticationProviderTls (or a subclass) is among the
      authenticationProviders;
    • NONE otherwise: no CertificateRequest is sent.

    Two combinations are rejected at startup: tlsRequireTrustedClientCertOnConnect=true with an explicit NONE or
    OPTIONAL, and an explicit NONE while AuthenticationProviderTls is enabled (TLS authentication could never
    succeed).

  • Each component with a TLS listener logs the effective mode once at startup, with where it came from, e.g.
    TLS client auth mode {component=broker, mode=NONE, source=derived: AuthenticationProviderTls not among authenticationProviders}.

  • tlsRequireTrustedClientCertOnConnect is deprecated in favor of tlsClientAuthMode=REQUIRE. It is kept in
    every conf file that had it, so environment-variable overrides keep working. The new TLS factory APIs take only
    the mode: FileBasedTlsFactorySettings.Builder.clientAuthMode, TlsSynthesisSpec.server,
    JettyTlsFactory.createReloadingServerFactory, and the TlsContexts builders.

  • All server consumers are wired:

    • broker: binary (PulsarChannelInitializer, DefaultBrokerTlsFactory) and web (WebService)
    • proxy: binary (ServiceChannelInitializer, ProxyTlsFactories) and web (WebServer)
    • websocket proxy: ProxyServer
    • functions worker: WorkerServer

    For a custom tlsFactoryClassName, the mode applies through the framework's Netty and Jetty synthesis paths.

  • Config docs and conf files describe the new setting and the record-size interaction: when a certificate is
    requested, the CertificateRequest lists every CA in tlsTrustCertsFilePath / tlsTrustStore, so that trust
    store should hold only the CAs that issue client certificates. Two PIP-478 references to the deprecated flag now
    name tlsClientAuthMode=OPTIONAL.

  • The trust anchors used for validating client certificates are unchanged (tlsTrustCertsFilePath /
    tlsTrustStore). Separating them from the outbound trust of function instances is left to a follow-up.

Behavior change: with no configuration change, a TLS server that neither requires client certificates nor
authenticates with AuthenticationProviderTls no longer requests one. A custom authentication provider that reads
the client certificate must set tlsClientAuthMode=OPTIONAL (or REQUIRE). A functions worker reads its own
authenticationProviders, as its AuthenticationService already does.

Pulsar 4.x (the PIP-337 DefaultPulsarSslFactory TLS path) needs a separate fix. It always requests a client
certificate when tlsRequireTrustedClientCertOnConnect=false (setWantClientAuth(true)), so the reported issue
remains there until a 4.x change stops requesting client certificates when they are neither required nor used.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • TlsClientAuthModeTest and TlsFactorySupportTest cover:
    • mode resolution and both conflict checks
    • detection of AuthenticationProviderTls, including a subclass, an unknown class and authentication disabled
  • FileBasedTlsFactoryTest (JDK and OpenSSL engines, TLS 1.2 and 1.3): a client key manager records what the
    server asked for.
    • NONE sends no CertificateRequest, also in insecure mode and with the JVM default anchors.
    • OPTIONAL lists the trusted CA and captures the client certificate.
    • REQUIRE rejects a missing certificate.
  • SslParametersSynthesisTest and JettyTlsFactoryTest cover the mode on the synthesized Netty and Jetty server
    contexts.
  • Wiring tests for the broker, proxy, websocket proxy and functions worker check the resolved mode in the factory
    settings.
  • TlsClientAuthModeBrokerTest (end to end): a real broker's binary and web TLS ports send no
    CertificateRequest by default and send one with tlsClientAuthMode=OPTIONAL.
  • Existing TLS-authentication suites still pass with the derived mode. These include ClientAuthenticationTlsTest,
    TlsProducerConsumerTest, AuthenticatedProducerConsumerTest, ProxyWithAuthorizationTest,
    ProxyMutualTlsTest, the ProxyKeyStoreTls* tests and both PulsarFunctionTlsTests.
  • Mutation check: hard-coding OPTIONAL in the broker's WebService or DefaultBrokerTlsFactory wiring fails the
    end-to-end and policy tests.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations: a TLS server no longer requests a client certificate unless it is
    required or AuthenticationProviderTls is enabled; tlsRequireTrustedClientCertOnConnect is deprecated in
    favor of tlsClientAuthMode
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment: new configuration key tlsClientAuthMode

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lhotari
[fix][broker] Request TLS client certificates only when they are requ…
90b3cc8
…ired or used

Pulsar TLS servers always requested a client certificate, and the
TLS CertificateRequest lists every CA in the server's trust store, or
all ~150 JVM default CAs (about 16 KB of names) when no trust file is
configured. With a large bundle the TLS 1.3 server flight exceeds one
16 KB TLS record, which some clients fail to handle, even in
deployments that never authenticate clients by certificate.

Add tlsClientAuthMode (NONE, OPTIONAL, REQUIRE) to the broker, proxy,
websocket proxy and functions worker. When unset, it is REQUIRE if the
now deprecated tlsRequireTrustedClientCertOnConnect is true, OPTIONAL
if authentication is enabled with AuthenticationProviderTls, and NONE
otherwise, so no certificate is requested when nothing requires or
uses one.

Add tlsClientAuthTrustCertsFilePath and tlsClientAuthTrustStore (with
type and password) to validate client certificates against dedicated
CAs, such as a private client CA, while tlsTrustCertsFilePath keeps
serving outbound connections. Public CAs are removing the clientAuth
extended key usage from their TLS certificates, so the client-auth
trust anchors should not be a public CA bundle.

Assisted-by: Claude Code (claude-opus-5-5)
@lhotari
lhotari requested review from Technoboy-, codelipenghui, dao-jun, merlimat and nodece October 22, 2026 12:08
@github-actions github-actions Bot added the PIP label Oct 22, 2026
codelipenghui
codelipenghui reviewed Oct 22, 2026
View reviewed changes
Comment thread pulsar-broker-common/src/main/java/org/apache/pulsar/broker/tls/TlsFactorySupport.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pulsar-broker-common/src/main/java/org/apache/pulsar/broker/tls/TlsFactorySupport.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@lhotari
lhotari marked this pull request as draft October 22, 2026 20:05
@lhotari
Address review: drop client-auth trust keys, log the mode, reject NON…
4aa0cfc
…E with TLS auth

- Remove tlsClientAuthTrustCertsFilePath and the tlsClientAuthTrustStore*
  keys and helpers. The server listeners validate client certificates
  against tlsTrustCertsFilePath / tlsTrustStore as before; separating
  them from outbound trust is a follow-up.
- Reject an explicit tlsClientAuthMode=NONE while
  AuthenticationProviderTls is enabled.
- Log the effective mode and its source once per component that has a
  TLS listener.
- PulsarFunctionTlsTest: configure the worker's own
  authenticationProviders, as a real worker does.

Assisted-by: Claude Code (claude-opus-5-5)
@lhotari
lhotari marked this pull request as ready for review November 9, 2026 12:01
@lhotari lhotari mentioned this pull request Nov 9, 2026
[Enhancement][fn] Function instances should use brokerClientTrustCertsFilePath for outbound TLS trust #27489
Open
2 tasks done
@lhotari
lhotari requested a review from codelipenghui November 9, 2026 12:40
codelipenghui
codelipenghui approved these changes Nov 9, 2026
View reviewed changes
dao-jun
dao-jun approved these changes Nov 10, 2026
View reviewed changes
@lhotari
lhotari merged commit deac87c into apache:master Nov 10, 2026
83 of 85 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@lhotari lhotari added this to the 5.1.0 milestone Nov 10, 2026
@lhotari lhotari added the release/5.0.2 label Nov 10, 2026
lhotari added a commit that referenced this pull request Nov 11, 2026
@lhotari
[fix][broker] Request TLS client certificates only when they are requ…
e7ea689
…ired or used (#27046)

(cherry picked from commit deac87c)
@lhotari lhotari added the cherry-picked/branch-5.0 label Nov 11, 2026
This was referenced Nov 21, 2026
[improve][ci] Run CI for the 4.2.6 backports to branch-4.2 (do not merge) #27680
Closed
[improve][ci] Run CI for the 4.2.6 backports to branch-4.2 (do not merge) #27681
Closed
[improve][ci] Run CI for the 4.2.6 backports to branch-4.2 (do not merge) #27684
Closed
@lhotari lhotari added cherry-picked/branch-4.2 release/4.2.6 cherry-picked/branch-4.0 release/4.0.15 labels Nov 21, 2026
@havefunatcode havefunatcode mentioned this pull request Nov 22, 2026
[fix][misc] PIP-478: webServiceTls{Ciphers,Protocols} and the proxy lookup leg's brokerClientTls{Ciphers,Protocols} are not applied #26386
Open
poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request Nov 26, 2026
@lhotari
[fix][broker] Request TLS client certificates only when they are requ…
e57e9b7
…ired or used (apache#27046)

(cherry picked from commit deac87c)
poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request Nov 26, 2026
@lhotari
[fix][broker] Request TLS client certificates only when they are requ…
00a31a0
…ired or used (apache#27046)

(cherry picked from commit deac87c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@codelipenghui codelipenghui codelipenghui approved these changes
@dao-jun dao-jun dao-jun approved these changes
@merlimat merlimat Awaiting requested review from merlimat
@nodece nodece Awaiting requested review from nodece
@Technoboy- Technoboy- Awaiting requested review from Technoboy-

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cherry-picked/branch-4.0 cherry-picked/branch-4.2 cherry-picked/branch-5.0 PIP release/4.0.15 release/4.2.6 release/5.0.2

Projects

None yet

Milestone

5.1.0

Development

Successfully merging this pull request may close these issues.

[Bug] Proxy/broker always sends CertificateRequest with full truststore CA list, breaking TLS 1.3 handshakes with large truststores

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@lhotari @codelipenghui @dao-jun
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.