Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tX6wa-0040ct-Sw for pgsql-general@arkaria.postgresql.org; Sun, 12 Jan 2025 23:00:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tX6va-003mxH-T4 for pgsql-general@arkaria.postgresql.org; Sun, 12 Jan 2025 22:59:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tX6va-003mx8-Hw for pgsql-general@lists.postgresql.org; Sun, 12 Jan 2025 22:59:31 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tX6vY-00047Q-1q for pgsql-general@postgresql.org; Sun, 12 Jan 2025 22:59:30 +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 50CMxKfG372572; Sun, 12 Jan 2025 17:59:20 -0500 From: Tom Lane To: "Peter J. Holzer" cc: pgsql-general@postgresql.org Subject: Re: Automatic upgrade of passwords from md5 to scram-sha256 In-reply-to: <20250112222828.b36hpzm3ulfzlkws@hjp.at> References: <20250112222828.b36hpzm3ulfzlkws@hjp.at> Comments: In-reply-to "Peter J. Holzer" message dated "Sun, 12 Jan 2025 23:28:28 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <372570.1736722760.1@sss.pgh.pa.us> Date: Sun, 12 Jan 2025 17:59:20 -0500 Message-ID: <372571.1736722760@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Peter J. Holzer" writes: > The web framework Django will automatically and transparently rehash any > password with the currently preferred algorithm if it isn't stored that > way already. Really? That implies that the framework has access to the original cleartext password, which is a security fail already. > Can PostgreSQL do that, too? (I haven't found anything) No. The server has only the hashed password, it can't reconstruct the original. > If the password for the user is stored as an MD5 hash, the server > replies to the startup message with an AuthenticationCleartextPassword > respnse to force the client to send the password in the clear > (obviously you only want to do that if the connection is TLS-encrypted > or otherwise safe from eavesdropping). I think this idea is a nonstarter, TLS or not. We're generally moving in the direction of never letting the server see cleartext passwords. It's already possible to configure libpq to refuse such requests (see require_auth parameter), although that hasn't been made the default. regards, tom lane