Reported-By: David Fries
---

Joey Hess [bug reporter],
Here's a patch to the current obnam bzr trunk for being able to pass
additional options to ssh such as -4 or -6, without obnam having to
add those options specifically.  I don't know how easily it would
apply to the current Debian 1.1 version.
--ssh-options='-v -4'


I added this because I've been using rsync and it supports limiting
the bandwidth.  For over Internet backups I don't want to saturation
the link degrading performance when it's a backup that can run for
hours.  sftp also has a similar option, but I didn't realize until I
added it that since obnam is calling ssh directly that option isn't
available.

 NEWS                            |    1 +
 obnamlib/plugins/sftp_plugin.py |   25 +++++++++++++++++--------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 00e5506..24f79da 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ Version X.Y, released UNRELEASED
   to what `obnam backup` does. Suggested by "S. B.".
 * SSHChannelAdapter now reports the number of bytes send and received
   (before ssh encryption), from David Fries
+* new option 'ssh-options' to pass additional options to ssh from David Fries
 
 Bug fixes:
 
diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py
index 2049b22..d144105 100644
--- a/obnamlib/plugins/sftp_plugin.py
+++ b/obnamlib/plugins/sftp_plugin.py
@@ -172,14 +172,18 @@ class SftpFS(obnamlib.VirtualFileSystem):
                 '-p', str(self.port),
                 '-l', self.user,
                 '-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']]
+        if self.settings:
+            if self.settings['ssh-key']:
+                args += ['-i', self.settings['ssh-key']]
+            if self.settings['strict-ssh-host-keys']:
+                args += ['-o', 'StrictHostKeyChecking=yes']
+            if self.settings['ssh-known-hosts']:
+                args += ['-o', 
+                         'UserKnownHostsFile=%s' % 
+                            self.settings['ssh-known-hosts']]
+            if self.settings['ssh-options']:
+                for option in self.settings['ssh-options'].split():
+                    args += [option]
         args += [self.host, 'sftp']
 
         logging.debug('executing openssh: %s' % args)
@@ -615,6 +619,11 @@ class SftpPlugin(obnamlib.ObnamPlugin):
                                     os.path.expanduser('~/.ssh/known_hosts'),
                                  group=ssh_group)
 
+        self.app.settings.string(['ssh-options'],
+                                 'Options added to the ssh command line, such '
+                                 'as -4 -6 -o <ssh_option>.',
+                                 group=ssh_group)
+
         self.app.settings.boolean(['pure-paramiko'],
                                  'do not use openssh even if available, '
                                     'use paramiko only instead',
-- 
1.7.10.4


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to