Re: Permanent SSH Tunnel

JP Fielding <[email protected]> Wed, 21 Sep 2005 05:25:40 -0400
Newsgroups gmane.org.user-groups.linux.morlug
Message-ID <[email protected]>
 ssh -o ServerAliveInterval=60 -fNL 3306:192.168.1.120:3306 [email protected]

is what i use (at my other job ;-) ), it seems to do the trick

hope that helps...
jp


On 9/20/05, David A. Riggs <[email protected]> wrote:
> Due to an unfortunate kludge of an integration project, I need to rely
> on an SSH tunnel providing access to a database on another host. The
> server will only allow database connections from localhost. I've got an
> SSH tunnel set up as follows:
>
> $> ssh -fNL 3306:localhost:3306 user@dbserver
>
> which connects my local port 3306 (MySQL) via the SSH connection
> user@dbserver, to port 3306 on dbserver *from* dbserver.
>
> My concern is that this solution is a fragile one, I fear that a network
> interruption will sever this connection at some point leaving my local
> application stranded from its database. I've not yet observed this, but
> I frequently have interactive SSH sessions broken and suspect this one
> could be broken as well.
>
> Can anyone suggest a more robust solution to this problem? I don't have
> a full grasp of stunnel, but it seems that it could be triggered from
> inetd to perform this task perhaps? Could something like runit be used
> to reestablish the SSH connection if it fails? Is there some obscure
> product that does exactly what I need?
>
> - David A. Riggs <[email protected]>
>
> _______________________________________________
> Morlug mailing list
> [email protected]
> http://mailman.morlug.org/mailman/listinfo/morlug
>