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 1p6CSC-0001u2-7Q for pgsql-admin@arkaria.postgresql.org; Fri, 16 Dec 2022 15:16:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p6CSB-0001Ab-4J for pgsql-admin@arkaria.postgresql.org; Fri, 16 Dec 2022 15:16:51 +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 1p6CSA-0001AS-Q8 for pgsql-admin@lists.postgresql.org; Fri, 16 Dec 2022 15:16:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6CS8-0005Uf-KR for pgsql-admin@lists.postgresql.org; Fri, 16 Dec 2022 15:16:49 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2BGFGkdA3675888; Fri, 16 Dec 2022 10:16:46 -0500 From: Tom Lane To: Laurenz Albe cc: Daulat , pgsql-admin Subject: Re: Password complexities in Postgres v14.6 In-reply-to: <2192ed923b577ce4a8a90479c7ed1c97f7a6523d.camel@cybertec.at> References: <2192ed923b577ce4a8a90479c7ed1c97f7a6523d.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Fri, 16 Dec 2022 15:55:09 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3675886.1671203806.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 16 Dec 2022 10:16:46 -0500 Message-ID: <3675887.1671203806@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 use= r password. Like, we can create profiles in Oracle. = >> I am looking to set the Password complexities=C2=A0 (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 ~" &_-+=3D'! (){}[):;"'<>,.?/ !@#$%* >> Password Minimum Length 8 character > There is no reliable way to do this in PostgreSQL, since the server typi= cally > 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