On Thu, Feb 14, 2013 at 2:57 PM, Martin Stiborský <martin.stibor...@gmail.com> wrote: > Still one problem…the unit test was fine, but now in OSGi environment, > there are more troubles… > Is there some trick how to get resource from a bundle? I can't get a > reference to the key file stored in src/main/resources :( >
I guess maybe camel-ssh should load the cert file like we do in other components using ResourceHelper. Then we can load from classpath (osgi and the rest of the world), files etc. eg prefix with classpath: or file: > > On Thu, Feb 14, 2013 at 12:25 PM, Martin Stiborský < > martin.stibor...@gmail.com> wrote: > >> I can try help there as well. I was looking for a chance to make my "first >> camel commit" anyway :) >> >> >> On Thu, Feb 14, 2013 at 12:00 PM, Scott Cranton <sc...@cranton.com> wrote: >> >>> Glad you figured it out. Yeah, the camel-ssh page does need some >>> attention. Thanks for the feedback, and I look forward to seeing your >>> suggested updates to the doc. >>> >>> The certFilename is just a shorthand for creating a >>> FileKeyPairProvider, which is identical to what the >>> SshComponentSecurityTest is doing >>> >>> sshComponent.setKeyPairProvider(new FileKeyPairProvider(new >>> String[]{"src/test/resources/hostkey.pem"})); >>> >>> but I see in the tests, I'm using the same resource for both producer >>> and consumer, so to your point about when public key, when private, I >>> should check that, update the tests, and most importantly update the >>> docs as it isn't clear... >>> >>> Thanks, >>> Scott >>> >>> >>> >>> On Thu, Feb 14, 2013 at 5:48 AM, Martin Stiborský >>> <martin.stibor...@gmail.com> wrote: >>> > As usually, problem solved few minutes after I posted this "call for >>> help >>> > message". >>> > Really there was a problem with loading the private key from resources. >>> > >>> > Now it works...my next message will be about updating the camel-ssh >>> wiki :) >>> > >>> > >>> > On Thu, Feb 14, 2013 at 10:37 AM, Martin Stiborský < >>> > martin.stibor...@gmail.com> wrote: >>> > >>> >> Hello guys, >>> >> I need to use camel-ssh in my route, also, I need authentication with >>> SSH >>> >> keys to the remote server. >>> >> I can't figure out how to configure the SSH producer in Camel. >>> >> >>> >> Now I started digging in camel-ssh source codes, but that is a long >>> trip >>> >> for me right now :( >>> >> >>> >> First of all, I'm not sure, what is difference between "certFilename" >>> and >>> >> "keyPairProvider" options for the ssh endpoint? >>> >> >>> >> Then, the private key have to be provided for the ssh endpoint, right? >>> The >>> >> public key is configured on the remote server account... >>> >> Also, in which format the SSH private key should be? PEM? >>> >> Like this? >>> >> >>> >> openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem >>> >> >>> >> I guess so, because it's like this here: >>> >> >>> https://github.com/apache/camel/blob/trunk/components/camel-ssh/src/test/resources/hostkey.pem >>> >> >>> >> I'm not even sure if the key is loaded properly in the Java code from >>> >> resources directory, because the exception I see there is: >>> >> >>> >> ========== >>> >> Caused by: java.io.IOException: Error performing public key >>> authentication >>> >> at >>> >> >>> org.apache.sshd.client.auth.UserAuthPublicKey.<init>(UserAuthPublicKey.java:86) >>> >> at >>> >> >>> org.apache.sshd.client.session.ClientSessionImpl.authPublicKey(ClientSessionImpl.java:146) >>> >> at >>> >> >>> org.apache.camel.component.ssh.SshEndpoint.sendExecCommand(SshEndpoint.java:113) >>> >> at >>> >> org.apache.camel.component.ssh.SshProducer.process(SshProducer.java:38) >>> >> ... 72 more >>> >> Caused by: java.lang.NullPointerException >>> >> at >>> >> >>> org.apache.sshd.client.auth.UserAuthPublicKey.<init>(UserAuthPublicKey.java:59) >>> >> ... 75 more >>> >> ========== >>> >> >>> >> Note the NullPointerException ... >>> >> >>> >> But I tried to follow this ( >>> >> >>> https://github.com/apache/camel/blob/trunk/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentSecurityTest.java) >>> test, >>> >> so I guess it should work... >>> >> >>> >> Could you give me at least some hint? >>> >> I promise I'll extend Camel wiki related to this topic definitely :P >>> >> >>> >> -- >>> >> S pozdravem / Best regards >>> >> Martin Stiborský >>> >> >>> >> Jabber: st...@njs.netlab.cz >>> >> Twitter: http://www.twitter.com/stibi >>> >> >>> > >>> > >>> > >>> > -- >>> > S pozdravem / Best regards >>> > Martin Stiborský >>> > >>> > Jabber: st...@njs.netlab.cz >>> > Twitter: http://www.twitter.com/stibi >>> >> >> >> >> -- >> S pozdravem / Best regards >> Martin Stiborský >> >> Jabber: st...@njs.netlab.cz >> Twitter: http://www.twitter.com/stibi >> > > > > -- > S pozdravem / Best regards > Martin Stiborský > > Jabber: st...@njs.netlab.cz > Twitter: http://www.twitter.com/stibi -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen