You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by hlta <no...@github.com> on 2015/04/24 09:02:18 UTC
[jclouds] Use ssh agent if privatekey and password are not provided
(#735)
You can view, comment on, or merge this pull request online at:
https://github.com/jclouds/jclouds/pull/735
-- Commit Summary --
* Use ssh agent if privatekey and password is not set
-- File Changes --
M drivers/jsch/src/main/java/org/jclouds/ssh/jsch/SessionConnection.java (18)
-- Patch Links --
https://github.com/jclouds/jclouds/pull/735.patch
https://github.com/jclouds/jclouds/pull/735.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/735
Re: [jclouds] Use ssh agent if privatekey and password are not
provided (#735)
Posted by Ignasi Barrera <no...@github.com>.
Just a couple comments. Thanks @hlta!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/735#issuecomment-95851931
Re: [jclouds] Use ssh agent if privatekey and password are not
provided (#735)
Posted by Ignasi Barrera <no...@github.com>.
> - } else if (loginCredentials.hasUnencryptedPrivateKey()) {
> - byte[] privateKey = loginCredentials.getOptionalPrivateKey().get().getBytes();
> - jsch.addIdentity(loginCredentials.getUser(), privateKey, null, emptyPassPhrase);
> - } else if (agentConnector.isPresent()) {
> - JSch.setConfig("PreferredAuthentications", "publickey");
> - jsch.setIdentityRepository(new RemoteIdentityRepository(agentConnector.get()));
> - }
> + if (loginCredentials.hasUnencryptedPrivateKey()) {
> + byte[] privateKey = loginCredentials.getOptionalPrivateKey().get().getBytes();
> + jsch.addIdentity(loginCredentials.getUser(), privateKey, null, emptyPassPhrase);
> + } else if (loginCredentials.getOptionalPassword().isPresent()) {
> + session.setPassword(loginCredentials.getOptionalPassword().orNull());
> + } else if (agentConnector.isPresent()) {
> + JSch.setConfig("PreferredAuthentications", "publickey");
> + jsch.setIdentityRepository(new RemoteIdentityRepository(agentConnector.get()));
> + }
Can you set the order of the conditionals so the password authentication takes preference, just [like in the sshj driver](https://github.com/jclouds/jclouds/blob/master/drivers/sshj/src/main/java/org/jclouds/sshj/SSHClientConnection.java#L160-L169)?
Also re-indent your change to 3 spaces, to keep the code aligned with the [jclouds code style](https://cwiki.apache.org/confluence/display/JCLOUDS/Coding+Standards).
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/735/files#r29032258
Re: [jclouds] Use ssh agent if privatekey and password are not
provided (#735)
Posted by Ignasi Barrera <no...@github.com>.
Squashed and pused to [master](http://git-wip-us.apache.org/repos/asf/jclouds/commit/f646b84c) and [1.9,x](http://git-wip-us.apache.org/repos/asf/jclouds/commit/522c080a). Thanks @hlta!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/735#issuecomment-111089129
Re: [jclouds] Use ssh agent if privatekey and password are not
provided (#735)
Posted by Ignasi Barrera <no...@github.com>.
Closed #735.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/735#event-328382066