Thread: pg_hba.conf problem

pg_hba.conf problem

From
David Nedrow
Date:
I'm trying to set up the cyrus imap server using PostgreSQL as the
authentication backend.

Currently, the issue I'm having is that I'm unable to connect via psql
on the loopback address (127.0.0.1).

I believe I have the pg_hba.conf file correct, though I've tried a
number of variations other than what I've included below. After each
change to pg_hba.conf, I bounce postgresql (stop start), but still get
a FATAL error re: missing entries for 127.0.0.1.

I'm stumped. I'm probably missing something simple, but I've looked at
a number of samples on usenet and in the PostgreSQL doco, but I haven't
been able to clear this up.

pg_hba.conf
===========

local  all      all             ident   sameuser
host    all         all         127.0.0.1/32          password

command and error
=================

[root@netfinity root]# psql mail -U mail -W -h 127.0.0.1 <
/var/www/html/web-cyradm-0.5.3-1/scripts/create_pgsql.sql
Password: *********
psql: FATAL:  No pg_hba.conf entry for host 127.0.0.1, user mail,
database mail

[root@netfinity root]#


Any ideas?

-David



Re: pg_hba.conf problem

From
Peter Eisentraut
Date:
David Nedrow writes:

> pg_hba.conf
> ===========
>
> local  all      all             ident   sameuser
> host    all         all         127.0.0.1/32          password
>
> command and error
> =================
>
> [root@netfinity root]# psql mail -U mail -W -h 127.0.0.1 <
> /var/www/html/web-cyradm-0.5.3-1/scripts/create_pgsql.sql
> Password: *********
> psql: FATAL:  No pg_hba.conf entry for host 127.0.0.1, user mail,
> database mail

The syntax x.x.x.x/y is only supported in 7.4, but you appear to be using
something older than 7.4.

--
Peter Eisentraut   peter_e@gmx.net


Re: pg_hba.conf problem

From
David Nedrow
Date:
Peter,

Note that I've also tried the following straight for the original
pg_hba.conf file itself. No luck.

# TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
METHOD

host    all         all         127.0.0.1         255.255.255.255
password

On Nov 30, 2003, at 14:05, Peter Eisentraut wrote:

> David Nedrow writes:
>
>> pg_hba.conf
>> ===========
>>
>> local  all      all             ident   sameuser
>> host    all         all         127.0.0.1/32          password
>>
>> command and error
>> =================
>>
>> [root@netfinity root]# psql mail -U mail -W -h 127.0.0.1 <
>> /var/www/html/web-cyradm-0.5.3-1/scripts/create_pgsql.sql
>> Password: *********
>> psql: FATAL:  No pg_hba.conf entry for host 127.0.0.1, user mail,
>> database mail
>
> The syntax x.x.x.x/y is only supported in 7.4, but you appear to be
> using
> something older than 7.4.
>
> --
> Peter Eisentraut   peter_e@gmx.net
>


Re: pg_hba.conf problem

From
Alvaro Herrera
Date:
On Sun, Nov 30, 2003 at 06:10:08PM -0500, David Nedrow wrote:

> Note that I've also tried the following straight for the original
> pg_hba.conf file itself. No luck.
>
> host    all         all         127.0.0.1         255.255.255.255
> password

Huh, did you cause the postmaster to reload the pg_hba.conf file after
changing it?  You should send it SIGHUP (kill -HUP) or use pg_ctl reload.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Crear es tan difícil como ser libre" (Elsa Triolet)

Re: pg_hba.conf problem

From
David Nedrow
Date:
Alvaro,

Thanks for the reply. I previously did both of those, as well as
shutting postmaster down altogether and restarting. Still no luck.

I'm sure postmaster is seeing the file, since I can break "local"
support by changing that line. <G>

-David

On Nov 30, 2003, at 18:32, Alvaro Herrera wrote:

> On Sun, Nov 30, 2003 at 06:10:08PM -0500, David Nedrow wrote:
>
>> Note that I've also tried the following straight for the original
>> pg_hba.conf file itself. No luck.
>>
>> host    all         all         127.0.0.1         255.255.255.255
>> password
>
> Huh, did you cause the postmaster to reload the pg_hba.conf file after
> changing it?  You should send it SIGHUP (kill -HUP) or use pg_ctl
> reload.
>
> --
> Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
> "Crear es tan difícil como ser libre" (Elsa Triolet)
>


Re: pg_hba.conf problem

From
Tom Lane
Date:
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> On Sun, Nov 30, 2003 at 06:10:08PM -0500, David Nedrow wrote:
>> Note that I've also tried the following straight for the original
>> pg_hba.conf file itself. No luck.

> Huh, did you cause the postmaster to reload the pg_hba.conf file after
> changing it?  You should send it SIGHUP (kill -HUP) or use pg_ctl reload.

He said he was using full postmaster restarts, which certainly ought to
do the trick.

The only other idea I can think of is he's editing the wrong pg_hba.conf
file; we've seen a couple of people make that mistake.  (David, the
right pg_hba.conf file is the one in the $PGDATA directory.  If you
don't see a postmaster.pid file in the same directory that appears and
disappears when you start and stop the postmaster, then you're in the
wrong directory ...)

            regards, tom lane

Re: pg_hba.conf problem

From
David Nedrow
Date:
On Nov 30, 2003, at 21:01, Tom Lane wrote:

> The only other idea I can think of is he's editing the wrong
> pg_hba.conf
> file; we've seen a couple of people make that mistake.  (David, the
> right pg_hba.conf file is the one in the $PGDATA directory.  If you
> don't see a postmaster.pid file in the same directory that appears and
> disappears when you start and stop the postmaster, then you're in the
> wrong directory ...)


Ta-Da!

That was it. For some reason, I had an old pgsql/data tree laying
around that I was futzing with. Looking for postmaster.pid did the
trick.

What I can't figure out is how I was breaking "local" access by editing
the non-local file. Maybe I was just too tired after 18 hours of
debugging Mozilla stuff. <G>

Thanks for the help.

-David