Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
19.5. Password Authentication
Prev UpChapter 19. Client AuthenticationHome Next

19.5. Password Authentication#

There are several password-based authentication methods. These methods operate similarly but differ in how the users' passwords are stored on the server and how the password provided by a client is sent across the connection.

scram-sha-256

The methodscram-sha-256 performs SCRAM-SHA-256 authentication, as described inRFC 7677. It is a challenge-response scheme that prevents password sniffing on untrusted connections and supports storing passwords on the server in a cryptographically hashed form that is thought to be secure.

This is the most secure of the currently provided methods, but it is not supported by older client libraries.

md5

The methodmd5 uses a custom less secure challenge-response mechanism. It prevents password sniffing and avoids storing passwords on the server in plain text but provides no protection if an attacker manages to steal the password hash from the server. Also, the MD5 hash algorithm is nowadays no longer considered secure against determined attacks.

To ease transition from themd5 method to the newer SCRAM method, ifmd5 is specified as a method inpg_hba.conf but the user's password on the server is encrypted for SCRAM (see below), then SCRAM-based authentication will automatically be chosen instead.

password

The methodpassword sends the password in clear-text and is therefore vulnerable to passwordsniffing attacks. It should always be avoided if possible. If the connection is protected by SSL encryption thenpassword can be used safely, though. (Though SSL certificate authentication might be a better choice if one is depending on using SSL).

Postgres Pro database passwords are separate from operating system user passwords. The password for each database user is stored in thepg_authid system catalog. Passwords can be managed with the SQL commandsCREATE ROLE andALTER ROLE, e.g.,CREATE ROLE foo WITH LOGIN PASSWORD 'secret', or thepsql command\password. If no password has been set up for a user, the stored password is null and password authentication will always fail for that user.

The availability of the different password-based authentication methods depends on how a user's password on the server is encrypted (or hashed, more accurately). This is controlled by the configuration parameterpassword_encryption at the time the password is set. If a password was encrypted using thescram-sha-256 setting, then it can be used for the authentication methodsscram-sha-256 andpassword (but password transmission will be in plain text in the latter case). The authentication method specificationmd5 will automatically switch to using thescram-sha-256 method in this case, as explained above, so it will also work. If a password was encrypted using themd5 setting, then it can be used only for themd5 andpassword authentication method specifications (again, with the password transmitted in plain text in the latter case). (Previous Postgres Pro releases supported storing the password on the server in plain text. This is no longer possible.) To check the currently stored password hashes, see the system catalogpg_authid.

To upgrade an existing installation frommd5 toscram-sha-256, after having ensured that all client libraries in use are new enough to support SCRAM, setpassword_encryption = 'scram-sha-256' inpostgresql.conf, make all users set new passwords, and change the authentication method specifications inpg_hba.conf toscram-sha-256.


Prev Up Next
19.4. Trust Authentication Home 19.6. GSSAPI Authentication
pdfepub
Go to Postgres Pro Standard 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp