Issue #289 Support for ssh proxy

This commit is contained in:
Hannes Giesenow 2016-04-11 17:30:36 +02:00
parent 47e4d7c9a1
commit 51156c13f9
5 changed files with 13 additions and 1 deletions

View file

@ -388,6 +388,15 @@ class Config
return $this->deployment('identity-file') ? ('-i ' . $this->deployment('identity-file') . ' ') : '';
}
/**
* Get additional ssh proxy
*
* @return string
*/
public function getSshProxy()
{
return $this->deployment('ssh-proxy') ? $this->deployment('ssh-proxy') : '';
}
/**
* Get the ConnectTimeout option
*

View file

@ -208,7 +208,7 @@ class Console
$return = 1;
$log = array();
exec(escapeshellcmd($command . ' 2>&1'), $log, $return);
exec($command . ' 2>&1', $log, $return);
$log = implode(PHP_EOL, $log);
if (!$return) {

View file

@ -198,6 +198,7 @@ abstract class AbstractTask
$localCommand = 'ssh ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
. ($this->getConfig()->getSshProxy() ? sprintf('-o ProxyCommand="ssh -W %%h:%%p %s" ', $this->getConfig()->getSshProxy()) : '')
. $this->getConfig()->getConnectTimeoutOption()
. ($this->getConfig()->deployment('user') != '' ? $this->getConfig()->deployment('user') . '@' : '')
. $this->getConfig()->getHostName();

View file

@ -97,6 +97,7 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$command = 'rsync -avz '
. $strategyFlags . ' '
. '--rsh="ssh ' . $this->getConfig()->getHostIdentityFileOption() . '-p' . $this->getConfig()->getHostPort() . '" '
. ($this->getConfig()->getSshProxy() ? sprintf('-e \'ssh -A %s ssh\' ', $this->getConfig()->getSshProxy()) : '')
. $this->excludes($excludes) . ' '
. $this->excludesListFile($excludesListFilePath) . ' '
. $this->getConfig()->deployment('from') . ' '

View file

@ -96,6 +96,7 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$command = 'scp ' . $strategyFlags . ' ' . $this->getConfig()->getHostIdentityFileOption()
. $this->getConfig()->getConnectTimeoutOption() . '-P ' . $this->getConfig()->getHostPort()
. " -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "
. ($this->getConfig()->getSshProxy() ? sprintf('-o ProxyCommand="ssh -W %%h:%%p %s" ', $this->getConfig()->getSshProxy()) : '')
. ' ' . $localTarGz . '.tar.gz '
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':'
. $deployToDirectory;