Re: Hardening PostgreSQL via (optional) ban on local file system access

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Hannu Krosing <hannuk(at)google(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Pang <robertpang(at)google(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Hardening PostgreSQL via (optional) ban on local file system access
Date: 2022-06-28 18:30:04
Message-ID: CA+TgmoZgL21Bm62pkT=C66U_tvzuzc1um-TEWBBck6TSOuMNLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 27, 2022 at 5:37 PM Hannu Krosing <hannuk(at)google(dot)com> wrote:
> My current thinking is (based on more insights from Andres) that we
> should also have a startup flag to disable superuser altogether to
> avoid bypasses via direct manipulation of pg_proc.
>
> Experience shows that 99% of the time one can run PostgreSQL just fine
> without a superuser, so having a superuser available all the time is
> kind of like leaving a loaded gun on the kitchen table because you
> sometimes need to go hunting.
>
> I am especially waiting for Andres' feedback on viability this approach.

Well, I'm not Andres but I don't think not having a superuser at all
is in any way a viable approach. It's necessary to be able to
administer the database system, and the bootstrap superuser can't be
removed outright in any case because it owns a ton of objects.

There are basically two ways of trying to solve this problem. On the
one hand we could try to create a mode in which the privileges of the
superuser are restricted enough that the superuser can't break out to
the operating system. The list of things that would need to be blocked
is, I think, more extensive than any list you've give so far. The
other is to stick with the idea of an unrestricted superuser but come
up with ways of giving a controlled subset of the superuser's
privileges to a non-superuser. I believe this is the more promising
approach, and there have been multiple discussion threads about it in
the last six months.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-06-28 18:33:10 Re: CREATE INDEX CONCURRENTLY on partitioned index
Previous Message Alvaro Herrera 2022-06-28 18:27:23 Re: Separate the attribute physical order from logical order