Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yxtwx-0002RY-9p for pgsql-hackers@arkaria.postgresql.org; Thu, 28 May 2015 09:18:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yxtww-0004c3-63 for pgsql-hackers@arkaria.postgresql.org; Thu, 28 May 2015 09:18:02 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yxtwt-0004ZB-VM for pgsql-hackers@postgresql.org; Thu, 28 May 2015 09:18:00 +0000 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Yxtwq-0006lz-Lm for pgsql-hackers@postgresql.org; Thu, 28 May 2015 09:17:58 +0000 Received: by padbw4 with SMTP id bw4so19211228pad.0 for ; Thu, 28 May 2015 02:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:reply-to:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=9uClkeUgd/jzm96kKHB7iWqyv1nGDnh4ZZoxLDHLMUQ=; b=zOPapEFX+tS2NMfO/a3J4owYrVgnkJ60WN5AC/K11/0XlBqEANnXGb61F/5/yNowVs bFpwGZygkFIRQGLAGYqYj87JE8i/i2rLcZ0fTlE9OyIuSB0IoD3xTGtZduKl6ewzPtNV Czi9PgCH6kW24OcNUImecN5LKU9UQLXdDfJe+EiPvKVfEBdEsth/zIdbnYOp7GrsT/BW ejzvFGc1dvNRxq8cNNRb6VIqL3lZr05a9PsvCK/2tPripD52u+Hpobm3dxg2AS2FHXcr fJL2kAQvW53qlLZOepUP2DpRm0BKSpAGlYKpZZ8TLD7vzP09VwaZ2Q7eyXn51DGP3jyK 7GKQ== X-Received: by 10.70.123.41 with SMTP id lx9mr3750465pdb.65.1432804675087; Thu, 28 May 2015 02:17:55 -0700 (PDT) Received: from [10.64.250.50] ([216.253.193.158]) by mx.google.com with ESMTPSA id gj5sm1693513pbb.22.2015.05.28.02.17.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 02:17:54 -0700 (PDT) Message-ID: <5566DD3C.6020700@iki.fi> Date: Thu, 28 May 2015 12:17:48 +0300 From: Heikki Linnakangas Reply-To: hlinnaka@iki.fi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Stephen Frost CC: "Joshua D. Drake" , Noah Misch , Robert Haas , Tom Lane , "pgsql-hackers@postgresql.org" Subject: Re: [COMMITTERS] pgsql: Add pg_audit, an auditing extension References: <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> In-Reply-To: <20150528081416.GT26667@tamriel.snowman.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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