Re: checking ssh tunnels: best practices?
|The problem is that sometimes these programs don't work
|right and hassle ensues if I start them up without starting
|up my ssh session first, or if the ssh session has dropped
|someplace along the way. A lot of the time I'm working
|locally, so I might not notice that the tunnel went away,
|and exim will tell me that the message couldn't be
|delivered, etc.
you could use a vpn (vtun, openvpn)
which tries all the time to connect.
you could start ssh automatically with a wrapper to restart it
each time the connexion is dropped. (and start all of this
inside of a screen) :
wrapper :
#!/bin/sh
while ($e);do $@ ;date;echo "$@... ";echo sleeping 300;sleep 300 ;done
screenrc :
defescape ^na
escape ^na
nethack on
startup_message off
vbell on
defscrollback 1024
deflogin off
obuflimit 30000
screen wrapper.sh ssh -L 2525:localhost:25 mailhost
startup script :
screen -d -m -S tunnel -c ~/.screenrc
and link the startup script from, say, /etc/rc2.d/S80screen
--
xavier renaut
Reply to: