From 0e2ee14a005ef79efe0c8317fb69d4f71446a37f Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Mon, 6 Apr 2015 22:33:23 -0400 Subject: [PATCH] JCLOUDS-884: Only try netcat over ssh-agent as an agentproxy See http://markmail.org/thread/oto47qk2kzcdtebb --- .../org/jclouds/ssh/jsch/config/JschSshClientModule.java | 8 +++++++- .../org/jclouds/sshj/config/SshjSshClientModule.java | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java index 3f30091ff5..d51788a0ed 100644 --- a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java +++ b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java @@ -53,8 +53,14 @@ public class JschSshClientModule extends AbstractModule { Optional agentConnector = getAgentConnector(); Optional getAgentConnector() { + ConnectorFactory sshAgentOverNetcatOnly = new ConnectorFactory() { + { + setPreferredConnectors("ssh-agent"); + setPreferredUSocketFactories("nc"); + } + }; try { - return Optional.of(ConnectorFactory.getDefault().createConnector()); + return Optional.of(sshAgentOverNetcatOnly.createConnector()); } catch (final AgentProxyException e) { return Optional.absent(); } diff --git a/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java b/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java index 20b0767c3a..4daae8eaee 100644 --- a/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java +++ b/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java @@ -42,7 +42,6 @@ public class SshjSshClientModule extends AbstractModule { bind(SshClient.Factory.class).to(Factory.class).in(Scopes.SINGLETON); } - private static class Factory implements SshClient.Factory { @Named(Constants.PROPERTY_CONNECTION_TIMEOUT) @Inject(optional = true) @@ -51,8 +50,14 @@ public class SshjSshClientModule extends AbstractModule { Optional agentConnector = getAgentConnector(); Optional getAgentConnector() { + ConnectorFactory sshAgentOverNetcatOnly = new ConnectorFactory() { + { + setPreferredConnectors("ssh-agent"); + setPreferredUSocketFactories("nc"); + } + }; try { - return Optional.of(ConnectorFactory.getDefault().createConnector()); + return Optional.of(sshAgentOverNetcatOnly.createConnector()); } catch (final AgentProxyException e) { return Optional.absent(); }