pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: dannyman@toldme.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12788: host / peer auth works after pg_ctl reload, then blocks server startup
Date: Thu, 19 Feb 2015 20:01:26 -0500
Message-ID: <19897.1424394086@sss.pgh.pa.us> (raw)
In-Reply-To: <20150219174414.8727.12447@wrigleys.postgresql.org>
References: <20150219174414.8727.12447@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

dannyman@toldme.com writes:
> I naively added a line like this to pg_hba.conf:

> host   all             postgres        x.x.x.x/32           peer

> I ran pg_ctl reload.

"pg_ctl reload" unfortunately has no way to detect whether the reload
succeeded.  Had you checked in the postmaster log you'd likely have
found some bleating to the effect that the reload didn't take.

> I was then able to connect from x.x.x.x to do backups.

If so, it must have been due to some previously existing entry.

> I then restarted the server, and it failed, with this error:
> LOG:  peer authentication is only supported on local sockets

Yup ...

> I can see why pg_ctl reload might gloss over a config issue instead of
> bringing down the server, but that the invalid auth configuration then works
> strokes me as a bug.

It didn't "work".  Making the postmaster keep running despite the
attempt to load a bad file has been generally agreed to be the
best thing, but it does mean that if you don't pay attention to
the effects of a reload, you can shoot yourself in the foot like
this :-(.

AFAICS the only thing we could do to make this significantly safer
would be to restrict use of "pg_ctl reload" to scenarios wherein
pg_ctl could determine whether the postmaster had reloaded its
config without any complaints.  Unfortunately, that would be a
pretty draconian restriction, so there's no free lunch here.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)

Message-ID: <19897.1424394086@sss.pgh.pa.us>
Permalink:  ../19897.1424394086@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19897.1424394086@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dannyman@toldme.com
  Subject: Re: BUG #12788: host / peer auth works after pg_ctl reload, then blocks server startup
  In-Reply-To: <19897.1424394086@sss.pgh.pa.us>
  References: <20150219174414.8727.12447@wrigleys.postgresql.org> <19897.1424394086@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox