Skip to content

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

Closed

Description

@Goodkat

Search before reporting

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

User environment

Environment

Item Value
Broker version 4.0.14
Broker OS and hardware Linux 6.12.0-219.el10.x86_64 (RHEL 10), x86_64, container on OpenShift
Broker Java version openjdk 21.0.12.1 2026-08-18 LTS
Client library type C# / .NET (DotPulsar)
Client library version CTS.Messaging.Pulsar 4.3.2
Client OS and hardware Windows
Client Java version N/A (not a Java client)

Deployment: Pulsar proxy terminating TLS on port 6651, token-based authentication
(AuthenticationProviderToken), AuthenticationProviderTls not enabled.

Issue Description

Pulsar proxy and broker always request a client certificate during the TLS handshake, regardless of
whether TLS authentication is configured. The CertificateRequest carries the full set of trust
anchors from tlsTrustCertsFilePath in its certificate_authorities field.

In DefaultPulsarSslFactory (4.0.14):

// pulsar-common/src/main/java/org/apache/pulsar/common/util/DefaultPulsarSslFactory.java:329-333
if (this.config.isRequireTrustedClientCertOnConnect()) {
    sslParams.setNeedClientAuth(true);
} else {
    sslParams.setWantClientAuth(true);
}

There is no path to wantClientAuth(false), so client certificates are requested even when
authenticationProviders contains only token/OAuth2 providers and AuthenticationProviderTls is not
enabled.

When tlsTrustCertsFilePath points at a large bundle — for example the OS bundle
/etc/ssl/certs/ca-certificates.crt, roughly 120 CAs — the resulting CertificateRequest is
approximately 16 KB. Combined with the default protocol set:

// pulsar-common/src/main/java/org/apache/pulsar/common/util/DefaultPulsarSslFactory.java:55
protected final String[] defaultSslEnabledProtocols = {"TLSv1.3", "TLSv1.2"};

the TLS 1.3 server flight (EncryptedExtensions + CertificateRequest + Certificate +
CertificateVerify + Finished) exceeds the 16384-byte TLS record plaintext limit and must be split
across two encrypted records.

Observed in our environment after upgrading to 4.0.14:

TLS 1.3:  SSL handshake has read 16589 bytes
TLS 1.2:  SSL handshake has read 20857 bytes

The upgrade added two CAs to the image's ca-certificates bundle, which pushed the TLS 1.3 flight
from just under to just over 16384 bytes. Java and Linux clients handle the fragmented flight
correctly. A .NET client on Windows (DotPulsar) failed to connect, surfacing as
TaskCanceledException in Producer.ChoosePartitions after the connection silently failed to
establish. We have not confirmed the client-side defect and are investigating it separately; the
point of this report is that Pulsar sends ~16 KB of trust anchors for an authentication mechanism
that is not enabled.

TLS 1.2 is unaffected because its handshake messages are sent as separate plaintext records.

Impact: a configuration change unrelated to Pulsar (a base-image CA bundle update) silently
crossed a protocol size limit and broke client connectivity, with no error logged on the broker or
proxy side.

Expected behavior

One of the following:

  1. Do not request client certificates when TLS authentication is not enabled. If
    AuthenticationProviderTls is absent from authenticationProviders and
    tlsRequireTrustedClientCertOnConnect is false, the server has no use for a client certificate
    and should set wantClientAuth(false).

  2. Provide a configuration option to suppress certificate_authorities in CertificateRequest
    while still accepting an offered client certificate, or to specify a trust anchor set for client
    authentication separate from the general truststore.

  3. At minimum, document the interaction — that tlsTrustCertsFilePath is advertised in every
    handshake, that large bundles can exceed the TLS record limit under TLS 1.3, and that this setting
    should be scoped to client-issuing CAs rather than pointed at a system bundle.

Actual behavior: the full truststore is advertised on every connection regardless of
configuration, and there is no supported way to reduce or suppress it other than shrinking
tlsTrustCertsFilePath, which also changes client-certificate validation semantics.

Error messages

