Hello All,
I hope I am posting this in the right place.  Currently the SFTP component
allows for server key verification through the known_hosts file in camel
2.0.  It does not have a configuration to allow the user to submit a private
key and passphrase for an additional factor of authentication.  I think I
have a patch for this.  Bear in mind this is my first time doing anything
like this so I am not quite sure on how to go about submitting this.

Here is what I did:

1) Downloaded the latest source code from the Trunk

2) Updated RemoteFileConfiguration.java to include two private variables:
    private String sftpPrivateKeyFile;
    private String sftpPrivateKeyFilePassphrase;

3) Added corresponding getters/setters for these variables:

    public String getSftpPrivateKeyFilePassphrase() {
        return sftpPrivateKeyFilePassphrase;
    }

    public void setSftpPrivateKeyFilePassphrase(String
sftpPrivateKeyFilePassphrase) {
        this.sftpPrivateKeyFilePassphrase = sftpPrivateKeyFilePassphrase;
    }

    public String getSftpPrivateKeyFile() {
        return sftpPrivateKeyFile;
    }

    public void setSftpPrivateKeyFile(String sftpPrivateKeyFile) {
        this.sftpPrivateKeyFile = sftpPrivateKeyFile;
    }

4) Updated SftpEndpoint.java with the following lines:
        final JSch jsch = new JSch();

        if (getConfiguration().getSftpPrivateKeyFile() != null &&
!getConfiguration().getSftpPrivateKeyFile().equals(""))
        {
            jsch.addIdentity(getConfiguration().getSftpPrivateKeyFile(),
getConfiguration().getSftpPrivateKeyFilePassphrase());
        }   

5) Wrote a simple route to test:
<from
uri="sftp://[EMAIL 
PROTECTED]/camel?password=12345&amp;knownHosts=/home/yogesh/.ssh/known_hosts&amp;sftpPrivateKeyFile=/home/yogesh/dev/camel/keys/openSSH.key&amp;sftpPrivateKeyFilePassphrase=wijis"/>
<to uri="file:/home/yogesh/dev/sftpTestFolder?append=false"/>

Looks like it is working to me.  I would like this functionality to be
included in the next camel release.  What are my next steps?  Should I
create SVN patches?  At some point do I update the WIKI?  Do I write test
cases (bear in mind this is hard to test because it is hard to find a public
sftp server that we can configure a public / private key pair).

Cheers,
Yogesh
-- 
View this message in context: 
http://www.nabble.com/SFTP-Component-private-key---passphrase-for-connection-tp20711040s22882p20711040.html
Sent from the Camel - Development mailing list archive at Nabble.com.

Reply via email to