postgresql - 将 PostgreSQL 密码加密从 MD5 更改为 SHA

标签 postgresql sha postgresql-9.5 database-security

有没有办法将 PostgreSQL 密码的加密方式从 MD5 改为 SHA?

如果是,你能告诉我怎么做吗?

我正在使用 PostgreSQL 9.5

最佳答案

第 10 页

使用 PostgreSQL 10,您可以将 password_encryption 设置为 scram-sha-256。来自 the docs

When a password is specified in CREATE ROLE or ALTER ROLE 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.

See this post for information about iterations using scram-sha-256

第 9.x 页

如果不实际修改源代码,这是无法完成的。

关于postgresql - 将 PostgreSQL 密码加密从 MD5 更改为 SHA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43333053/

相关文章:

macos - 尝试使用 RODBC 将 R 连接到 PostgreSQL 时出错

java - 启用 Java sha1 原始模式,如 php sha1

SQL 查询运行很慢 - postgres

c# - EFCore Postgres 时间戳丢失刻度精度

postgresql - 生成 Postgres 转储并保存到另一台服务器

php - PostgreSQL 使用 PK、NOT NULL、varchar 创建表

c# - 使用 SHA256 将字符串转换为 Guid 而不截断

c - readFile 和 ConvertCharToIntArray 方法影响 Sha-1 的哈希实现

postgresql - 在 to_regclass() 函数中使用动态创建的名称

sql - 如何用静态数字替换postgres中的日期