You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: src/test/regress/expected/password.out
+15
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,14 @@ SET password_encryption = 'scram-sha-256'; -- ok
14
14
SET password_encryption = 'md5';
15
15
CREATE ROLE regress_passwd1;
16
16
ALTER ROLE regress_passwd1 PASSWORD 'role_pwd1';
17
+
WARNING: setting an MD5-encrypted password
18
+
DETAIL: MD5 password support is deprecated and will be removed in a future release of PostgreSQL.
19
+
HINT: Refer to the PostgreSQL documentation for details about migrating to another password type.
17
20
CREATE ROLE regress_passwd2;
18
21
ALTER ROLE regress_passwd2 PASSWORD 'role_pwd2';
22
+
WARNING: setting an MD5-encrypted password
23
+
DETAIL: MD5 password support is deprecated and will be removed in a future release of PostgreSQL.
24
+
HINT: Refer to the PostgreSQL documentation for details about migrating to another password type.
19
25
SET password_encryption = 'scram-sha-256';
20
26
CREATE ROLE regress_passwd3 PASSWORD 'role_pwd3';
21
27
CREATE ROLE regress_passwd4 PASSWORD NULL;
@@ -57,14 +63,23 @@ ALTER ROLE regress_passwd2_new RENAME TO regress_passwd2;
57
63
SET password_encryption = 'md5';
58
64
-- encrypt with MD5
59
65
ALTER ROLE regress_passwd2 PASSWORD 'foo';
66
+
WARNING: setting an MD5-encrypted password
67
+
DETAIL: MD5 password support is deprecated and will be removed in a future release of PostgreSQL.
68
+
HINT: Refer to the PostgreSQL documentation for details about migrating to another password type.
60
69
-- already encrypted, use as they are
61
70
ALTER ROLE regress_passwd1 PASSWORD 'md5cd3578025fe2c3d7ed1b9a9b26238b70';
71
+
WARNING: setting an MD5-encrypted password
72
+
DETAIL: MD5 password support is deprecated and will be removed in a future release of PostgreSQL.
73
+
HINT: Refer to the PostgreSQL documentation for details about migrating to another password type.
62
74
ALTER ROLE regress_passwd3 PASSWORD 'SCRAM-SHA-256$4096:VLK4RMaQLCvNtQ==$6YtlR4t69SguDiwFvbVgVZtuz6gpJQQqUMZ7IQJK5yI=:ps75jrHeYU4lXCcXI4O8oIdJ3eO8o2jirjruw9phBTo=';
63
75
SET password_encryption = 'scram-sha-256';
64
76
-- create SCRAM secret
65
77
ALTER ROLE regress_passwd4 PASSWORD 'foo';
66
78
-- already encrypted with MD5, use as it is
67
79
CREATE ROLE regress_passwd5 PASSWORD 'md5e73a4b11df52a6068f8b39f90be36023';
80
+
WARNING: setting an MD5-encrypted password
81
+
DETAIL: MD5 password support is deprecated and will be removed in a future release of PostgreSQL.
82
+
HINT: Refer to the PostgreSQL documentation for details about migrating to another password type.
68
83
-- This looks like a valid SCRAM-SHA-256 secret, but it is not
69
84
-- so it should be hashed with SCRAM-SHA-256.
70
85
CREATE ROLE regress_passwd6 PASSWORD 'SCRAM-SHA-256$1234';
Copy file name to clipboardExpand all lines: src/test/regress/expected/password_1.out
+9
Original file line number
Diff line number
Diff line change
@@ -61,12 +61,18 @@ ALTER ROLE regress_passwd2 PASSWORD 'foo';
61
61
ERROR: password encryption failed: unsupported
62
62
-- already encrypted, use as they are
63
63
ALTER ROLE regress_passwd1 PASSWORD 'md5cd3578025fe2c3d7ed1b9a9b26238b70';
64
+
WARNING: setting an MD5-encrypted password
65
+
DETAIL: MD5 password support is deprecated and will be removed in a future release of PostgreSQL.
66
+
HINT: Refer to the PostgreSQL documentation for details about migrating to another password type.
64
67
ALTER ROLE regress_passwd3 PASSWORD 'SCRAM-SHA-256$4096:VLK4RMaQLCvNtQ==$6YtlR4t69SguDiwFvbVgVZtuz6gpJQQqUMZ7IQJK5yI=:ps75jrHeYU4lXCcXI4O8oIdJ3eO8o2jirjruw9phBTo=';
65
68
SET password_encryption = 'scram-sha-256';
66
69
-- create SCRAM secret
67
70
ALTER ROLE regress_passwd4 PASSWORD 'foo';
68
71
-- already encrypted with MD5, use as it is
69
72
CREATE ROLE regress_passwd5 PASSWORD 'md5e73a4b11df52a6068f8b39f90be36023';
73
+
WARNING: setting an MD5-encrypted password
74
+
DETAIL: MD5 password support is deprecated and will be removed in a future release of PostgreSQL.
75
+
HINT: Refer to the PostgreSQL documentation for details about migrating to another password type.
70
76
-- This looks like a valid SCRAM-SHA-256 secret, but it is not
71
77
-- so it should be hashed with SCRAM-SHA-256.
72
78
CREATE ROLE regress_passwd6 PASSWORD 'SCRAM-SHA-256$1234';
NOTICE: empty string is not a valid password, clearing password
102
108
ALTER ROLE regress_passwd_empty PASSWORD 'md585939a5ce845f1a1b620742e3c659e0a';
109
+
WARNING: setting an MD5-encrypted password
110
+
DETAIL: MD5 password support is deprecated and will be removed in a future release of PostgreSQL.
111
+
HINT: Refer to the PostgreSQL documentation for details about migrating to another password type.
103
112
ALTER ROLE regress_passwd_empty PASSWORD 'SCRAM-SHA-256$4096:hpFyHTUsSWcR7O9P$LgZFIt6Oqdo27ZFKbZ2nV+vtnYM995pDh9ca6WSi120=:qVV5NeluNfUPkwm7Vqat25RjSPLkGeoZBQs6wVv+um4=';
104
113
NOTICE: empty string is not a valid password, clearing password
105
114
SELECT rolpassword FROM pg_authid WHERE rolname='regress_passwd_empty';
0 commit comments