Automatic reconnection of ssh tunnels. This could be quite useful. Found this from here.
- autossh is a program to start a copy of ssh and monitor it, restarting
it as necessary should it die or stop passing traffic. The idea is
from rstunnel (Reliable SSH Tunnel), but implemented in C.
- The author’s view is that it is not as fiddly as rstunnel to get to
- Connection monitoring using a loop of port forwardings or a remote echo
- Backs off on rate of connection attempts when experiencing rapid
failures such as connection refused.
- Compiled and tested on OpenBSD, Linux, Solaris, Mac OS X, Cygwin, and AIX;
should work on other BSDs.
- Use with “screen” for perpetual session (see included script “rscreen”).
Oh this is so cool. Man webfaction is just changing my whole development life in a good way.
I want to be able to write an app in django with my normal tools here, but still have Facebook access it. I’ve done the “open the port on the router” bit and I don’t like it. I like ssh tunnels though. I hadn’t done remote port forwarding before but in starting to look for a solution, a comment on a post here said what I wanted to here. “Avoid the port-forwarding/NAT traversal/firewall morass”. Following the link, the interesting bit is this:
developing a facebook app locally :: snax
rake task opens an SSH connection to our server and forwards a port on
it to our local box. This will work no matter what kind of NAT or proxy
you are behind, as long as you can access your server via SSH.
It’s ruby specific stuff but I got the idea. It was doing the remote port forwarding. Now I come from 1&1. I am not used to the power and flexibility of webfaction so every time I learn something like this… it’s just groovy. Like just a couple of days ago I was informed that it’s possible to set up secure https/.htaccess protected webdav access to a folder you specify in your account. I haven’t had any trouble with 1&1 actually. And now they are the media server since the hard drive space is generous for the price.
So, with all the said, these are the steps for a webfaction user.
- Set up a new app listening on a custom port
- Set up a new subdomain for my custom app
- Set up a new website connecting the new app with the new subdomain
- Got the port of the app as listed in the control panel
- Use 127.0.0.1 for the local host (localhost itself seemed not to work, but I haven’t tested extensively)
- Command for term use is
ssh -N -p 22 -c 3des your_username@your_ssh_server.webfactional.com -R port_of_app:127.0.0.1:local_server_port
I use SSH Tunnel Manager to manage tunnels on a mac instead of opening a bunch of iTerm shells. The settings look like:
- Name: connection name
- Login: your user name
- Host: your_ssh_host.webfactional.com
- Port: 22
- Port: port_to_app
- Remote Host: 127.0.0.1
- Port: local_port
I was a bit surprised to actually see my local dev server respond. Now… just have to learn how to code it all… but this makes it a LOT easier. I can point the Facebook app url to my outside URL and test locally without copying files to a remote server for testing… though that is admittedly easier with Subclipse and ssh tunneling! Let’s see how it goes. Thanks webfaction!