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 1p6Idl-0005JK-1a for pgsql-admin@arkaria.postgresql.org; Fri, 16 Dec 2022 21:53:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p6Idh-0006Ii-Sm for pgsql-admin@arkaria.postgresql.org; Fri, 16 Dec 2022 21:53:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6Idg-0006IZ-VD for pgsql-admin@lists.postgresql.org; Fri, 16 Dec 2022 21:53:09 +0000 Received: from ook.raf.org ([139.99.156.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6Idd-0000Vq-PR for pgsql-admin@lists.postgresql.org; Fri, 16 Dec 2022 21:53:07 +0000 Received: from localhost (localhost [127.0.0.1]) by ook.raf.org (Postfix) with ESMTP id 1723F5E037 for ; Sat, 17 Dec 2022 08:52:54 +1100 (AEDT) X-Virus-Scanned: Debian amavisd-new at ook.raf.org Received: from ook.raf.org ([127.0.0.1]) by localhost (ook.raf.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I5LrYG3lw4EW for ; Sat, 17 Dec 2022 08:52:53 +1100 (AEDT) Received: by ook.raf.org (Postfix, from userid 1001) id 047DD5E3BC; Sat, 17 Dec 2022 08:52:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raf.org; s=001; t=1671227573; bh=u0y5V6UD7U1Eamf35FkNBlzmcxXM9E4Vt209tmzAsZo=; h=Date:From:To:Subject:References:In-Reply-To:From; b=GHf6sJBScGwawEWF3QoWakRPEQi1dHUKvYR4t9bgJuxbmspL9khkUC1WzNb8Jh/6P ogzv7KuKkvxD/jNmQ5nGebn4jMTjpoh73KTq2RHVUItOZlw9ASCvbIG43oxYsX5oQm OaiUKbpNnO6CixjYc4cRaPGePdDypY3f9x5ekFT4GfA0etCtO9GwOXf1YZlKI8hmDy 1+M/FW3e8C/QfBkBkmc1EvEVD9SwyDcfchl+Vh9jviqbiMONmlIAa3OSVJOnPn7y3C 8UbDxtgIUkcEr7qDWf5yEbZNbcxdF+v4MIx2syohghQVa1bVv/K/RBQBk7CySA2nVs 0rMKIArfwx2HA== Date: Sat, 17 Dec 2022 08:52:52 +1100 From: raf To: pgsql-admin@lists.postgresql.org Subject: Re: Password complexities in Postgres v14.6 Message-ID: References: <2192ed923b577ce4a8a90479c7ed1c97f7a6523d.camel@cybertec.at> <3675887.1671203806@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3675887.1671203806@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Dec 16, 2022 at 10:16:46AM -0500, Tom Lane wrote: > Laurenz Albe writes: > > On Fri, 2022-12-16 at 17:57 +0530, Daulat wrote: > >> Any idea, how we can set some Password complexities in postgres for user password. Like, we can create profiles in Oracle. > >> I am looking to set the Password complexities  (one parameter from each line item has to be complied to): > >> Default password age for users: 90 days. > >> Password first letter will be alphabetic in uppercase. > >> English uppercase characters (A through Z) > >> English lowercase characters (a through z) > >> Base 10 digits (0 through 9) > >> Non-alphabetic characters ~" &_-+='! (){}[):;"'<>,.?/ !@#$%* > >> Password Minimum Length 8 character > > > There is no reliable way to do this in PostgreSQL, since the server typically > > never sees the clear text password. > > You should consider using one of the other authentication methods like "ldap" > > and enforce the policy on the LDAP server. > > Note that this approach typically leads to a net worsening of security. > Farming out the problem to LDAP means that the password has to be sent > in cleartext not only to the PG server, but then on to the LDAP server > (and in an awful lot of setups, that second hop isn't even done in an > encrypted connection). > > You can fairly easily enforce password age limits in PG using the > ALTER USER ... VALID UNTIL option. But for all this other stuff, > there is no way to enforce it at the server without sending passwords > in cleartext, which reduces security rather than increasing it. > > In short: your security guidelines are obsolete and need an update. > > regards, tom lane Just in case anyone still thinks that the decades old advice on password complexity has any validity, here's an article that explains why it's awful (short answer: given a set of rules, we all do very similar things, resulting in a password search space that is a lot smaller than you would think, so it makes password hashes easier to crack). https://www.rapid7.com/blog/post/2018/06/12/password-tips-from-a-pen-tester-common-patterns-exposed/ This isn't the first article on this topic, but it's the one that came up first when googling for "password common patterns". There's a more detailed earlier one somewhere (Mozilla? OWASP?) that lists the 100 most common password patterns, the most common one being used by about 12% of people when forced to follow typical password complexity rules. The old rules really do make security worse. cheers, raf