pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fabrízio de Royes Mello <fabrizio@timbira.com.br>
Cc: Guillaume Lelarge <guillaume@lelarge.info>
Cc: kpi6288@gmail.com
Cc: PostgreSQL General <pgsql-general@postgresql.org>
Subject: Re: Disable TRUST authentication by using ClientAuthentication_hook
Date: Fri, 13 Jul 2018 09:51:19 -0400
Message-ID: <23124.1531489879@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPfkCSAp1h1kipBdd7TA3TM6FmDesQDe6Q=4Y_tnD4oDJoa5pQ@mail.gmail.com>
References: <006c01d41aa0$b0ae27c0$120a7740$@gmail.com>
	<CAECtzeWexM91HD-g5D7GZJubboZ9Uzohu-SA7pGDDWTR0bOMGw@mail.gmail.com>
	<CAPfkCSAp1h1kipBdd7TA3TM6FmDesQDe6Q=4Y_tnD4oDJoa5pQ@mail.gmail.com>

=?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= <fabrizio@timbira.com.br> writes:
> 2018-07-13 9:01 GMT-03:00 Guillaume Lelarge <guillaume@lelarge.info>:
>> 2018-07-13 13:57 GMT+02:00 <kpi6288@gmail.com>:
>>> I’d like to disable the TRUST authentication method for certain servers
>>> where modification of pg_hba.conf and restarting a service is fairly easy
>>> for a number of users.

>> I'm not sure this is such a good idea. You may need the trust
>> authentication method, for example if you forgot the superuser password.
>> Otherwise, there's good chance you might use the ClientAuthentication hook
>> to do what you want.

> If you're an server admin you can disable the extension (editing
> shared_pre_load_libraries GUC), change password and then enable the
> extension again...

Or more to the point: exactly what is the threat model here?  ISTM
that someone with enough privilege to alter pg_hba.conf can probably
suppress loading of an extension too, so that the security added by
this idea is not just questionable but completely illusory.

What would actually move the goalposts a bit is to build a modified
server which doesn't have the TRUST code path at all, so that there
is no question of installing an extension or not; then somebody who
wants to defeat the security needs to be able to replace the server
executable.  But you don't need any hook if you do that.

BTW, the usual way to get around I-forgot-the-superuser-password
is to start the server in single-user mode and use that to issue
an ALTER USER ... PASSWORD command.  As long as your patch doesn't
break single-user mode, you don't need any other escape hatch.

			regards, tom lane




view thread (5+ messages)

Message-ID: <23124.1531489879@sss.pgh.pa.us>
Permalink:  ../23124.1531489879@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23124.1531489879@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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, fabrizio@timbira.com.br, guillaume@lelarge.info, kpi6288@gmail.com
  Subject: Re: Disable TRUST authentication by using ClientAuthentication_hook
  In-Reply-To: <23124.1531489879@sss.pgh.pa.us>
  References: <006c01d41aa0$b0ae27c0$120a7740$@gmail.com> <CAECtzeWexM91HD-g5D7GZJubboZ9Uzohu-SA7pGDDWTR0bOMGw@mail.gmail.com> <CAPfkCSAp1h1kipBdd7TA3TM6FmDesQDe6Q=4Y_tnD4oDJoa5pQ@mail.gmail.com> <23124.1531489879@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