Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-15516

camel-ssh component doesn't work with Red Hat Fuse on EAP 7.x - BouncyCastle must be registered as a JCE provider

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • fuse-7.9-GA
    • fuse-7.8-GA
    • Camel
    • None
    • False
    • False
    • % %
    • Undefined
    • Hide

      Following works in Karaf mode. I am using same linux host as ssh-server where Red Hat Fuse is deployed.

      1. Generated ssh keys with :

      ssh-keygen -m PEM -t rsa
      ssh-keygen -t rsa

      2. Copied content of id_rsa.pub to ~/.ssh/authorized_keys with command

      ssh-copy-id cpandey@192.168.1.10
      

      3. Install camel-ssh feature in Red Hat Fuse on Karaf.

      4.  Deploy following route in deploy folder of Red Hat Fuse.

      <?xml version="1.0" encoding="UTF-8"?>
       <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="eager">
       <camelContext xmlns="http://camel.apache.org/schema/blueprint">
       <route>
       <from uri="timer://foo?fixedRate=true&period=30000"/>
       <setBody>
       <constant>touch ~/file1.txt</constant>
       </setBody>
       <convertBodyTo type="java.lang.String"></convertBodyTo>
       <to uri="ssh://192.168.1.10?username=cpandey&certResource=file:///home/cpandey/.ssh/id_rsa"/>
       <to uri="log:XXX?level=ERROR"/>
       </route>
       </camelContext>
       </blueprint>
       

      5. This appears to be workin in Karaf mode with file1.txt created in user's home folder. 

      6. In EAP mode if we deploy a war file with similar route but in java dsl, we get error mentioned in Description. Project poc_ssh_eap.zip attached, we can just build it with "mvn clean package" and place the war file target folder of project in jboss-eap-7.2/standalone/deployments folder for deployment in EAP.

      7. Tested with fuse-eap-installer-7.7.0.jar on EAP 7.2.7 GA.

      Show
      Following works in Karaf mode. I am using same linux host as ssh-server where Red Hat Fuse is deployed. 1. Generated ssh keys with : ssh-keygen -m PEM -t rsa ssh-keygen -t rsa 2. Copied content of id_rsa.pub to ~/.ssh/authorized_keys with command ssh-copy-id cpandey@192.168.1.10 3. Install camel-ssh feature in Red Hat Fuse on Karaf. 4.  Deploy following route in deploy folder of Red Hat Fuse. <?xml version= "1.0" encoding= "UTF-8" ?> <blueprint xmlns= "http: //www.osgi.org/xmlns/blueprint/v1.0.0" default -activation= "eager" > <camelContext xmlns= "http: //camel.apache.org/schema/blueprint" > <route> <from uri= "timer: //foo?fixedRate= true &period=30000" /> <setBody> <constant>touch ~/file1.txt</constant> </setBody> <convertBodyTo type= "java.lang. String " ></convertBodyTo> <to uri= "ssh: //192.168.1.10?username=cpandey&certResource=file:///home/cpandey/.ssh/id_rsa" /> <to uri= "log:XXX?level=ERROR" /> </route> </camelContext> </blueprint>   5. This appears to be workin in Karaf mode with file1.txt created in user's home folder.  6. In EAP mode if we deploy a war file with similar route but in java dsl, we get error mentioned in Description . Project poc_ssh_eap.zip attached, we can just build it with "mvn clean package" and place the war file target folder of project in jboss-eap-7.2/standalone/deployments folder for deployment in EAP. 7. Tested with fuse-eap-installer-7.7.0.jar on EAP 7.2.7 GA.

      Application using camel-ssh component doesn't work with Red Hat Fuse on EAP 7.x. It can be a documentation issue as well where some steps are missing for installation in EAP.

      It throws error like following. We followed steps mentioned in this EAP article to register bcprov. But following exception is observed with all these configurations.

       

      17:54:42,302 WARN  [org.apache.camel.component.timer.TimerConsumer] (Camel (spring-context) thread #1 - timer://something) Error processing exchange.
      Exchange[ID-cpandey-pnq-csb-1610021740282-0-37]. Caused by: [org.apache.camel.CamelExchangeException - Cannot execute command: touch ~/12345.txt.
      Exchange[ID-cpandey-pnq-csb-1610021740282-0-37]. Caused by: [java.lang.IllegalStateException - BouncyCastle must be registered as a JCE provider]]:
      org.apache.camel.CamelExchangeException: Cannot execute command: touch ~/12345.txt. Exchange[ID-cpandey-pnq-csb-1610021740282-0-37]. Caused by:
      [java.lang.IllegalStateException - BouncyCastle must be registered as a JCE provider]17:54:42,302 WARN 
      [org.apache.camel.component.timer.TimerConsumer] (Camel (spring-context) thread #1 - timer://something) Error processing exchange. Exchange[ID-
      cpandey-pnq-csb-1610021740282-0-37]. Caused by: [org.apache.camel.CamelExchangeException - Cannot execute command: touch ~/12345.txt.
      Exchange[ID-cpandey-pnq-csb-1610021740282-0-37]. Caused by: [java.lang.IllegalStateException - BouncyCastle must be registered as a JCE provider]]:
      org.apache.camel.CamelExchangeException: Cannot execute command: touch ~/12345.txt. Exchange[ID-cpandey-pnq-csb-1610021740282-0-37]. Caused by:
      [java.lang.IllegalStateException - BouncyCastle must be registered as a JCE provider] at org.apache.camel.component.ssh.SshProducer.process(SshProducer.java:73) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197) at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505)Caused by: java.lang.IllegalStateException: BouncyCastle must be registered as a JCE provider at org.apache.camel.component.ssh.ResourceHelperKeyPairProvider.loadKeys(ResourceHelperKeyPairProvider.java:100) at org.apache.sshd.common.keyprovider.KeyPairProvider.loadKey(KeyPairProvider.java:108) at org.apache.camel.component.ssh.SshHelper.sendExecCommand(SshHelper.java:88) at org.apache.camel.component.ssh.SshProducer.process(SshProducer.java:68) ... 11 more
      

              jondruse@redhat.com Jiri Ondrusek
              rhn-support-cpandey Chandra Shekhar Pandey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: