Skip to content

MQTT Broker: add mTLS transport support - #3202

Merged
pankalog merged 0 commit into
mtls/1-platform-fixesfrom
mtls/2-broker-mtls
Nov 12, 2026
Merged

pankalog merged 0 commit into
mtls/1-platform-fixesfrom
mtls/2-broker-mtls

Conversation

@pankalog

@pankalog pankalog commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

Description

Adds a second Artemis acceptor requiring client certificates, on port 8884.

Key material comes from OpenRemoteSSLContextFactory via the Artemis SPI: it prefers the proxy certificate directory under the storage dir, so the deployment serves the same haproxy-managed cert it already has, falling back to a configured keystore.

Trust material always comes from the configured truststore. Deriving it from the server's own chain would make the letsencrypt intermediate an issuer of client certificates; falling back to the JDK CA bundle would accept any publicly issued client-auth cert. An acceptor requiring client auth with no usable truststore fails instead.

The acceptor is only added when a server certificate and a readable truststore are present, otherwise it is left out with a log. That lets OR_MQTT_MTLS_DISABLED default to false safely.

Artemis holds an acceptor's SSLContext once built, so on certificate renewal the broker clears the factory cache and reloads the acceptor.

How to verify

MQTTBrokerMTLSTest drives a live acceptor: a cert from the truststore's CA connects, an identical one from another CA never does, and with the server cert issued by a different CA than the devices, only the device CA is accepted. OpenRemoteSSLContextFactoryTest covers source resolution. Certificates are generated by MTLSCertificateHelper, so no private key is committed.

Checklist

  • 1. Acceptance criteria of the linked issue(s) are met
  • 2. Tests are written and all tests pass
  • 3. Changes are manually tested by you and the reviewer

@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@pankalog
pankalog marked this pull request as ready for review September 4, 2026 09:29
@pankalog
pankalog requested a review from richturner September 4, 2026 09:46
@pankalog pankalog closed this Nov 12, 2026
@pankalog
pankalog merged commit a958c79 into master Nov 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

@pankalog pankalog mentioned this pull request Nov 12, 2026
2 of 3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant