Thread: PostGreSQL remote access

PostGreSQL remote access

From
David Rickard
Date:
System: sparc-sun-solaris2.6
PostGreSQL build: 7.3.3
Problem: remote access through firewall

We installed PostGreSQL on a Solaris machine; we need to access the db remotely, via JDBC or through pgAdmin; we have edited the pg_hba.conf file to (theoretically) allow access to a test db from a developer's PC--but all access attempts (via JDBC or pgAdmin) are rejected with this error message:
        
        A connection error has occurred: FATAL:  No pg_hba.conf entry for host <IP>, user postgres, database testdb

The IP address returned in the error message is for our firewall;
PostGreSQL is configured to receive tcp/ip requests ( tcpip_socket = true in the postgresql.conf, and postmaster is started with the -i option); our sysadmin says that port 5432 is open (as is presumably indicated by the refused connection attempt);
We can connect to the db via JDBC--when the Java program is run on the same machine as PostGreSQL;

--

David Rickard
Software Engineer
The GTS Companies
A TechBooks Company

----------------------------------------------------------------------------------
The GTS Companies:
GTS Publishing Services, GTS Graphics, GTS Innova:
Your Single-Source Solution!
Los Angeles CA  *  York, PA  *  Boston MA  *  New Delhi, India
----------------------------------------------------------------------------------


David.Rickard@GTSCompanies.com
Visit us on the World Wide Web
http://www.gtscompanies.com
5650 Jillson St., Los Angeles, CA 90040
(323) 888-8889 x331
(323) 888-1849 [fax]

Re: PostGreSQL remote access

From
"Mel Jamero"
Date:
You've most probably just misconfigured something in the pg_hba.conf file because of the error message you're getting.  Happened to me more than once.
 
If you allow it, paste the contents of your pg_hba.conf here and surely someone (hopefully one would be me) in the list could point out what's wrong.
 
---
Mel
-----Original Message-----
From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of David Rickard
Sent: Tuesday, June 24, 2003 6:01 AM
To: pgsql-novice@postgresql.org
Cc: Judith Strawser; Dave Cimini
Subject: [NOVICE] PostGreSQL remote access

System: sparc-sun-solaris2.6
PostGreSQL build: 7.3.3
Problem: remote access through firewall

We installed PostGreSQL on a Solaris machine; we need to access the db remotely, via JDBC or through pgAdmin; we have edited the pg_hba.conf file to (theoretically) allow access to a test db from a developer's PC--but all access attempts (via JDBC or pgAdmin) are rejected with this error message:
        
        A connection error has occurred: FATAL:  No pg_hba.conf entry for host <IP>, user postgres, database testdb

The IP address returned in the error message is for our firewall;
PostGreSQL is configured to receive tcp/ip requests ( tcpip_socket = true in the postgresql.conf, and postmaster is started with the -i option); our sysadmin says that port 5432 is open (as is presumably indicated by the refused connection attempt);
We can connect to the db via JDBC--when the Java program is run on the same machine as PostGreSQL;

--

David Rickard
Software Engineer
The GTS Companies
A TechBooks Company

----------------------------------------------------------------------------------
The GTS Companies:
GTS Publishing Services, GTS Graphics, GTS Innova:
Your Single-Source Solution!
Los Angeles CA  *  York, PA  *  Boston MA  *  New Delhi, India
----------------------------------------------------------------------------------


David.Rickard@GTSCompanies.com
Visit us on the World Wide Web
http://www.gtscompanies.com
5650 Jillson St., Los Angeles, CA 90040
(323) 888-8889 x331
(323) 888-1849 [fax]

Re: PostGreSQL remote access

From
David Rickard
Date:
Further information:
These are the host lines from our pg_hba.conf file:

host    all         all          127.0.0.1           255.255.255.255   trust
host    all         all          0.0.0.0               0.0.0.0                 trust
host    testdb   postgres 208.179.178.94  255.255.255.0        trust

At 03:01 PM 6/23/2003 -0700, you wrote:
System: sparc-sun-solaris2.6
PostGreSQL build: 7.3.3
Problem: remote access through firewall

We installed PostGreSQL on a Solaris machine; we need to access the db remotely, via JDBC or through pgAdmin; we have edited the pg_hba.conf file to (theoretically) allow access to a test db from a developer's PC--but all access attempts (via JDBC or pgAdmin) are rejected with this error message:
        
        A connection error has occurred: FATAL:  No pg_hba.conf entry for host <IP>, user postgres, database testdb

The IP address returned in the error message is for our firewall;
PostGreSQL is configured to receive tcp/ip requests ( tcpip_socket = true in the postgresql.conf, and postmaster is started with the -i option); our sysadmin says that port 5432 is open (as is presumably indicated by the refused connection attempt);
We can connect to the db via JDBC--when the Java program is run on the same machine as PostGreSQL;

--

David Rickard
Software Engineer
The GTS Companies
A TechBooks Company

----------------------------------------------------------------------------------
The GTS Companies:
GTS Publishing Services, GTS Graphics, GTS Innova:
Your Single-Source Solution!
Los Angeles CA  *  York, PA  *  Boston MA  *  New Delhi, India
----------------------------------------------------------------------------------


David.Rickard@GTSCompanies.com
Visit us on the World Wide Web
http://www.gtscompanies.com
5650 Jillson St., Los Angeles, CA 90040
(323) 888-8889 x331
(323) 888-1849 [fax]


--

David Rickard
Software Engineer
The GTS Companies
A TechBooks Company

----------------------------------------------------------------------------------
The GTS Companies:
GTS Publishing Services, GTS Graphics, GTS Innova:
Your Single-Source Solution!
Los Angeles CA  *  York, PA  *  Boston MA  *  New Delhi, India
----------------------------------------------------------------------------------


David.Rickard@GTSCompanies.com
Visit us on the World Wide Web
http://www.gtscompanies.com
5650 Jillson St., Los Angeles, CA 90040
(323) 888-8889 x331
(323) 888-1849 [fax]

Re: PostGreSQL remote access

From
Bruno Wolff III
Date:
On Tue, Jun 24, 2003 at 09:59:02 -0700,
  David Rickard <David.Rickard@GTScompanies.com> wrote:
> Further information:
> These are the host lines from our pg_hba.conf file:
>
> host    all         all          127.0.0.1           255.255.255.255   trust
> host    all         all          0.0.0.0               0.0.0.0
>    trust
> host    testdb   postgres 208.179.178.94  255.255.255.0        trust

Can you try using:
host    testdb   postgres 208.179.178.0  255.255.255.0        trust

I don't know for sure, but it may be that the mask is only applied to
the connecting IP, and not the one in the config file.

If you really just want that one IP address (rather than allowing access
to all of 208.179.178.0/24), then you should use a mask of 255.255.255.255.