Re: security labels on databases are bad for dump & restore

From: Noah Misch <noah(at)leadboat(dot)com>
To: Adam Brightwell <adam(dot)brightwell(at)crunchydatasolutions(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
Subject: Re: security labels on databases are bad for dump & restore
Date: 2015-08-01 06:56:26
Message-ID: 20150801065626.GA1630844@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 30, 2015 at 10:37:33PM -0400, Adam Brightwell wrote:
> On Thu, Jul 30, 2015 at 02:26:34PM -0400, Robert Haas wrote:
> >> 1. "pg_dumpall -g"
> >> 2. "pg_dump --create" per database
> >
> > Gah, OK, I see your point. But we better document this, because if
> > you need a PhD in PostgreSQL-ology to take a backup, we're not in a
> > good place.

Definitely.

> Agreed. Though, honestly, I find this to be a cumbersome approach. I
> think it just makes things more confusing, even if it is well
> documented. Perhaps it might be necessary as a bridge to get to a
> better place. But my first question as an end user would be, 'why
> can't one tool do this?'.

"pg_dumpall" (without -g) is that one tool. It has excellent dump fidelity.
It lacks the slicing and dump format options of pg_dump, which are important
to many sites.

> Also, by using 'pg_dumpall -g' aren't you
> potentially getting things that you don't want/need/care about? For
> instance, if database 'foo' is owned by 'user1' and database 'bar' is
> owned by 'user2' and neither have any knowledge/relation of/to the
> other, then when I dump 'foo', in this manner, wouldn't I also be
> including 'user2'? Said differently, a restore of a 'foo'-only dump
> would also include a 'bar' related role. That seems like a bad idea,
> IMHO. Maybe it can't be avoided, but I'd expect that only relevant
> information for the database being dumped would be included.

Nothing in core PostgreSQL attempts to answer the high-level question "Is
user1 relevant to database bar?" PostgreSQL has no one concept of a role's
relevance to databases. Some reasonable heuristics come to mind, but nothing
I'd be eager to memorialize in a core tool like pg_dumpall.

Thanks,
nm

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2015-08-01 07:42:03 Re: 64-bit XIDs again
Previous Message Amit Kapila 2015-08-01 05:27:30 Re: [DESIGN] ParallelAppend