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.
We will need to make 2 changes to Karaf for this example to work.
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
curl -O http://downloads.bouncycastle.org/java/bcprov-jdk15on-147.jar curl -O http://downloads.bouncycastle.org/java/bcprov-ext-jdk15on-147.jar curl -O http://downloads.bouncycastle.org/java/bcpkix-jdk15on-147.jar
<karaf_home>/etc/config.properties file, making 2 changes
add the following line
org.apache.karaf.security.providers = org.bouncycastle.jce.provider.BouncyCastleProvider
org.osgi.framework.bootdelegation property, appending
,org.bouncycastle.* to the end. It should look something like the following when done
<karaf_home>/etc/keys.properties file, appending a new user
scott. The format of the keys.properties 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/test_rsa.pub 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
To build, run the following command
mvn clean install
To test locally, assuming you have Setup Karaf and have it running, run the following command
To stop the example hit ctrl+c
Karaf should be all configured at this point so start up an instance by running the
bin/karaf from the
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/camel-example-ssh-security/<camel 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
If you hit an problems please let us know on the Camel Forums http://camel.apache.org/discussion-forums.html
Please help us make Apache Camel better - we appreciate any feedback you may have. Enjoy!
The Camel riders!