Repository navigation
Fix #3210: spring-rabbitmq Kamelets check the broker certificate and host name with amqps, and take a trust store - #3211
Merged
Conversation
…e and host name with amqps, and take a trust store With protocol amqps, spring-rabbitmq-source and spring-rabbitmq-sink now create the RabbitMQ connection factory with Spring AMQP's RabbitConnectionFactoryBean, wrapped in a CachingConnectionFactory. TLS then checks the certificate of the broker with the trust store of Java and verifies the host name of the broker. Before, the Kamelets handed an amqps:// URI to the RabbitMQ client, whose default TLS setup for such a URI checks neither. The new options sslTruststoreLocation and sslTruststorePassword give a trust store for a broker with a certificate from a private or self-signed authority. A broker whose certificate Java does not trust, or whose certificate does not name the host, no longer connects with amqps. The Good to know of both Kamelets says so. protocol amqp (the default) is unchanged. SpringRabbitmqKameletTlsTest runs both Kamelets against a local TLS server (and a plain one for amqp). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
davsclaus
force-pushed
the
ci-issue-3210
branch
from
November 18, 2026 20:30
683a7b2 to
34703c8
Compare
This was referenced Nov 18, 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.
Fixes #3210
Problem
spring-rabbitmq-sourceandspring-rabbitmq-sinkofferprotocol: amqpsfor a TLS connection to the broker. They created a SpringCachingConnectionFactoryfrom the URI{{protocol}}://{{host}}:{{port}}, and for anamqps://URI the RabbitMQ client sets up TLS with its own default, which neither checks the broker certificate against a trust store nor compares the host name of the broker with the certificate. The Kamelets also had no option to give a trust store.Change
ConnectionFactorywith Spring AMQP'sRabbitConnectionFactoryBean(abuilderClassbean,getObjectas builder method) and wrap it inCachingConnectionFactory(constructor argument). The sink keepspublisherConfirmTypeon the caching factory.protocoloption and its defaultamqpstay.RabbitConnectionFactoryBeanturns TLS on for anamqps://URI and sets it up before it applies the URI: with no trust store given it uses the default trust store of Java, and it enables host name verification by default.sslTruststoreLocationandsslTruststorePassword(format: password, credentials descriptor), mapped totrustStoreandtrustStorePassphraseofRabbitConnectionFactoryBean. The location is a Spring resource location, such asfile:/etc/rabbitmq/truststore.p12orclasspath:truststore.p12(a path withoutfile:is looked up on the classpath); JKS and PKCS12 both load. There is no option to turn the checks off. The names follow the trust store options of the Kafka and MQTT Kamelets.protocoldescription and the Good to know of both Kamelets say whatamqpsnow checks.kamelets-index.json.Behaviour change
With
protocol: amqps, a broker whose certificate Java does not trust, or whose certificate does not name the host inhost, no longer connects. Add the CA of such a broker to the trust store of Java, or give it withsslTruststoreLocation.protocol: amqp(the default) is unchanged. This needs a line in the upgrade notes of #3190 (and so in the Camel 4.24 upgrade guide).Tests
SpringRabbitmqKameletTlsTest(incamel-kamelets-catalog, which now hascamel-kamelet,camel-spring-rabbitmq,camel-core-languagesandjunit-jupiter-paramsas test dependencies) runs both Kamelets fromkamelets/against a local server, no broker or container needed:amqpsChecksBrokerCertificateWithJavaTrustStore: a self-signed broker certificate fails the TLS handshake.amqpsAcceptsBrokerCertificateFromTrustStore: the same certificate insslTruststoreLocationpasses.amqpsVerifiesBrokerHostName: with that trust store, connecting by IP address to a certificate that only nameslocalhostfails.amqpConnectsWithoutTls:amqpsends the plain AMQP protocol header.The test key store and trust store are in
src/test/resources/spring-rabbitmq/(generated withkeytool, valid for 100 years, passwordchangeit).With the old templates,
amqpsChecksBrokerCertificateWithJavaTrustStoreandamqpsVerifiesBrokerHostNamefail for both Kamelets (the handshake succeeds)../mvnw clean installpasses.To be ported by hand to
4.22.xand4.18.x.Claude Code on behalf of Claus Ibsen
🤖 Generated with Claude Code