[thelist] plink from unix and keepalives
Juha Suni
juha.suni at ilmiantajat.fi
Tue Oct 11 04:05:30 CDT 2005
Hi.
Our web application running on a linux-box connects to a remote (windows MS
SQL) database through an ssh tunnel I have set up with plink running from
the web server. The connection is ok, and the database connections work as
expected.
Command line I use to open the ssh tunnel is (connection details bogus):
"plink -N -pw password -L 1234:remotename:4321 login at 192.168.0.1 >/dev/null
2>&1 &"
Lately we have run into problems with the ssh tunnel being unstable and
disconnecting. So far I have been running a simple cronjob to regulary check
if the ssh connection script is still running, and restart it if necessary.
Since there are timeouts involved and I cannot have the cronjob running
every second, there are occasions when the ssh tunnel is down when the
webapp tries to use the database through it.
I am suspecting the problem has more to do with keepalives and ssh-sessions
timing out than with actual network failures.
I have googled myself to death but have not found an answer to my problem:
How do I define keepalive settings in unix plink?
According to the putty 0.58 (which I am using to create the ssh tunnel)
changelog:
(http://www.chiark.greenend.org.uk/~sgtatham/putty/changes.html)
"Bug fix: keepalives are now supported everywhere. (Previously they were
supported by Windows GUI PuTTY, but were missing in Plink, PSFTP and the
Unix port.)"
This would suggest that keepalives CAN be set with the command line plink.
However, neither the manual or any other resource on the net seems to give a
clue as to how this should be accomplished. All I would need is the command
line option for this.
Alternatively, as a second hand option, I am open to any other suggestions
on opening an ssh tunnel from the linux box to the database server.
Requirements are that it is an easy to run script that requires no user
interaction, so it can be run behind the scenes, and its status can be
checked with a script so that I can reinitiate the tunnel automatically if
it goes down.
After all, I thought getting the database connection from a LAMP setup to
work with a MS SQL server would be a pain in the ass. After some upgrades it
proved to work flawlessly. And now I'm stuck with a simple ssh tunnel that
just cant stay alive as well as it should.
All help will be greatly appreciated.
--
Suni
More information about the thelist
mailing list