Обсуждение: ssh tunnel problem
I am trying to use psql over an ssh tunnel for the first time. I am able to login to the remote system with $ ssh 216.38.48.94 I can use psql logged into the remote system as the username. Here is a log: $ ssh -N -f -L 5430:216.38.48.94:5432 username@216.38.48.94 $ psql --host localhost --port 5430 --username username --dbname template1 channel 1: open failed: connect failed: Connection timed out psql: could not receive server response to SSL negotiation packet: Success Can anyone explain what is the problem? I did not expect that ssl would be used over the SSH port forward. Thanks
"Craig H. Anderson" <craig@coot.net> writes: > I am trying to use psql over an ssh tunnel for the first time. > > I am able to login to the remote system with > $ ssh 216.38.48.94 > > I can use psql logged into the remote system > as the username. > > Here is a log: > > $ ssh -N -f -L 5430:216.38.48.94:5432 username@216.38.48.94 $ psql > --host localhost --port 5430 --username username --dbname template1 > channel 1: open failed: connect failed: Connection timed out psql: > could not receive server response to SSL negotiation packet: Success > Can anyone explain what is the problem? > I did not expect that ssl would be used over the SSH port forward. That does seem odd. Check your pg-hba.conf entries on the server. Remember that the connection on the server side will appear to be coming from 127.0.0.1 (I *think* that's how SSH port forwarding works)... -Doug
I figured out my problem. Here is the log of a working psql over ssh. ssh -N -f -L 5430:127.0.0.1:5432 216.38.48.94 psql --host localhost --port 5430 --username username --dbname template1 Password: Welcome to psql, the PostgreSQL interactive terminal. ... template1=# The following attempt failed because 216.38.48.94 is the IP address of the Cisco DSL modem. The Postgresql server has a private address and the Cisco is forwarding the ssh port to the Postgresql IP address. The working ssh tunnel is 5430:127.0.0.1:5432, using the loopback address to refer to the system on the end of the ssh connection. ssh -N -f -L 5430:216.38.48.94:5432 username@216.38.48.94 psql --host localhost --port 5430 --username username --dbname template1 channel 1: open failed: connect failed: Connection timed out psql: could not receive server response to SSL negotiation packet: Success