diff options
-rw-r--r-- | obnamlib/plugins/sftp_plugin.py | 9 | ||||
-rwxr-xr-x | test-sftpfs | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py index 8ffc11f7..7510bdf0 100644 --- a/obnamlib/plugins/sftp_plugin.py +++ b/obnamlib/plugins/sftp_plugin.py @@ -179,7 +179,7 @@ class SftpFS(obnamlib.VirtualFileSystem): offered_key = self.transport.get_remote_server_key() - known_hosts_path = os.path.expanduser('~/.ssh/known_hosts') + known_hosts_path = self.settings['ssh-known-hosts'] known_hosts = paramiko.util.load_host_keys(known_hosts_path) known_keys = known_hosts.lookup(hostname) @@ -556,6 +556,13 @@ class SftpPlugin(obnamlib.ObnamPlugin): 'known and correct to be accepted; ' 'default is to accept unknown keys') + self.app.settings.string(['ssh-known-hosts'], + 'filename of the user\'s known hosts file ' + '(default: %default)', + metavar='FILENAME', + default= + os.path.expanduser('~/.ssh/known_hosts')) + self.app.settings.boolean(['pure-paramiko'], 'do not use openssh even if available, ' 'use paramiko only instead') diff --git a/test-sftpfs b/test-sftpfs index 55e6dc5f..06694228 100755 --- a/test-sftpfs +++ b/test-sftpfs @@ -47,6 +47,7 @@ class SftpTests(unittest.TestCase, obnamlib.VfsTests): 'sftp-delay': 0, 'ssh-key': '', 'strict-ssh-host-keys': False, + 'ssh-known-hosts': '/dev/null', } self.fs = obnamlib.plugins.sftp_plugin.SftpFS(baseurl, settings=settings) |