tree: 88fc4bd793da9c83cd19fc1167c17d624004e83d [path history] [tgz]
  1. src/
  2. pom.xml

Camel-SSH using Key Example


This examples shows how to use the Camel-SSH component to call Apache Karaf using Public Key versus password. It can be run using Maven.


Setup Karaf

We will need to make 2 changes to Karaf for this example to work.

  1. Register the Bouncy Castle Java Cryptography Extension (JCE) with Karaf.
  2. Add a user and public key to Karaf's identity store.

Register Bouncy Castle

We need the Bouncy Castle JCE as Karaf's included Mina SSHD server uses this to handle Public Key files.

Install the following jars into the <karaf_home>/lib/ext directory.

curl -O
curl -O
curl -O

Edit the <karaf_home>/etc/ file, making 2 changes

  1. add the following line = org.bouncycastle.jce.provider.BouncyCastleProvider

  2. update the org.osgi.framework.bootdelegation property, appending ,org.bouncycastle.* to the end. It should look something like the following when done


Add a user and public key

Edit the <karaf_home>/etc/ file, appending a new user scott. The format of the file is as follows

<user name>=<public key>,<role>

For this example you will need to add a new user scott with the key value from the included src/main/resources/ file. The included Camel route uses the associated private key src/main/resources/test_rsa when connecting to the updated Karaf server.

Append the following to the <karaf_home>/etc/ file



To build, run the following command

mvn clean install

Run with maven

To test locally, assuming you have Setup Karaf and have it running, run the following command

mvn camel:run

To stop the example hit ctrl+c

Run with Karaf

Karaf should be all configured at this point so start up an instance by running the bin/karaf from the <karaf_home> directory.


From the running Karaf console, run the following commands to install this example into your running Karaf server.

feature:repo-add mvn:org.apache.camel.example/camel-example-ssh-security/${version}/xml/features
feature:install camel-example-ssh-security

This example outputs into the Karaf log file so you can either tail -f <karaf_home>data/log/karaf.log or from the Karaf console run the following command


Forum, Help, etc

If you hit an problems please let us know on the Camel Forums

Please help us make Apache Camel better - we appreciate any feedback you may have. Enjoy!

The Camel riders!