From a8d16201d4029c66f11c21ce5124ce58861c29dc Mon Sep 17 00:00:00 2001 From: Dave Finster Date: Mon, 28 Sep 2015 14:02:58 +1000 Subject: [PATCH] added key disableHostKeyChecking that if set to true will cause smartcopy to bypass the built-in SSH host key checks. This is useful if you dont want to worry about the known host file across reboots. If this key doesnt exist or is false, it is the admins responsibility to ensure the known hosts file is up to date --- configuration.json.example | 1 + lib/endpoint.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/configuration.json.example b/configuration.json.example index 5354d1f..3f079b2 100644 --- a/configuration.json.example +++ b/configuration.json.example @@ -5,6 +5,7 @@ "backupDestinationBasePath": "tank", "backupConfigurationDestinationPath": "tank/configs", "backupDestinationPrivateKeyPath": "/opt/backup_id_rsa", + "disableHostKeyChecking":true, "transferStrategy":"mbuffer", "snapshotIdentifier":"smartcopy", "mBufferLocalPath":"/opt/smartcopy/bin/mbuffer", diff --git a/lib/endpoint.js b/lib/endpoint.js index 29beea4..5eef573 100644 --- a/lib/endpoint.js +++ b/lib/endpoint.js @@ -20,6 +20,14 @@ Endpoint.prototype.sshCmd = function(){ cmdParts.push('-i'); cmdParts.push(this.privateKeyPath); } + if ( config.disableHostKeyChecking === true){ + cmdParts.push( + '-o', + 'UserKnownHostsFile=/dev/null', + '-o', + 'StrictHostKeyChecking=no' + ); + } var destination = ''; if ( this.username != null ){ destination += this.username + "@";