Skip to content

ConnectionFactory#setUri overwrites the SSLContext setup by the #useSslProtocol #297

@msarto

Description

@msarto

Hi guys,

We are trying to setup the com.rabbitmq.client.ConnectionFactory with

private val factory = new ConnectionFactory()
 factory.useSslProtocol(MY_SSLContext_WithMyCertificate)
factory.setUri("amqps://...")

(Scala code, but goes the same in Java)

but the ConnectionFactory#setUri resets the context by calling useSslProtocol(); that defaults the trust mgr to TrustEverythingTrustManager.

That would produce the warn message:
WARN |com.rabbitmq.client.TrustEverythingTrustManager.(TrustEverythingTrustManager.java:31)|main|This trust manager trusts every certificate, effectively disabling peer verification. This is convenient for local development but prone to man-in-the-middle attacks. Please see http://www.rabbitmq.com/ssl.html#validating-cerficates to learn more about peer certificate validation.

I could setup my SSLContext after the #setUri invocation but the setUri will still warn like above.

Regards,
Mihai Sarto

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions