diff options
author | Heikki Linnakangas | 2017-03-07 12:25:40 +0000 |
---|---|---|
committer | Heikki Linnakangas | 2017-03-07 12:25:40 +0000 |
commit | 818fd4a67d610991757b610755e3065fb99d80a5 (patch) | |
tree | 6902ced6e8316044e9b706f93586c84bc24e2010 /contrib | |
parent | 273c458a2b3a0fb73968020ea5e9e35eb6928967 (diff) |
Support SCRAM-SHA-256 authentication (RFC 5802 and 7677).
This introduces a new generic SASL authentication method, similar to the
GSS and SSPI methods. The server first tells the client which SASL
authentication mechanism to use, and then the mechanism-specific SASL
messages are exchanged in AuthenticationSASLcontinue and PasswordMessage
messages. Only SCRAM-SHA-256 is supported at the moment, but this allows
adding more SASL mechanisms in the future, without changing the overall
protocol.
Support for channel binding, aka SCRAM-SHA-256-PLUS is left for later.
The SASLPrep algorithm, for pre-processing the password, is not yet
implemented. That could cause trouble, if you use a password with
non-ASCII characters, and a client library that does implement SASLprep.
That will hopefully be added later.
Authorization identities, as specified in the SCRAM-SHA-256 specification,
are ignored. SET SESSION AUTHORIZATION provides more or less the same
functionality, anyway.
If a user doesn't exist, perform a "mock" authentication, by constructing
an authentic-looking challenge on the fly. The challenge is derived from
a new system-wide random value, "mock authentication nonce", which is
created at initdb, and stored in the control file. We go through these
motions, in order to not give away the information on whether the user
exists, to unauthenticated users.
Bumps PG_CONTROL_VERSION, because of the new field in control file.
Patch by Michael Paquier and Heikki Linnakangas, reviewed at different
stages by Robert Haas, Stephen Frost, David Steele, Aleksander Alekseev,
and many others.
Discussion: https://www.postgresql.org/message-id/CAB7nPqRbR3GmFYdedCAhzukfKrgBLTLtMvENOmPrVWREsZkF8g%40mail.gmail.com
Discussion: https://www.postgresql.org/message-id/CAB7nPqSMXU35g%3DW9X74HVeQp0uvgJxvYOuA4A-A3M%2B0wfEBv-w%40mail.gmail.com
Discussion: https://www.postgresql.org/message-id/55192AFE.6080106@iki.fi
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/pgcrypto/.gitignore | 4 | ||||
-rw-r--r-- | contrib/pgcrypto/Makefile | 11 |
2 files changed, 2 insertions, 13 deletions
diff --git a/contrib/pgcrypto/.gitignore b/contrib/pgcrypto/.gitignore index 30619bfbbf..5dcb3ff972 100644 --- a/contrib/pgcrypto/.gitignore +++ b/contrib/pgcrypto/.gitignore @@ -1,7 +1,3 @@ -# Source file copied from src/common -/sha2.c -/sha2_openssl.c - # Generated subdirectories /log/ /results/ diff --git a/contrib/pgcrypto/Makefile b/contrib/pgcrypto/Makefile index 14e74f899c..573bc6df79 100644 --- a/contrib/pgcrypto/Makefile +++ b/contrib/pgcrypto/Makefile @@ -1,10 +1,10 @@ # contrib/pgcrypto/Makefile -INT_SRCS = md5.c sha1.c sha2.c internal.c internal-sha2.c blf.c rijndael.c \ +INT_SRCS = md5.c sha1.c internal.c internal-sha2.c blf.c rijndael.c \ pgp-mpi-internal.c imath.c INT_TESTS = sha2 -OSSL_SRCS = openssl.c pgp-mpi-openssl.c sha2_openssl.c +OSSL_SRCS = openssl.c pgp-mpi-openssl.c OSSL_TESTS = sha2 des 3des cast5 ZLIB_TST = pgp-compression @@ -59,13 +59,6 @@ SHLIB_LINK += $(filter -leay32, $(LIBS)) SHLIB_LINK += -lws2_32 endif -# Compiling pgcrypto with those two raw files is necessary as long -# as none of their routines are used by the backend code. Note doing -# so can either result in library loading failures or linking resolution -# failures at compilation depending on the environment used. -sha2.c sha2_openssl.c: % : $(top_srcdir)/src/common/% - rm -f $@ && $(LN_S) $< . - rijndael.o: rijndael.tbl rijndael.tbl: |