Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jWMHJ-0003T5-NM for pgsql-general@arkaria.postgresql.org; Wed, 06 May 2020 15:48:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jWMHH-0003fB-EO for pgsql-general@arkaria.postgresql.org; Wed, 06 May 2020 15:48:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jWMHH-0003f4-6h for pgsql-general@lists.postgresql.org; Wed, 06 May 2020 15:48:07 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jWMHC-0005dB-JI for pgsql-general@lists.postgresql.org; Wed, 06 May 2020 15:48:06 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id A224F5F7A2; Wed, 6 May 2020 11:48:00 -0400 (EDT) Date: Wed, 6 May 2020 11:48:00 -0400 From: Stephen Frost To: "Peter J. Holzer" Cc: pgsql-general@lists.postgresql.org Subject: Re: Lock Postgres account after X number of failed logins? Message-ID: <20200506154800.GR13712@tamriel.snowman.net> References: <98e0c063111b424486fc4735a31e4fc0@lmco.com> <87h7wuj840.fsf@gmail.com> <20200506132828.GP13712@tamriel.snowman.net> <20200506152610.GA12354@hjp.at> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="zHzhcY9ZMVI0tTjs" Content-Disposition: inline In-Reply-To: <20200506152610.GA12354@hjp.at> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --zHzhcY9ZMVI0tTjs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Peter J. Holzer (hjp-pgsql@hjp.at) wrote: > On 2020-05-06 09:28:28 -0400, Stephen Frost wrote: > > LDAP-based authentication in PG involves passing the user's password to > > the database server in the clear (or tunneled through SSL, but that > > doesn't help if the DB is compromised), so it's really not a good > > solution. >=20 > Still a lot better than PostgreSQL's md5 scheme, which stores > password-equivalent hashes: If the database is compromised the attacker > has all hashes immediately and can use them to login. Intercepting > encrypted traffic even at the endpoint is much harder and can only > uncover passwords actually used. No, it's really not better because when you're talking about LDAP it's usually in reference to AD or similar centralized data store- so now you get a user's credentials not *just* for access to the particular PG database that you've compromised but across the *entire* AD environment. If you just compromise the md5 store (which you shouldn't really be using anyway, but whatever) then, sure, you can use that PW equivilant to get access into the DB that you've already compromised, and if they use the same username for other PG databases then maybe those too, but you don't get access to their VPN credentials, or the ability to RDP to any server they're allowed to log in to, or to the SQL server databases they have access to, or, or, or ... (at least, not without cracking the md5 hash, which requires at least a little bit of additional effort and we do "salt" it with the username so it's not completely trivial... still, please, please, please use SCRAM for local logins, at least..) Thanks, Stephen --zHzhcY9ZMVI0tTjs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJestwwAAoJEO1sijiDR2RVOKAP/2u89KB8d/gbs6vmBiLwInfN sVrTVzR3ZtVWP2w0ZfXgpGziLmNEIcMkff8L36UnMgcLMyNiyiyOXhK9qUN3MvVY OYKGtIy4Ifd3+8reK17IkScNke7F/CUx3kH4rF7Si2/hNNR+v6UYJZIqrUNelSqc P1wwOC3AsK3RQNCpu3G51r9T7LvzK0twgN9U1fQ+yX2sR18+eZ+aKxM5X1fAobiP AhjTaLKz3fr5vtTTkxRXJ9YpZi+cFXz2zY428NU34nDhIEBBoXW20EG51suuNyIQ 7ByBfvZr3bRJ4voUigwKDdf3Xne3Vdh79v2oMQLw9BwIvAYneg/tKAPZJ9f6Vo36 bKACk/A2gmYPCT1G/314O3OpatucziFFJO2AKN0gZieYqMDYVDhIFRkB+M/GIqXD MyILhYkoXaFrpj9hFPrTyUarHrjmswuuy27Kfu8OSrdTRBWgpxy1a0HSLkjhjs03 5lFs1wHWFTZMG2Hlia3Z3BvZP2htlBH3ZQDiwohCPikAoDNhtoTv8jp8tpdsutwW VGqFfrjuCa2pxqZFuQXXPrThc0JwVQF23s/fYaNTVUGQsCykX4czHn69Aq+t8uSa YSG1ezb0PK5z3lIEWqXeQTp07/bb7fPtXsSAc7GEKo4Qjwj2Xj0ompaVdBZRFPGp XxOo9+jcHbtH6uTpcI8L =oW+N -----END PGP SIGNATURE----- --zHzhcY9ZMVI0tTjs--