Reusing SSH connections

I recently switched to darcs 2.0 because of my switch to Arch Linux. When I was trying to push an update to my DokuWiki repository it connected and then just froze. It took me a while to find out what was going on, but when I tried to log onto my server and it didn't work it dawned on me that I had just blacklisted my self.

I'm using iptable's rate limit support to block too fast SSH connection attempts. The problem was that darcs used a new SSH connection for pulling each single patch. This was obviously changed in darcs 2.0 for whatever reason. The solution is simple - just add the following line to your ~/.darcs/defaults:

ALL ssh-cm

What it does is enabling the SSH ControlMaster feature when connecting to the server. This is a pretty useful feature not only for darcs but for all SSH connections. Instead of always opening new connections it will just open one and create a socket where other SSH connections can hook on. This means you will only be asked once for your password or key passphrase as long as one of the connections to the host is still open.

To enable the ControlMaster feature by default, just add the following lines to your /etc/ssh/ssh_config:

Host *
  ControlMaster auto
  ControlPath ~/.ssh/master-%r@%h:%p

It will also make subsequent connection attempts a tiny bit faster because the whole key checking handshake stuff will be omitted.

Tags:
ssh,
controlmaster,
darcs,
linux
Similar posts:

 
Posted on Monday June the 2nd, 2008 (3 months ago).

Comments

1
We had disabled ssh-cm by default because on MacOS X (and maybe Linux), it sometimes hangs.  This is a known OpenSSH bug, apparently, one that has been fixed in the version that ships with the latest MacOS.

Also, this switch should not be necessary if you have darcs2 on both ends.  The reason is that darcs2 has a new (hidden) command that lets it fetch all files using a single connection.  The command (darcs transfer-mode) acts as a poor man's ftp; it only fetches files.  This could be helpful is ssh-cm is not an option.
2008-06-04 17:31:31
2
Ah! So that's the reason. My server runs on Debian, so there is still darcs 1.3 installed.
2008-06-05 00:25:26
CAPTCHA

No HTML allowed. URLs will be linked with nofollow attribute. Whitespace is preserved.

 
 

Blog

Older Weblog articles are available in the Archive, subscribe to the
Full Content RSS Feed
to stay tuned. (learn more)

Subscribe to the Feed

Recent Blog Entries

 

This is the personal web site of Andreas Gohr - human being, blogger and web geek from Berlin, Germany.

This page was last updated at 2008/06/02 21:30.
Imprint/Impressum

Tagged at del.icio.us:

Bookmarks: 2

View blog reactions

Advertising:

Advertise Here
advertise here

Recent readers: