Re: Password identifiers, protocol aging and SCRAM protocol
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, David Steele <david@pgmasters.net>, Robert Haas <robertmhaas@gmail.com>, David Fetter <david@fetter.org>, Alvaro Herrera <alvherre@2ndquadrant.com>,
Magnus Hagander <magnus@hagander.net>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Julian Markwort <julian.markwort@uni-muenster.de>,
Stephen Frost <sfrost@snowman.net>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>,
Valery Popov <v.popov@postgrespro.ru>
Date: 2016-09-03T12:36:59Z
Lists: pgsql-hackers
Attachments
- 0001-Refactor-SHA-functions-and-move-them-to-src-common.patch (application/x-patch) patch 0001
- 0002-Move-encoding-routines-to-src-common.patch (application/x-patch) patch 0002
- 0003-Switch-password_encryption-to-a-enum.patch (application/x-patch) patch 0003
- 0004-Refactor-decision-making-of-password-encryption-into.patch (application/x-patch) patch 0004
- 0005-Create-generic-routine-to-fetch-password-and-valid-u.patch (application/x-patch) patch 0005
- 0006-Support-for-SCRAM-SHA-256-authentication-RFC-5802-an.patch (application/x-patch) patch 0006
- 0007-Add-clause-PASSWORD-val-USING-protocol-to-CREATE-ALT.patch (application/x-patch) patch 0007
- 0008-Add-regression-tests-for-passwords.patch (application/x-patch) patch 0008
On Fri, Sep 2, 2016 at 10:23 PM, Michael Paquier <michael.paquier@gmail.com> wrote: > On Fri, Sep 2, 2016 at 7:57 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote: >> I decided to split ip.c anyway. I'd like to keep the files in >> src/common/ip.c as small as possible, so I think it makes sense to be quite >> surgical when moving things there. I kept the pg_foreach_ifaddr() function >> in src/backend/libpq/ifaddr.c (I renamed the file to avoid confusion with >> the ip.c that got moved), even though it means that test_ifaddr will have to >> continue to copy the file directly from src/backend/libpq. I'm OK with that, >> because test_ifaddrs is just a little test program that mimics the backend's >> behaviour of enumerating interfaces. I don't consider it to be a "real" >> frontend application. >> >> Pushed, after splitting. Thanks! Now let's move on to the more substantial >> patches. Thanks for the push. > Before I send a new series of patches... There is one thing that I am > still troubled with: the compilation of pgcrypto. First from > contrib/pgcrypto/Makefile I am noticing the following issue with this > block: > CF_SRCS = $(if $(subst no,,$(with_openssl)), $(OSSL_SRCS), $(INT_SRCS)) > CF_TESTS = $(if $(subst no,,$(with_openssl)), $(OSSL_TESTS), $(INT_TESTS)) > CF_PGP_TESTS = $(if $(subst no,,$(with_zlib)), $(ZLIB_TST), $(ZLIB_OFF_TST)) > How is that correct if src/Makefile.global is not loaded first? > Variables like with_openssl are still not loaded at that point. > > Then, as per patch 0001 there are two files holding the SHA routines: > sha.c with the interface taken from OpenBSD, and sha_openssl.c that > uses the interface of OpenSSL. And when compiling pgcrypto, the choice > of file is made depending on the value of $(with_openssl). So I have solved my identity crisis here by just using INT_SRCS and OSSL_SRCS to list the correct files holding the SHA files. Thanks Tom for the hint. I need to study more my Makefile-fu. Attached is a new series: - 0001, refactoring of SHA functions into src/common. - 0002, move encoding routines to src/common/ - 0003, make password_encryption an enum - 0004, refactor some code in CREATE/ALTER role code paths related the use of password_encryption - 0005, refactor some code to have a single routine to fetch password and valid_until from pg_authid - 0006, The core implementation of SCRAM-SHA-256, with the SASL communication protocol. if you want to use SCRAM with that, things go with password_encryption = 'scram'. I have spotted here a bug with the MSVC build on the way. - 0007, addition of PASSWORD val USING protocol - 0008. regression tests for passwords. Those do not trigger the internal sha routines, which lead to inconsistent results. -- Michael
Commits
-
Support SCRAM-SHA-256 authentication (RFC 5802 and 7677).
- 818fd4a67d61 10.0 landed
-
Refactor SHA2 functions and move them to src/common/.
- 273c458a2b3a 10.0 landed
-
Replace isMD5() with a more future-proof way to check if pw is encrypted.
- dbd69118c05d 10.0 landed
-
Remove bogus notice that older clients might not work with MD5 passwords.
- 7e3ae5455948 9.2.20 landed
- 470af1f41c8b 9.3.16 landed
- ada2cdb61015 9.4.11 landed
- 65a7f190b253 9.5.6 landed
- 7546c135dc30 9.6.2 landed
- 31c54096a18f 10.0 landed
-
Refactor the code for verifying user's password.
- e7f051b8f9a6 10.0 landed
-
Replace PostmasterRandom() with a stronger source, second attempt.
- fe0a0b5993df 10.0 landed
-
Remove support for (insecure) crypt authentication.
- 53a5026b5cb3 8.4.0 cited