Re: ssl tunneling in postgres 8.1 - Mailing list pgsql-novice

From Tom Lane
Subject Re: ssl tunneling in postgres 8.1
Date
Msg-id 24251.1227038383@sss.pgh.pa.us
Whole thread Raw
In response to ssl tunneling in postgres 8.1  ("P Kapat" <kap4lin@gmail.com>)
Responses Re: ssl tunneling in postgres 8.1
List pgsql-novice
"P Kapat" <kap4lin@gmail.com> writes:
> I am reading the documentation from here:
> http://www.postgresql.org/docs/8.1/static/ssh-tunnels.html

> I am able to ssh (I use ssh keys) in to foo.com using the username
> joe. My client machine (localhost) is bar.com with username sam (say).

> bar$ ssh -L 3333:foo.com:5432 joe@foo.com
> [this logs me into foo as joe; here i have access to a database named
> "joe" using the password "joepass"]

> So I try to connect to this local port (but remote server) by:

> bar$ psql -h localhost -p 3333 joe -U joe -W
> Password for user joe: joepass
> psql: server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.

> And on the remote ssh terminal I get the following error:

> foo$ channel 3: open failed: connect failed: Connection refused

> What am I doing wrong?

My bet is that you have the Postgres server configured so that it
only accepts Unix-socket connections and not local TCP connections
(which is what the SSH tunnel will try to connect to).  If you do
"psql -h localhost" on the remote server, does it work?

If not, you need to fool with listen_addresses and possibly your
pg_hba.conf setup.

            regards, tom lane

pgsql-novice by date:

Previous
From: "P Kapat"
Date:
Subject: Re: ssl tunneling in postgres 8.1
Next
From: "P Kapat"
Date:
Subject: Re: ssl tunneling in postgres 8.1