Re: [PATCH] Input wanted on changes.

Toby Dickenson <[email protected]>
Newsgroups gmane.comp.web.zope.zodb.dirstorage
Message-ID <[email protected]>
On Monday 24 January 2005 16:41, Bj|rn Augustsson wrote:

> Perhaps I just haven't had enough coffee yet (though that seems unlikely,
> the way my hands move), but I don't really see how that solves it, at 
> least not without another patch. 

Ahh, yes. There is a detail I forgot to mention. (Im not using this technique 
in production, so there may be other gaps too. please do keep prodding)

> >From my reading of the ssh man page, I control that via the 
> -i <identity-file> switch, but I have no direct control over the args
> replica.py calls ssh with. Is there some environment variable that I
> don't know about?

There are various other ways to choose your private key. Last time I needed 
this, I used ~/.ssh/config on the secondary. From "man ssh_config":

     HostName
             Specifies the real host name to log into.  This can be used
             to specify nicknames or abbreviations for hosts.  Default is 
             the name given on the command line.  Numeric IP addresses
             are also permitted (both on the command line and in
             HostName specifications).

That is, your replica.py command line contains a host nickname, and 
~/.ssh/config maps that on to the real hostname and identity file.


Thinking aloud: You may also be able to leverage the ssh -A switch to pass 
authentication information from the master.


Waaah - all of those solutions are nasty..

rsync has a -e switch that lets you replace ssh, or include extra parameters 
to ssh. How about this attached (untested) patch that adds the same thing to 
replica.py? You could use -e "ssh -i identityfile"

Please let me know if this works and I will include it in the next release.

-- 
Toby Dickenson

____________________

Important Notice:

This email and any attachments are confidential and may contain trade secrets or be legally privileged. If you have received this email in error you must not use, rely upon, disclose, copy or distribute the contents. Please reply to the sender so that proper delivery can be arranged and delete the email from your computer.
Gemini Data Loggers monitor incoming and outgoing email to ensure satisfactory customer service, maintain company security and prevent abuse of their email system. However, any views expressed in this email are not necessarily those of Gemini and Gemini cannot be held responsible for the content.
Gemini makes best efforts to ensure emails are virus free; however you are advised to carry out your own checks. Gemini does not accept responsibility for any damage resulting from email viruses.
____________________
replica.diff (text/x-diff, 2.3 KB)
? build
Index: replica.py
===================================================================
RCS file: /cvsroot/dirstorage/DirectoryStorage/replica.py,v
retrieving revision 1.20
diff -c -2 -r1.20 replica.py
*** replica.py	6 Jul 2004 21:34:09 -0000	1.20
--- replica.py	24 Jan 2005 17:19:04 -0000
***************
*** 35,39 ****
  def main():
      try:
!         opts, args = getopt.getopt(sys.argv[1:], "hd:vq", [])
      except getopt.GetoptError:
          # print help information and exit:
--- 35,39 ----
  def main():
      try:
!         opts, args = getopt.getopt(sys.argv[1:], "hd:vqe:", [])
      except getopt.GetoptError:
          # print help information and exit:
***************
*** 55,58 ****
--- 55,62 ----
          elif o == '-d':
              r.ripath = a
+         elif o == '-e':
+             a = a.split()
+             if a:
+                 r.ssh = a
          else:
              sys.exit(usage())
***************
*** 81,85 ****
                  self.rhost = self.rhost[j+1:]
              self.local = 0
!             self.ssh = '/usr/bin/ssh'
              self.rpython = sys.executable
              self.ripath = mypath
--- 85,91 ----
                  self.rhost = self.rhost[j+1:]
              self.local = 0
!             self.ssh = [ '/usr/bin/ssh' ]
!             if self.user:
!                 self.ssh.extend( [ '-l', self.user ] )
              self.rpython = sys.executable
              self.ripath = mypath
***************
*** 89,95 ****
              cmd = [ sys.executable, os.path.join(mypath,'replica.py') ] 
          else:
!             cmd = [ self.ssh ]
!             if self.user:
!                 cmd.extend( [ '-l', self.user ] )
              cmd.extend ( [ self.rhost, self.rpython, os.path.join(self.ripath,"replica.py") ] )
          for i in range(0,self.verbose):
--- 95,99 ----
              cmd = [ sys.executable, os.path.join(mypath,'replica.py') ] 
          else:
!             cmd = self.ssh[:]
              cmd.extend ( [ self.rhost, self.rpython, os.path.join(self.ripath,"replica.py") ] )
          for i in range(0,self.verbose):
***************
*** 303,306 ****
--- 307,315 ----
      Show this help
  
+  -e COMMAND
+ 
+     Use specified command instead of /usr/bin/ssh for communication to the master.
+     COMMAND may also included parameters, for example -e "ssh -p 1234".
+ 
  """
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.