blob: b3b244c7b091eea41ca8e671025dd083b3cf32c7 [file] [log] [blame]
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.
* [Apache Maven]( version 3.x
* [Apache Karaf]( version 2.3.1
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
### Start Karaf
Karaf should be all configured at this point so start up an instance by running the `bin/karaf` from
the `<karaf_home>` directory.
Building this example
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
mvn camel:run
To stop the example hit ctrl + c
Deploy to Karaf
From the running Karaf console, run the following commands to install this example into your
running Karaf server.
features:addurl mvn:org.apache.camel/camel-example-ssh-security/<camel version>/xml/features
features: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 any 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!