diff --git a/contrib/passwordcheck/passwordcheck.c b/contrib/passwordcheck/passwordcheck.c index c988bf5169b..59f73a1e6ba 100644 --- a/contrib/passwordcheck/passwordcheck.c +++ b/contrib/passwordcheck/passwordcheck.c @@ -39,8 +39,8 @@ extern void _PG_init(void); * * username: name of role being created or changed * password: new password (possibly already encrypted) - * password_type: PASSWORD_TYPE_PLAINTEXT or PASSWORD_TYPE_MD5 (there - * could be other encryption schemes in future) + * password_type: PASSWORD_TYPE_* code, to indicate if the password is + * in plaintext or encrypted form. * validuntil_time: password expiration time, as a timestamptz Datum * validuntil_null: true if password expiration time is NULL * diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 0b9e3002fb6..20bc3c61b12 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1188,14 +1188,16 @@ include_dir 'conf.d' When a password is specified in or - without writing either ENCRYPTED - or UNENCRYPTED, this parameter determines whether the - password is to be encrypted. The default value is md5, which - stores the password as an MD5 hash. Setting this to plain stores - it in plaintext. on and off are also accepted, as - aliases for md5 and plain, respectively. Setting - this parameter to scram-sha-256 will encrypt the password - with SCRAM-SHA-256. + , this parameter determines the algorithm + to use to encrypt the password. The default value is md5, + which stores the password as an MD5 hash (on is also + accepted, as alias for md5). Setting this parameter to + scram-sha-256 will encrypt the password with SCRAM-SHA-256. + + + Note that older clients might lack support for the SCRAM authentication + mechanism, and hence not work with passwords encrypted with + SCRAM-SHA-256. diff --git a/doc/src/sgml/ref/alter_role.sgml b/doc/src/sgml/ref/alter_role.sgml index 37fcfb926c1..8cd8602bc4f 100644 --- a/doc/src/sgml/ref/alter_role.sgml +++ b/doc/src/sgml/ref/alter_role.sgml @@ -33,7 +33,7 @@ ALTER ROLE role_specification [ WIT | REPLICATION | NOREPLICATION | BYPASSRLS | NOBYPASSRLS | CONNECTION LIMIT connlimit - | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password' + | [ ENCRYPTED ] PASSWORD 'password' | VALID UNTIL 'timestamp' ALTER ROLE name RENAME TO new_name @@ -168,9 +168,7 @@ ALTER ROLE { role_specification | A BYPASSRLS NOBYPASSRLS CONNECTION LIMIT connlimit - PASSWORD password - ENCRYPTED - UNENCRYPTED + [ ENCRYPTED ] PASSWORD password VALID UNTIL 'timestamp' diff --git a/doc/src/sgml/ref/alter_user.sgml b/doc/src/sgml/ref/alter_user.sgml index 5962a8e166c..9b8a39b3768 100644 --- a/doc/src/sgml/ref/alter_user.sgml +++ b/doc/src/sgml/ref/alter_user.sgml @@ -33,7 +33,7 @@ ALTER USER role_specification [ WIT | REPLICATION | NOREPLICATION | BYPASSRLS | NOBYPASSRLS | CONNECTION LIMIT connlimit - | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password' + | [ ENCRYPTED ] PASSWORD 'password' | VALID UNTIL 'timestamp' ALTER USER name RENAME TO new_name diff --git a/doc/src/sgml/ref/create_group.sgml b/doc/src/sgml/ref/create_group.sgml index 1d5cc9b5969..158617cb939 100644 --- a/doc/src/sgml/ref/create_group.sgml +++ b/doc/src/sgml/ref/create_group.sgml @@ -30,7 +30,7 @@ CREATE GROUP name [ [ WITH ] password' + | [ ENCRYPTED ] PASSWORD 'password' | VALID UNTIL 'timestamp' | IN ROLE role_name [, ...] | IN GROUP role_name [, ...] diff --git a/doc/src/sgml/ref/create_role.sgml b/doc/src/sgml/ref/create_role.sgml index 99d1c8336c4..43f2303b481 100644 --- a/doc/src/sgml/ref/create_role.sgml +++ b/doc/src/sgml/ref/create_role.sgml @@ -33,7 +33,7 @@ CREATE ROLE name [ [ WITH ] connlimit - | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password' + | [ ENCRYPTED ] PASSWORD 'password' | VALID UNTIL 'timestamp' | IN ROLE role_name [, ...] | IN GROUP role_name [, ...] @@ -207,7 +207,7 @@ CREATE ROLE name [ [ WITH ] - PASSWORD password + [ ENCRYPTED ] PASSWORD password Sets the role's password. (A password is only of use for @@ -219,30 +219,18 @@ CREATE ROLE name [ [ WITH ] PASSWORD NULL. - - - - - ENCRYPTED - UNENCRYPTED - - These key words control whether the password is stored - encrypted in the system catalogs. (If neither is specified, - the default behavior is determined by the configuration - parameter .) If the - presented password string is already in MD5-encrypted or - SCRAM-encrypted format, then it is stored encrypted as-is, - regardless of whether ENCRYPTED or UNENCRYPTED - is specified (since the system cannot decrypt the specified encrypted - password string). This allows reloading of encrypted passwords + The password is always stored encrypted in the system catalogs. The + ENCRYPTED keyword has no effect, but is accepted for + backwards compatibility. The method of encryption is determined + by the configuration parameter . + If the presented password string is already in MD5-encrypted or + SCRAM-encrypted format, then it is stored as-is regardless of + password_encryption (since the system cannot decrypt + the specified encrypted password string, to encrypt it in a + different format). This allows reloading of encrypted passwords during dump/restore. - - - Note that older clients might lack support for the SCRAM - authentication mechanism. - diff --git a/doc/src/sgml/ref/create_user.sgml b/doc/src/sgml/ref/create_user.sgml index 574604f796d..8a596eec9f2 100644 --- a/doc/src/sgml/ref/create_user.sgml +++ b/doc/src/sgml/ref/create_user.sgml @@ -33,7 +33,7 @@ CREATE USER name [ [ WITH ] connlimit - | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password' + | [ ENCRYPTED ] PASSWORD 'password' | VALID UNTIL 'timestamp' | IN ROLE role_name [, ...] | IN GROUP role_name [, ...] diff --git a/doc/src/sgml/ref/createuser.sgml b/doc/src/sgml/ref/createuser.sgml index 4332008c68b..fda77976ff2 100644 --- a/doc/src/sgml/ref/createuser.sgml +++ b/doc/src/sgml/ref/createuser.sgml @@ -124,8 +124,8 @@ PostgreSQL documentation - Encrypts the user's password stored in the database. If not - specified, the default password behavior is used. + This option is obsolete but still accepted for backward + compatibility. @@ -204,17 +204,6 @@ PostgreSQL documentation - - - - - - Does not encrypt the user's password stored in the database. If - not specified, the default password behavior is used. - - - - @@ -481,11 +470,7 @@ PostgreSQL documentation In the above example, the new password isn't actually echoed when typed, but we show what was typed for clarity. As you see, the password is - encrypted before it is sent to the client. If the option - is used, the password will appear in the echoed command - (and possibly also in the server log and elsewhere), - so you don't want to use