Re: RFC: Non-user-resettable SET SESSION AUTHORISATION

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Marko Tiikkaja <marko(at)joh(dot)to>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, José Luis Tallón <jltallon(at)adv-solutions(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: RFC: Non-user-resettable SET SESSION AUTHORISATION
Date: 2015-05-22 18:11:42
Message-ID: 555F715E.1010407@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/20/15 9:38 PM, Robert Haas wrote:
> On Wed, May 20, 2015 at 8:22 PM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> wrote:
>>> It might be a good idea to do something like this, but it's
>>> significantly more complicated than a protocol-level SET SESSION
>>> AUTHORIZATION. Right now, you can never go backwards from an
>>> authenticated state to an unauthenticated state, and there may be code
>>> in the backend that relies on that in subtle ways. The initial
>>> bootstrap sequence is pretty complicated, and I'm pretty sure that any
>>> naive attempt to redo that stuff is going to have unpleasant, probably
>>> security-relevant bugs.
>>
>> What about the middle-ground of not doing de-auth right now? That eliminates
>> your concerns but still allows getting rid of ugly things like copies of the
>> password file (FWIW, my understanding is pgBouncer was meant more to run on
>> the database server where you'd just point it at the native password file).
>
> Uh, I don't have a clue what you mean when you say "the middle ground
> of not doing de-auth right now".

Don't allow a backend to move back into a de-authenticated state.

Basically, allow a special connection mode that does nothing but provide
user authentication back to the pooler. This would allow the pooler to
defer all auth decisions to Postgres. Once the user was authenticated,
the pooler could then figure out what pool connection to give to the user.

I was thinking that if this authentication connection was never allowed
to run SQL then it should eliminate fears of being in a de-authenticated
state, but I see now that we've already started transaction machinery by
the time PerformAuthentication happens, presumably for good reason. So
maybe it's just as bad as trying to de-authenticate a full backend...
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2015-05-22 18:22:37 Re: Add a hint when postgresql.conf hot_standby = 'off' and recovery.conf standby = 'on'
Previous Message Alvaro Herrera 2015-05-22 18:08:07 Re: [COMMITTERS] pgsql: Row-Level Security Policies (RLS)