将PostgreSQL密码加密从MD5更改为SHA [英] Change PostgreSQL password encryption from MD5 to SHA

查看:1076
本文介绍了将PostgreSQL密码加密从MD5更改为SHA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将PostgreSQL密码加密方法从MD5更改为SHA?

Is there a way to change the PostgreSQL password encryption method from MD5 to SHA?

如果可以,请告诉我如何?

If Yes, can you please tell me how?

我正在使用PostgreSQL 9.5

I am using PostgreSQL 9.5

推荐答案

Pg 10



在PostgreSQL 10中,您可以将 password_encryption 设置为 scram-sha-256 。来自文档


创建角色 ALTER中指定密码时ROLE 而不写入 ENCRYPTED UNENCRYPTED ,此参数确定密码是否为加密。默认值为md5,它将密码存储为MD5哈希。将此设置为纯文本将以明文形式存储。也接受on和off作为md5和plain的别名。 将此参数设置为scram-sha-256将使用SCRAM-SHA-256加密密码。

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.

有关使用scram-sha-256

如果不实际修改源代码,则无法完成此操作。

This can not be done without actually modifying the source.

这篇关于将PostgreSQL密码加密从MD5更改为SHA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