Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XdPHN-0001DX-G3 for pgsql-bugs@arkaria.postgresql.org; Sun, 12 Oct 2014 19:58:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XdPHM-0007ry-Vp for pgsql-bugs@arkaria.postgresql.org; Sun, 12 Oct 2014 19:58:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XdPHM-0007rs-9O for pgsql-bugs@postgresql.org; Sun, 12 Oct 2014 19:58:08 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XdPHG-0005Wo-0t for pgsql-bugs@postgresql.org; Sun, 12 Oct 2014 19:58:06 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 1C6665F7E0; Sun, 12 Oct 2014 15:58:01 -0400 (EDT) Date: Sun, 12 Oct 2014 15:58:01 -0400 From: Stephen Frost To: Tom Lane Cc: Steven Siebert , Bruce Momjian , Magnus Hagander , pgsql-bugs Subject: Re: BUG #10680: LDAP bind password leaks to log on failed authentication Message-ID: <20141012195800.GY28859@tamriel.snowman.net> References: <20140619153712.GV16098@tamriel.snowman.net> <20140619160901.GW16098@tamriel.snowman.net> <20141011183535.GA21267@momjian.us> <25516.1413142930@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nx4MUOv10iBm+jqU" Content-Disposition: inline In-Reply-To: <25516.1413142930@sss.pgh.pa.us> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.11.0-19-generic (x86_64) X-Uptime: 15:45:58 up 187 days, 6:05, 5 users, load average: 0.00, 0.04, 0.05 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-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --nx4MUOv10iBm+jqU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Tom Lane (tgl@sss.pgh.pa.us) wrote: > Steven Siebert writes: > > Attached is the patch (against master) for the approach we discussed: > > sanitizing the log message by removing the sensitive information out of= the > > hba raw line. >=20 > I still say that this is an ill-considered, unmaintainable, and > fundamentally insecure approach to solving the wrong problem. I agree that this approach is pretty grotty. > As a single example of what's wrong with it, suppose that you > fat-finger some syntax detail of an LDAP line in pg_hba.conf. I've never liked that we tell users to put passwords in pg_hba.conf, be they LDAP passwords or RADIUS secrets, it's just not the right place. > Perhaps what we should be entertaining is a proposal to have > multiple log channels, some containing more security-relevant messages > and others less so. Then you could give people the ability to read only > the non-security-relevant messages. If we arranged for *all* messages > relevant to pg_hba.conf to go into a secure log, it'd be a lot easier to > convince ourselves that we would not leak any security-critical info > than if we take the approach this patch proposes. I definitely like the idea of having multiple log channels with a way to control what kinds of messages go to which- but I've also got a simpler proposal: Let's stop having passwords and secrets in a complex configuration file which can have parsing and other failures. How about allowing users to put that information in an independent file, as do for SSL (admittedly, probably more because it's easier for us to deal with OpenSSL that way, but still)? ldapbindpwfile=3D/etc/whatever radiussecretfile=3D/etc/whatever as examples. The files would contain *only* the password or secret (ignoring any newline) and must be readable by the PG user. We could happily log any issues with pg_hba, etc, as long as we don't log what came from those files. Keeping the passwords out of pg_hba.conf also makes it easier for admins to manage those files across multiple systems (eg: using puppet, chef, etc) while having local PWs for each box too. Might not be perfect for LDAP (unless we also provide a ldapbinduserfile), though the bind user could be handled through puppet or similar and it isn't as secure a concern, and it'd work directly for RADIUS which directly support different secrets for different hosts. Thanks, Stephen --nx4MUOv10iBm+jqU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUOt1IAAoJEO1sijiDR2RVxIEP/2KKSjSHnnZGWnQq0v7DXTQc 5yURNu9dbwwyeiPt/DQZWZbI9FlJbM/idFkfphbtID4z9t6tV/9rL2Vh9QtOO1oX PGXqrAfp19HlUq1U2bi6qp6xyfvPJBaE7+/G45dJVtjeKGAnjrd3/flmu9Iqhf9M lsQ/fduriuWKZJW/S0FPadwj+GUFx4ecxFnnIk7voropY5ACLFOV8Q42WNw5NAeJ oCRAam6WfcmTcCVuEnnrq/naW8DelFJH+swam7V+Tk/0HGG5uJq1feOwLR6Qj6OJ 2XZiN/EZwZLtuSXu96WKF1hJbvJKDIjzWQ+pOhJzcTo1uXtofhxWyzPcLHOt81eP LNxQ8E/yufj+OZ5jQpM9xoGsZqchMzOWNl9RSaAFG42m0Rjpvqkb2dpvwtk626en GVi+OEBrkaHkfdtE4AhrvtjaCNUJLRw4P7uXo1nFtP7rZQLCMMk7TqhD6+Lb4Nz7 2zVh+10Rf2is8LahSXgYHPbgGCfimdidvH0KTeCFpox2E9xaGmCNJF+8FQHZs5bE MELksyg8a9dHHGBS2/D4E6xrXQjDWnSNCUSMb5b0+b/mYAMUAd3Kf/dqypKF96Rz zIHSdpGJBn5ibHm/o3BKg7sU/XP5sgVbZn7EE8vzbOPcffK2Du3uzyewZBhog1Hl Kjr0lQPE9jQC1xGQC326 =HMet -----END PGP SIGNATURE----- --nx4MUOv10iBm+jqU--