pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Stephen Frost <sfrost@snowman.net>
Cc: Joshua D. Drake <jd@commandprompt.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: [COMMITTERS] pgsql: Add pg_audit, an auditing extension
Date: Thu, 28 May 2015 12:17:48 +0300
Message-ID: <5566DD3C.6020700@iki.fi> (raw)
In-Reply-To: <20150528081416.GT26667@tamriel.snowman.net>
References: <CA+TgmobOExszH562GGZJykT5tdMa3q=o4jpRjyfB3+aLvq5Hsg@mail.gmail.com>
	<20150527203653.GN26667@tamriel.snowman.net>
	<20150528010042.GB4097628@tornado.leadboat.com>
	<20150528011125.GO26667@tamriel.snowman.net>
	<55666FB5.8090209@commandprompt.com>
	<20150528013840.GP26667@tamriel.snowman.net>
	<556673E1.8090109@commandprompt.com>
	<20150528020201.GQ26667@tamriel.snowman.net>
	<556685BF.2010604@commandprompt.com>
	<5566C9F1.6020103@iki.fi>
	<20150528081416.GT26667@tamriel.snowman.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 05/28/2015 11:14 AM, Stephen Frost wrote:
> * Heikki Linnakangas (hlinnaka@iki.fi) wrote:
>> 1. it's not flexible enough. How do you specify that all READs on
>> super_secret table must be logged, but on less_secret table, it's
>> enough to log only WRITEs?
>
> This is actually what that pg_audit.role setting was all about.  To do
> the above, you would do:
>
> CREATE ROLE pgaudit;
> SET pg_audit.role = pgaudit;
> GRANT SELECT ON TABLE super_secret TO pgaudit;
> GRANT INSERT, UPDATE, DELETE ON TABLE less_secret TO pgaudit;
>
> With this, all commands executed which require SELECT rights on the
> table super_secret are logged, and all commands execute which require
> INSERT, UPDATE, or DELETE on the less_secret table are logged.

Ah, I see. Wow, that's really Rube Goldbergian.

>> 2. GUCs can be changed easily on-the-fly, and configured flexibly.
>> But that's not really what you want for auditing. You want to have a
>> clear specification in one place. You'd want it to be more like
>> pg_hba.conf than postgresql.conf. Or more like Mandatory Access
>> Control, rather than Discretionary Access Control.
>
> I certainly appreciate the MAC vs. DAC discussion here, but I don't
> believe our AUDIT capability should explicitly require restarts of PG to
> be adjusted.

Sure, I didn't mean we should require a restart. Requiring SIGHUP seems 
reasonable though.

>> A separate config file in $PGDATA would be a better way to configure
>> this. You would then have all the configuration in one place, and
>> that file could have a more flexible format, with per-schema rules
>> etc. (Wouldn't have to implement all that in the first version, but
>> that's the direction this should go to)
>
> The difficulty with a separate config file is that we don't have any way
> of properly attaching information to the existing tables in the
> database- table renames, dropped columns, etc, all become an issue then.

True. I wouldn't be too worried about that though. If you rename a 
table, that hopefully gets flagged in the audit log and someone will ask 
"why did you rename that table?". If you're paranoid enough, you could 
have a catch-all rule that audits everything that's not explicitly 
listed, so a renamed table always gets audited.

Of course, you could still support a labeling system, similar to the 
pg_audit.role setting and GRANTs. For example, you could tag tables with 
a label like "reads_need_auditing", and then in the config file, you 
could specify that all READs on tables with that label need to be 
audited. I think security labels would be a better system to abuse for 
that than GRANT. You'd want to just label the objects, and specify the 
READ/WRITE etc. attributes in the config file.

Who do you assume you can trust? Is it OK if the table owner can 
disable/enable auditing for that table?

> I'm certainly all about adding new capabilities to pg_audit, but, as
> discussed elsewhere, I believe we really want many of those same
> capabilities in core (eg: being able to send logs to different places;
> my thinking is a rabbitMQ type of store rather than email, but perhaps
> we could support both..) and that's what I'm hoping to work towards in
> the near future.

Sure, adding features like sending logs to different places in core is 
totally reasonable, independently of pg_audit. (Or not, but in any case, 
it's orthogonal :-) )

- Heikki



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (69+ messages)  latest in thread

Message-ID: <5566DD3C.6020700@iki.fi>
Permalink:  ../5566DD3C.6020700@iki.fi/
Also on:    postgresql.org/message-id/5566DD3C.6020700@iki.fi

 · 

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-committers@postgresql.org
  Cc: hlinnaka@iki.fi, sfrost@snowman.net, jd@commandprompt.com, noah@leadboat.com, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Add pg_audit, an auditing extension
  In-Reply-To: <5566DD3C.6020700@iki.fi>
  References: <CA+TgmobOExszH562GGZJykT5tdMa3q=o4jpRjyfB3+aLvq5Hsg@mail.gmail.com> <20150527203653.GN26667@tamriel.snowman.net> <20150528010042.GB4097628@tornado.leadboat.com> <20150528011125.GO26667@tamriel.snowman.net> <55666FB5.8090209@commandprompt.com> <20150528013840.GP26667@tamriel.snowman.net> <556673E1.8090109@commandprompt.com> <20150528020201.GQ26667@tamriel.snowman.net> <556685BF.2010604@commandprompt.com> <5566C9F1.6020103@iki.fi> <20150528081416.GT26667@tamriel.snowman.net> <5566DD3C.6020700@iki.fi>

* 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