Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ysxm8-0002EZ-Ss for pgsql-hackers@arkaria.postgresql.org; Thu, 14 May 2015 18:22:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ysxm7-00040K-RN for pgsql-hackers@arkaria.postgresql.org; Thu, 14 May 2015 18:22:27 +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 1Ysxm5-00040B-Cm for pgsql-hackers@postgreSQL.org; Thu, 14 May 2015 18:22:25 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Ysxly-0004WP-4z for pgsql-hackers@postgreSQL.org; Thu, 14 May 2015 18:22:23 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 788875F7AB; Thu, 14 May 2015 14:22:17 -0400 (EDT) Date: Thu, 14 May 2015 14:22:17 -0400 From: Stephen Frost To: Tom Lane Cc: pgsql-hackers@postgreSQL.org Subject: Re: [COMMITTERS] pgsql: Add pg_audit, an auditing extension Message-ID: <20150514182217.GH30322@tamriel.snowman.net> References: <20150514154619.GY30322@tamriel.snowman.net> <21368.1431618712@sss.pgh.pa.us> <20150514161032.GA30322@tamriel.snowman.net> <4844.1431621244@sss.pgh.pa.us> <20150514163551.GB30322@tamriel.snowman.net> <5043.1431621669@sss.pgh.pa.us> <20150514164330.GD30322@tamriel.snowman.net> <5654.1431623278@sss.pgh.pa.us> <20150514171101.GG30322@tamriel.snowman.net> <6454.1431625129@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OJnrA3Qm4jKFlSN2" Content-Disposition: inline In-Reply-To: <6454.1431625129@sss.pgh.pa.us> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-46-generic (x86_64) X-Uptime: 13:39:20 up 55 days, 23:27, 10 users, load average: 0.32, 0.19, 0.15 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) 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 --OJnrA3Qm4jKFlSN2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Tom Lane (tgl@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > Ah, ok. >=20 > Pushed that, but some further notes: Thanks! Looking much better. > * The actual audit reports ought to be ereport() not elog(). I made them > so but did not insert an errcode(). ISTM that it would likely be a good > thing to assign a not-used-for-any-other-purpose errcode for this, but I'm > not terribly sure what category to put it in. Right, I had seen that too and had intended to change it, but somehow missed it in the other changes I was doing. I'll take a look at the categories and try to figure out what makes sense. > * The comments in the code betray utter ignorance of how logging actually > works, in particular this: >=20 > * Administrators can choose which log level the audit log is to be logged > * at. The default level is LOG, which goes into the server log but does > * not go to the client. Set to NOTICE in the regression tests. I had rewored that last night and will reword it again to be more clear. > All the user has to do is change client_min_messages and he'll see all the > reports, which means if you think that letting the user see the audit > reports is a security problem then you have a hole a mile wide. There are certainly use-cases for this where that's not an issue and also ones where the user wouldn't be able to use pg_audit due to this. I'll update the docs to make the risk of this clear. At least for the use-cases we've been involved in, they've not been concerned about this. Still, any thoughts you have on this would certainly be welcome. I've been thinking about how we might re-route and tag messages in the backend for a number of years and I feel like this summer I'll have resources and time to spend working towards it. Providing a way to decide if a message should be sent only to the server log, or only to the client, or to an external system (syslog, pgQ, rabbitMQ, etc), or to some combination of those, is definitely one of the items on that list. > (I assume BTW that we're not considering it a security problem that > superusers can trivially escape auditing.) No, that's entirely understood and expected, which is one of the reasons it'd be good to reduce the number of superusers running around. Thanks! Stephen --OJnrA3Qm4jKFlSN2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJVVOfZAAoJEO1sijiDR2RVVFwP/RTDAHU5d7TOm8Z2tSMg0j+M c9+993hXiBGQlcf6kLR5h53s7SOIf5c4om39Ag+ox+/gCzmj2K9EwjuMlUnv3BAN hxyZfXR+o8HhGqu83hCQ3BM4jTaXdxSdZhIVbHuI0r5oovjRFjG4mioay1QMZ8rI jaMs6z2YyoNGVrbcUVKFXlEatlo2qg59f6Q4oNd0uTJ8w/QB7TU1GpWtVGvABNKs 6TLHtWh1q1u3Cy+/vrESD1nGXSPXA4XCgcQ9a8LXEmvCLIWhqdJ8CAQxJ7wjDBHx Wekzs82urZ0pCfs54Tye5Fv1Zd5VXoxB7wwN0KgxkO+oEjLZMndSusFaE/9a/i8i Xh1wjVdNuHTjgZoUqVXc181sBdYYaE8LPaxXUUuGKhgysCMVtvU3l98rvUh6Xtn+ 3sgF6hg76QlkxDyttorraghWAsHqnvvoOt7MyCze60zDOo7EC4q9fFThtWbkanVa 7T+9eQEz9gCLKPIjMquB4i4WIizvNS1h3XHzkWuD4Xgo98iI6rjDkcFEv4dWJk6N ba9yAEQsw1mPKGq2XZBxr6+qv+GwDhCqjbeFaFJ857S5VyROvRx1ZUwzEGw1wcDX fTa130BePKejf3TkAcvlj4ynjXJkrJW2NOznXN2y+C/VVHe6sipz/Ng7N52IAR/P gxgZLpqbP/k8vElFqutx =VD0B -----END PGP SIGNATURE----- --OJnrA3Qm4jKFlSN2--