fabric/fabric — pull request #821 by rasky (2013-01-13 16:07:35+00:00)
Title: Add rtunnel() context manager to open a reverse tunnel (server to client)

Hello,

this pull request implement a rtunnel() context manager that allows to setup a remote forwarding tunnel (listening on the server side, tunneling over SSH and the forwarding to a locally-reachable host:port).

It implements half of issue #78 (the half I was interested in :). I've tested the code and am already using it in my deploy scripts.

**Note:** while working on this patch, some exceptions would trigger a weird error message: `No handlers could be found for logger "paramiko.transport"` with no information about the actual exception. I had to add this code to see the exceptions:

```python
import logging
log = logging.getLogger("paramiko.transport")
sh = logging.StreamHandler()
sh.setLevel(logging.DEBUG)
log.addHandler(sh)
```

This is probably an unrelated bug: fabric does not configure paramiko logger correctly. You can reproduce the error by adding a typo within the function `accept()` in my code.