diff --git a/Mage/Config.php b/Mage/Config.php index aed925d..67be704 100644 --- a/Mage/Config.php +++ b/Mage/Config.php @@ -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 * diff --git a/Mage/Task/AbstractTask.php b/Mage/Task/AbstractTask.php index ec1d4e0..6b40747 100644 --- a/Mage/Task/AbstractTask.php +++ b/Mage/Task/AbstractTask.php @@ -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(); diff --git a/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php b/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php index b8fb478..f01e3e7 100644 --- a/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php +++ b/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php @@ -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;