Skip to content

Commit

Permalink
Support for ssh config 'none' for ProxyCommand; support for ssh confi…
Browse files Browse the repository at this point in the history
…g %h variable in HostName field
  • Loading branch information
jjlauer committed Nov 8, 2023
1 parent bc72df1 commit a5c6138
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected Result doRun() throws BlazeException {

// has proxy command?
String proxyCommand = config.getValue("ProxyCommand");
if (proxyCommand != null) {
if (proxyCommand != null && !proxyCommand.equalsIgnoreCase("none")) {
if (this.proxy != null) {
log.debug("Session proxy set but host has ProxyCommand");
} else {
Expand Down Expand Up @@ -383,7 +383,14 @@ protected Result doRun() throws BlazeException {
// via hostname
proxyInfo = " via " + this.proxy;
}


// workaround hosts that have a "%h" in them
if (jschSession.getHost().contains("%h")) {
// we need to swap in the original host replaced for the %h var
jschSession.setHost(jschSession.getHost().replace("%h", uri.getHost()));
}


log.info("Open ssh://{}@{}:{}{}...",
jschSession.getUserName(), jschSession.getHost(), jschSession.getPort(), proxyInfo);

Expand Down

0 comments on commit a5c6138

Please sign in to comment.