javaapache-camelspring-dsl

Mutual TLS on apache camel


In Camel's examples doesn’t have any example or documentation for mutual TLS.

How to setup the mutual tls setup in both java dsl and spring dsl ?


Solution

  • From the camel point of view you'll be targeting a https resource if you are acting as a client or serving it if you are the service. The mutual authentication is handled at the network layer so Camel won't have explicit hooks.

    In the case of the client add the keystore/truststore (with the required certs added) to the startup commands -Djavax.net.ssl.keyStore=C:\temp\clientkeystore.jks -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.trustStore=C:\temp\truststore.jks -Djavax.net.ssl.trustStorePassword=password

    The additional flag -Djavax.net.debug=ssl is useful for debugging ssl handshake

    For a server (assuming Spring boot) enable ssl as follows, again with the required certs added to it's keystore

    server.ssl.enabled=true
    server.ssl.key-store=C:\\temp\\serverkeystore.jks
    server.ssl.key-store-password=password
    server.ssl.trust-store=C:\\temp\\trustStore.jks
    server.ssl.trust-store-password=password
    server.ssl.client-auth=want