Subscribe to RSS feed

splitbrain.org - electronic brain surgery since 2001

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 (11 years ago).

Comments?

blog comments powered by Disqus