diff options
-rw-r--r-- | obnamlib/plugins/sftp_plugin.py | 7 | ||||
-rwxr-xr-x | test-sftpfs | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py index 7510bdf0..00342f53 100644 --- a/obnamlib/plugins/sftp_plugin.py +++ b/obnamlib/plugins/sftp_plugin.py @@ -143,8 +143,15 @@ class SftpFS(obnamlib.VirtualFileSystem): '-s'] if self.settings and self.settings['ssh-key']: args += ['-i', self.settings['ssh-key']] + if self.settings and self.settings['strict-ssh-host-keys']: + args += ['-o', 'StrictHostKeyChecking=yes'] + if self.settings and self.settings['ssh-known-hosts']: + args += ['-o', + 'UserKnownHostsFile=%s' % + self.settings['ssh-known-hosts']] args += [self.host, 'sftp'] + logging.debug('executing openssh: %s' % args) try: proc = subprocess.Popen(args, stdin=subprocess.PIPE, diff --git a/test-sftpfs b/test-sftpfs index 06694228..b73ce571 100755 --- a/test-sftpfs +++ b/test-sftpfs @@ -42,12 +42,12 @@ class SftpTests(unittest.TestCase, obnamlib.VfsTests): self.basepath = tempfile.mkdtemp() baseurl = 'sftp://localhost%s' % self.basepath settings = { - 'pure-paramiko': True, + 'pure-paramiko': False, 'create': True, 'sftp-delay': 0, 'ssh-key': '', 'strict-ssh-host-keys': False, - 'ssh-known-hosts': '/dev/null', + 'ssh-known-hosts': os.path.expanduser('~/.ssh/known_hosts'), } self.fs = obnamlib.plugins.sftp_plugin.SftpFS(baseurl, settings=settings) |