mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
MD5 has been considered to be unsuitable for use as a cryptographic hash algorithm for some time. Furthermore, MD5 password hashes in PostgreSQL are vulnerable to pass-the-hash attacks, i.e., knowing the username and hashed password is sufficient to authenticate. The SCRAM-SHA-256 method added in v10 is not subject to these problems and is considered to be superior to MD5. This commit marks MD5 password support in PostgreSQL as deprecated and to be removed in a future release. The documentation now contains several deprecation notices, and CREATE ROLE and ALTER ROLE now emit deprecation warnings when setting MD5 passwords. The warnings can be disabled by setting the md5_password_warnings parameter to "off". Reviewed-by: Greg Sabino Mullane, Jim Nasby Discussion: https://postgr.es/m/ZwbfpJJol7lDWajL%40nathan
25 lines
761 B
SQL
25 lines
761 B
SQL
SET md5_password_warnings = off;
|
|
LOAD 'passwordcheck';
|
|
|
|
CREATE USER regress_passwordcheck_user1;
|
|
|
|
-- ok
|
|
ALTER USER regress_passwordcheck_user1 PASSWORD 'a_nice_long_password';
|
|
|
|
-- error: too short
|
|
ALTER USER regress_passwordcheck_user1 PASSWORD 'tooshrt';
|
|
|
|
-- error: contains user name
|
|
ALTER USER regress_passwordcheck_user1 PASSWORD 'xyzregress_passwordcheck_user1';
|
|
|
|
-- error: contains only letters
|
|
ALTER USER regress_passwordcheck_user1 PASSWORD 'alessnicelongpassword';
|
|
|
|
-- encrypted ok (password is "secret")
|
|
ALTER USER regress_passwordcheck_user1 PASSWORD 'md592350e12ac34e52dd598f90893bb3ae7';
|
|
|
|
-- error: password is user name
|
|
ALTER USER regress_passwordcheck_user1 PASSWORD 'md507a112732ed9f2087fa90b192d44e358';
|
|
|
|
DROP USER regress_passwordcheck_user1;
|