2026-10-15 14:23:48,533 [14] ERROR CTS.RBRO.Business.Pulsar.RbroSecurityProductPulsarAvroOutputAdapter [Pulsar producer adapter='OUT_EDI_SecurityProduct' id=25 url='pulsar+ssl://rsp-sit.rbi.cloud:6651' topic='<topic_name>'] Failed to send message: A task was canceled.
2026-10-15 14:23:48,533 [14] ERROR CTS.RBRO.Business.Pulsar.RbroSecurityProductPulsarAvroOutputAdapter [Pulsar producer adapter='OUT_EDI_SecurityProduct' id=25 url='pulsar+ssl://rsp-sit.rbi.cloud:6651' topic='<topic_name>''] Error occurred while sending message to Pulsar!
System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at DotPulsar.Internal.Producer`1.ChoosePartitions(MessageMetadata metadata, CancellationToken cancellationToken)
   at DotPulsar.Internal.Producer`1.InternalSend(MessageMetadata metadata, TMessage message, Boolean sendOpCancelable, TaskCompletionSource`1 tcs, Func`2 onMessageSent, Action`1 onFailed, CancellationToken cancellationToken)
   at DotPulsar.Internal.Producer`1.Send(MessageMetadata metadata, TMessage message, CancellationToken cancellationToken)
   at CTS._System.Business.Integration.Pulsar.PulsarOutputMessageAdapter`1.SendMessageToPulsarAsync(Message message) in C:\BuildAgent\work\90fb4033a167eb0e\CTS\CTS\Modules\System\Business\Integration\Pulsar\PulsarOutputMessageAdapter.cs:line 127
   at CTS._System.Business.Integration.Pulsar.PulsarOutputMessageAdapter`1.SendMessageInternalAsync(Message message) in C:\BuildAgent\work\90fb4033a167eb0e\CTS\CTS\Modules\System\Business\Integration\Pulsar\PulsarOutputMessageAdapter.cs:line 97
2026-10-15 14:23:48,541 [22|IAQ<Message>] INFO  CTS._System.Business.OutputCaches Output '25' was set error in queue 45.
2026-10-15 14:23:48,542 [22|IAQ<Message>] INFO  CTS.RBRO.Business.Pulsar.RbroSecurityProductPulsarAvroOutputAdapter [Pulsar producer adapter='OUT_EDI_SecurityProduct' id=25 url='pulsar+ssl://<host_name>:6651' topic='<topic_name>'] Adapter disposed
2026-10-15 14:23:48,542 [22|IAQ<Message>] INFO  CTS._System.Business.OutputsCacheItem Output '25' was set for restart. 999 restart attempts remain.
2026-10-15 14:23:48,542 [24|AQ<AsyncEventArgs>] INFO  CTS._System.Business.OutputCaches Output '25' was set error in queue 45.

Reproducing the issue

Reproduction Steps

  1. Configure a Pulsar proxy (4.0.14) with:

    tlsEnabledWithKeyStore=false
    tlsTrustCertsFilePath=/etc/ssl/certs/ca-certificates.crt   # ~120 CAs
    tlsRequireTrustedClientCertOnConnect=false
    tlsProtocols=                                              # defaults to TLSv1.3, TLSv1.2
    authenticationEnabled=true
    authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderToken
    

    Note that AuthenticationProviderTls is not enabled — no client authenticates by
    certificate.

  2. Inspect the handshake:

    openssl s_client -connect <proxy-host>:6651 -tls1_3 </dev/null 2>&1 | grep "handshake has read"

    Observe a value above 16384 bytes.

  3. Confirm the CA list is being advertised:

    openssl s_client -connect <proxy-host>:6651 -tls1_2 </dev/null 2>&1 \
      | sed -n '/Acceptable client certificate CA names/,/Client Certificate Types/p'

    The full truststore is listed, despite TLS auth being disabled.

  4. Point tlsTrustCertsFilePath at a single-CA PEM and restart. The handshake drops to a few KB and
    the TLS 1.3 flight fits in one record.

Additional information

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added
    type/bug
    on Oct 21, 2026
  2. lhotari commented on Oct 21, 2026

    @lhotari
    Member

    Thanks for the great issue report!

  3. self-assigned this
    on Oct 22, 2026
  4. Goodkat commented on Oct 22, 2026

    @Goodkat
    ContributorAuthor

    Just one clarification based on the TLS 1.2/1.3 difference:

    • TLS 1.2 — separate plaintext records at natural message boundaries: Certificate, ServerKeyExchange, CertificateRequest, ServerHelloDone. No individual message crosses the limit in a way clients struggle with. Multi-record handshakes here are twenty-year-old, well-trodden behaviour.
    • TLS 1.3 — everything after ServerHello is encrypted and coalesced into one flight. At 16589 bytes it must split across two encrypted records, and reassembling across that boundary is where the Windows client fails.
  5. lhotari commented on Oct 22, 2026

    @lhotari
    Member

    Client library type C# / .NET (DotPulsar)
    Client library version CTS.Messaging.Pulsar 4.3.2

    Regarding a possible workaround, have you checked if upgrading DotPulsar & .NET version fixes your issue? The most recent DotPulsar release is 5.3.4 (https://github.com/apache/pulsar-dotpulsar/releases).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions