Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18304

Kafka SSLContextParameters support to resolve classpath Keystore and Truststore

    XMLWordPrintableJSON

Details

    • Moderate

    Description

      Kafka component does have the provision to provide bean of org.apache.camel.support.jsse.SSLContextParameters as a sslContextParameters property.

      But it does not support parsing the value for Keystore and TrustStore like path , password etc also not loads it from classpath like in HttpComponent.

      Camel Version- 3.14.3

      Example - I have created bean of sslContextParameter and passing it to Kafka Component as below 

      <camel:sslContextParameters id="sslContextParameters">
              <camel:keyManagers keyPassword="keystore.key.password">
                  <camel:keyStore resource="keystore/keystore.jks" password="{{keystore.password}}" />
              </camel:keyManagers>
              <camel:trustManagers>
                  <camel:keyStore resource="truststore/truststore.jks" password="{{truststore.password}}" />
              </camel:trustManagers>
          </camel:sslContextParameters>    <camelContext xmlns="http://camel.apache.org/schema/blueprint" id="ctx"     streamCache="true" useMDCLogging="true">
                     
              <propertyPlaceholder id="placeholder" location="classpath:config_${ENV}.properties,classpath:config.properties"    ignoreMissingLocation="true" propertiesParserRef="jasypt" />
              
              <endpoint id="kafkaConsumerEndpoint" uri="{kafka.topic}}">
                  <property key="brokers" value="kafka.brokers" />
                  <property key="sslContextParameters" value="#sslContextParameters" />
                  <property key="groupId" value="xyz" />
                  <property key="securityProtocol" value="SSL" />
                  <property key="reconnectBackoffMs" value="120000" />
                  <property key="sslEndpointAlgorithm" value="" />
                  <property key="allowManualCommit" value="true" />
                  <property key="autoCommitEnable" value="false" />
              </endpoint>
          </camelContext> 

      As It does not support to load Keystore and Truststore from classpath and not parsing properties we can't use property placeholder and classpath resources. 

      We should invoke below method to load Keystore from class path and to use property place holders for passing password.

      https://github.com/apache/camel/blob/main/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyStoreParameters.java#L159

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            aniketjadhav840 Aniket Jadhav
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: