eiffel-community / eiffel-event-repository

Apache License 2.0
2 stars 8 forks source link

Enabling secure communication TLS for rabbitmq #13

Open jdartland opened 1 year ago

jdartland commented 1 year ago

Description

Currently, we are using eiffel repository through the docker image eiffel-er:2.0.36. We want to configure the event repository to use secure communication over TLS when consuming events from RabbitMq. We have the TSL port 5671 configured in rabbitmq. For other eiffel components, such as eiffel-intelligence(backend), it has been possible to enable rabbitmq TLS communication, simply just by setting the following environment variables:

rabbitmq.tls.version=TLSv1.2
rabbitmq.port=5671

However, this does not seems to have any effect on the eiffel-event-repository component as it fails to connect to the rabbitmq broker with the following error:

2022-12-12 09:28:15.761 ERROR 6 --- [ost-startStop-1] c.e.e.m.consumer.MessageBusBinder : Eiffel/MessageBusBinder: Exception creating connection to Message Bus IOException: 2022-12-12 09:28:15.762 ERROR 6 --- [ost-startStop-1] c.e.e.rmq.consumer.RmqConnectionHandler : java.lang.IllegalArgumentException: The connection must not be null!connection to message bus amqp://:5671 failed

We suspect the component contains some configuration that tries to connect with amqp instead of amqps. As it is not open-sourced yet we, would appreciate some more information on how to set up the secure connection to the broker properly.

Thanks :)

jainadc9 commented 1 year ago

Reproduced issue with eiffel-er:2.0.37 ,enabled rabbtmq.tls flag to true still issue is observed

jainadc9 commented 1 year ago

It doesn't matter if we specify "amqp" or "amqps" in rabbitmq.host since it is the javax.net.ssl.* and eiffel.net.ssl.protocol system properties that determines SSL or not!

jainadc9 commented 4 months ago

Need to enable the following java opts to enable secure er.The following is a snippet from docker-compose file

  environment:                   
       - |
         JAVA_OPTS=
         "-Djavax.net.ssl.keyStore=/path/to/keystore.jks"
         "-Djavax.net.ssl.trustStore=/path/to/truststore.jks"
         "-Djavax.net.ssl.keyStorePassword=password"
         "-Djavax.net.ssl.trustStorePassword=password" 
         "-Djavax.net.ssl.keyStoreType=JKS"
         "-Djavax.net.ssl.trustStoreType=JKS"
         "-Deiffel.net.ssl.enabled=true"
       - rabbitmq.port=5671
       - rabbitmq.tls=true

Option to debug ssl "-Djavax.net.debug=ssl"

jainadc9 commented 3 months ago

@jdartland can you verify the above configuration so that we can close this issue ?

m-linner-ericsson commented 1 month ago

@jdartland Any thoughts?