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 0c6052f803
commit 7f38520314
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> agentConnector = getAgentConnector();
Optional<Connector> getAgentConnector() { Optional<Connector> getAgentConnector() {
ConnectorFactory sshAgentOverNetcatOnly = new ConnectorFactory() {
{
setPreferredConnectors("ssh-agent");
setPreferredUSocketFactories("nc");
}
};
try { try {
return Optional.of(ConnectorFactory.getDefault().createConnector()); return Optional.of(sshAgentOverNetcatOnly.createConnector());
} catch (final AgentProxyException e) { } catch (final AgentProxyException e) {
return Optional.absent(); return Optional.absent();
} }

View File

@ -42,7 +42,6 @@ public class SshjSshClientModule extends AbstractModule {
bind(SshClient.Factory.class).to(Factory.class).in(Scopes.SINGLETON); bind(SshClient.Factory.class).to(Factory.class).in(Scopes.SINGLETON);
} }
private static class Factory implements SshClient.Factory { private static class Factory implements SshClient.Factory {
@Named(Constants.PROPERTY_CONNECTION_TIMEOUT) @Named(Constants.PROPERTY_CONNECTION_TIMEOUT)
@Inject(optional = true) @Inject(optional = true)
@ -51,8 +50,14 @@ public class SshjSshClientModule extends AbstractModule {
Optional<Connector> agentConnector = getAgentConnector(); Optional<Connector> agentConnector = getAgentConnector();
Optional<Connector> getAgentConnector() { Optional<Connector> getAgentConnector() {
ConnectorFactory sshAgentOverNetcatOnly = new ConnectorFactory() {
{
setPreferredConnectors("ssh-agent");
setPreferredUSocketFactories("nc");
}
};
try { try {
return Optional.of(ConnectorFactory.getDefault().createConnector()); return Optional.of(sshAgentOverNetcatOnly.createConnector());
} catch (final AgentProxyException e) { } catch (final AgentProxyException e) {
return Optional.absent(); return Optional.absent();
} }