Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5peM-0000Zs-9V for pgsql-hackers@arkaria.postgresql.org; Wed, 03 May 2017 08:28:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d5peL-0002qf-SH for pgsql-hackers@arkaria.postgresql.org; Wed, 03 May 2017 08:28:41 +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_2) (envelope-from ) id 1d5pco-0007lV-9B for pgsql-hackers@postgresql.org; Wed, 03 May 2017 08:27:06 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d5pcg-0002ZX-Lb for pgsql-hackers@postgresql.org; Wed, 03 May 2017 08:27:05 +0000 Received: by mail-wm0-x241.google.com with SMTP id y10so10867700wmh.0 for ; Wed, 03 May 2017 01:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=8q3zGO3tHqjTiEAXoyD8TZ6A7uejk/B0Eyix/Y7CbP4=; b=U2ICdMTeb/Ba4RwessprhjYjHsyZWgRWQiST8r9wgCsGn4MTQqQS+KD7AP6G+sw+yc TB20GyH1SuqvILHW1yvvBvKNp1Wom5CEa78wUUFvFQ/TlHLUiBN0KuhAiDj+FXO7DPT5 NyMz9STTuDGIsZV8renImNsHkPoeh9fo5QuuDwiJpW1PZWvjviPJDEoW/QDRK6fQoDe1 zC6FDQtBlErE6J1aRIFk2J0OebyGlSftc4ZqPOO+1bEOvo+or81HUbbx26MBcvajHlyo F2Ugqf/I/XHDIybdWT0q6dlcagqkvDE3Nbvki5+bZy7joUXZJjqGp6EOSeCyU4S6GjkH TVdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:cc:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=8q3zGO3tHqjTiEAXoyD8TZ6A7uejk/B0Eyix/Y7CbP4=; b=VkR05fwZUj1jy7kmPxRv/7npFtw+qz0lrOBUF2x7RHZMUxzrh/XTTG6OXNSxObMGLq RYx/neyhlzh1Ii8kiWiQWuAQEbg02eviNrxrBHoxo6GSRMntqybnixu6YPboKdtEFQjR 1wOW1VqjkFQAB0tt6NKkYNakQdqaDsnDEzsngYgwkXrNut7OhX4YqIIHwrYKODfSoDU6 GAWhR4A5/PVMPkyezG9QAbYB7isbTOIvdQXcwEN+asVwzqr0p+2zJX33ydQbS8BPx5IH ClqiSzWFqP757IlcEnGLm/5XGJu0D/xkyvHcY0yTPvWp74LmDYA6jIx/cUIIKzhGGBCq a23g== X-Gm-Message-State: AN3rC/42o8650JzF35YsB74t9/iTuro//UXph4Bz+azvrk1b54oLmZX8 3YsBwHhTmxCJsA== X-Received: by 10.25.76.6 with SMTP id z6mr11426523lfa.172.1493800015921; Wed, 03 May 2017 01:26:55 -0700 (PDT) Received: from [192.168.1.99] (dsl-hkibrasgw1-50df7f-241.dhcp.inet.fi. [80.223.127.241]) by smtp.gmail.com with ESMTPSA id 9sm3065063ljt.30.2017.05.03.01.26.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 May 2017 01:26:55 -0700 (PDT) Subject: Re: scram and \password To: Robert Haas References: <20170410035323.GA2846583@tornado.leadboat.com> <66e776c9-e02c-3683-28df-339f7f64ea66@iki.fi> <57f8c243-2362-e7b8-4c56-e752ba6edf6c@iki.fi> <7611.1493225874@sss.pgh.pa.us> <57078b66-4c6d-bd95-5d66-f4c6fc02e8e1@iki.fi> <1fa284d4-6d33-5593-9d97-777ee4d01611@iki.fi> From: Heikki Linnakangas Cc: Tom Lane , Michael Paquier , Noah Misch , Jeff Janes , Joe Conway , pgsql-hackers Message-ID: <61a24853-d14b-e3a3-32ba-bd86fe80a475@iki.fi> Date: Wed, 3 May 2017 11:26:53 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.4 (--) 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 05/02/2017 07:47 PM, Robert Haas wrote: > On Tue, May 2, 2017 at 3:42 AM, Heikki Linnakangas wrote: >> There's going to be a default, one way or another. The default is going to >> come from password_encryption, or it's going to be a hard-coded value or >> logic based on server-version in PQencryptPasswordConn(). Or it's going to >> be a hard-coded value or logic implemented in every application that uses >> PQencryptPasswordConn(). I think looking at password_encryption makes the >> most sense. The application is not in a good position to make the decision, >> and forcing the end-user to choose every time they change a password is too >> onerous. > > I think there should be no default, and the caller should have to pass > the algorithm explicitly. If they want to determine what default to > pass by running 'SHOW password_encryption', that's their choice. Ok, gotcha. I disagree, I think we should provide a default. Libpq is in a better position to make a good choice than most applications. I've committed the new PQencryptPasswordConn function, with the default behavior of doing "show password_encryption", and the changes to use it in psql and createuser. This closes the open issue with \password. On 04/27/2017 07:03 AM, Michael Paquier wrote: > I think that it is a mistake to move SASLprep out of > scram_build_verifier, because pre-processing the password is not > necessary, it is normally mandatory. The BE/FE versions that you are > adding also duplicate the calls to pg_saslprep(). I played with that a little bit, but decided to keep pg_saslprep() out of scram_build_verifier() after all. It would seem asymmetric to have scram_build_verifier() call pg_saslprep(), but require callers of scram_SaltedPassword() to call it. So for consistency, I think scram_SaltedPassword() should also call pg_saslprep(). That would complicated the scram_SaltedPassword() function, however. It would need to report an OOM error somehow, for starters. Not an insurmountable issue, of course, but it felt cleaner this way, after all, despite the duplication. > Using "encrypt" instead of "hash" in the function name :( Yeah. For better or worse, I've kept the "encrypt" nomenclature everywhere, for consistency. Thanks! - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers