Re: Spoofing as the postmaster

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
Cc: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Andrew Sullivan <ajs(at)crankycanuck(dot)ca>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Spoofing as the postmaster
Date: 2007-12-29 18:23:26
Message-ID: 4776909E.4060008@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mark Mielke wrote:
> Andrew Dunstan wrote:
>> D'Arcy J.M. Cain wrote:
>>> - 1: How does the client assure that the postmaster is legit
>>> - 2: How does the postmaster assure that the client is legit
>> And neither answers the original problem:
>> 3. How can the sysadmin prevent a malicious local user from hijacking
>> the sockets if the postmaster isn't running?
>> Prevention is much more valuable than ex post detection, IMNSHO.
>> Probably the first answer is not to run postgres on a machine with
>> untrusted users, but that's not always possible. Maybe we can't find
>> a simple cross-platform answer, but that doesn't mean we should not
>> look at platform-specific answers, at least for documentation.
> I thought this answer was already provided: Put the socket in a
> directory that is only writable by the database owner. The socket is
> created as part of the bind() process. I think this covers 90%+ of it,
> and is already in use by distributions. The only thing "better" this
> team could do would be to formalize it? The "serveruser=" db open
> parameter might be enough to lock it up tight if there is still a race
> condition on bind(). It's effectively a very cheap authentication
> mechanism that does not require expensive cryptographic operations.
>
>

It's in use by some distributions, hardly all, or even a majority. AFAIK
it's only in Debian + descendants.

Anyway, I think it could arguably make matters worse, not better, by
guaranteeing that the postmaster can start up even if the TCP socket has
been hijacked . That's why I suggested it might be useful to have a
switch that says don't start if any interface fails to bind (which was
the old pre-8.0 behaviour).

It might well be useful for us to look at drafting an SELinux policy,
even if it's not universal. After all, this situation is precisely the
sort of thing that SELinux is about, ISTM.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2007-12-29 18:52:12 Re: Spoofing as the postmaster
Previous Message Bruce Momjian 2007-12-29 18:00:20 Re: Spoofing as the postmaster