Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZOC1M-0000EI-4d for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Aug 2015 21:51:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZOC1L-0006Rb-CF for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Aug 2015 21:51:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZOC1K-0006Qg-1w for pgsql-hackers@postgresql.org; Sat, 08 Aug 2015 21:51:14 +0000 Received: from 01.zmailcloud.com ([192.198.85.104] helo=mx-out-1.zmailcloud.com) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZOC1D-0002t7-3e for pgsql-hackers@postgresql.org; Sat, 08 Aug 2015 21:51:13 +0000 Received: from smtp.01.com (smtp.01.com [10.10.0.43]) by mx-out-1.zmailcloud.com (Postfix) with ESMTP id B3EFC563E87; Sat, 8 Aug 2015 16:51:05 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id AB04160273; Sat, 8 Aug 2015 16:51:05 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4R4y7l84SF0q; Sat, 8 Aug 2015 16:51:05 -0500 (CDT) Received: from smtp.01.com (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 879E56027E; Sat, 8 Aug 2015 16:51:05 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 70F8760277; Sat, 8 Aug 2015 16:51:05 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Xc9uJTwF9WE4; Sat, 8 Aug 2015 16:51:05 -0500 (CDT) Received: from [192.168.47.106] (50-1-62-61.dsl.dynamic.fusionbroadband.com [50.1.62.61]) by smtp-out-2.01.com (Postfix) with ESMTPSA id B8EE860273; Sat, 8 Aug 2015 16:51:04 -0500 (CDT) Message-ID: <55C679C7.4060908@agliodbs.com> Date: Sat, 08 Aug 2015 14:51:03 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Heikki Linnakangas , Robert Haas , Michael Paquier CC: pgsql-hackers Subject: Re: WIP: SCRAM authentication References: <55192AFE.6080106@iki.fi> <55C4FCC2.3000503@iki.fi> <55C63B1E.2040101@iki.fi> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 08/08/2015 10:23 AM, Heikki Linnakangas wrote: > On 08/08/2015 04:27 PM, Robert Haas wrote: >> I don't see that there's any good reason to allow the same password to >> be stored in the catalog encrypted more than one way, > > Sure there is. If you want to be able to authenticate using different > mechanism, you need the same password "encrypted" in different ways. > SCRAM uses verifier that's derived from the password in one way, MD5 > authentication needs an MD5 hash, and yet other protocols have other > requirements. That's correct. However, one of the goals of implementing SCRAM authentication is to allow security-conscious users to get rid of those reusable md5 hashes, no? Obviously the backwards-compatibility issues are pretty major ... it'll be years before all drivers support SCRAM ... but we also want to provide a path forwards for secure installations in which no md5 hashes are stored. This says "backwards-compatible GUC" to me. Here's one idea on how to handle this: 1. we drop the parameter password_encryption 2. we add the parameter password_storage, which takes a list: - plain : plain text - md5 : current md5 hashes - scram : new scram hashed passwords This defaults to 'md5, scram' if not specified. This list might be extended in the future. 3. All password types in the list are generated. This means having multiple columns in pg_shadow, or an array. An array would support the addition of future password storage methods. 4. CREATE ROLE / ALTER ROLE syntax is changed to accept a parameter to ENCRYPTED in order to support md5, scram, and future methods. If no parameter is supplied, ENCRYPTED will default to 'md5, scram'. 5. we add the superuser-only function pg_apply_password_policy(). This applies the policy expressed by password_storage, generating or erasing passwords for each user. 6. We add a new connection error for "authentication __method__ not supported for user" 7. Two versions from now, we change the defaults. I thought about the idea of determining password storage based on what's in pg_hba.conf, but that seems like way too much implied authorization to me, and liable to be a big foot-gun. --Josh Berkus -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers