JCLOUDS-884: Only try netcat over ssh-agent as an agentproxy

See http://markmail.org/thread/oto47qk2kzcdtebb
This commit is contained in:
Andrew Phillips 2015-04-06 22:33:23 -04:00
parent f379565114
commit 0e2ee14a00
2 changed files with 14 additions and 3 deletions

View File

@ -53,8 +53,14 @@ public class JschSshClientModule extends AbstractModule {
Optional<Connector> agentConnector = getAgentConnector();
Optional<Connector> 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();
}

View File

@ -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<Connector> agentConnector = getAgentConnector();
Optional<Connector> 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();
}