This commit is contained in:
Ondřej Vodáček 2017-01-02 22:49:21 +00:00 committed by GitHub
commit e7a4b82eed
3 changed files with 12 additions and 2 deletions

View file

@ -387,6 +387,16 @@ class Config
return $this->deployment('identity-file') ? ('-i ' . $this->deployment('identity-file') . ' ') : '';
}
/**
* Get UserKnownHostsFile & StrictHostKeyChecking options
*
* @return string
*/
public function getStrictHostCheckingOption()
{
return $this->general('ssh-strict-host-key-checking', true) ? '' : ' -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ';
}
/**
* Get the ConnectTimeout option
*

View file

@ -197,7 +197,7 @@ abstract class AbstractTask
$needs_tty = ($this->getConfig()->general('ssh_needs_tty', false) ? '-t' : '');
$localCommand = 'ssh ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
. $this->getConfig()->getStrictHostCheckingOption()
. $this->getConfig()->getConnectTimeoutOption()
. ($this->getConfig()->deployment('user') != '' ? $this->getConfig()->deployment('user') . '@' : '')
. $this->getConfig()->getHostName();

View file

@ -94,7 +94,7 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
// Copy Tar Gz to Remote Host
$command = 'scp ' . $strategyFlags . ' ' . $this->getConfig()->getHostIdentityFileOption()
. $this->getConfig()->getConnectTimeoutOption() . '-P ' . $this->getConfig()->getHostPort()
. " -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "
. $this->getConfig()->getStrictHostCheckingOption()
. ' ' . $localTarGz . '.tar.gz '
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':'
. $deployToDirectory;