PG之密码检测插件---passwordchecke及延迟
1.下载
https://github.com/Luckyness/passwordcheck.git
2.使用方式
[root@harbor contrib]# cat /data/tools/passwordcheck/README.md
# 1.使用方式
* 替换目录 ../postgresql-11.4/contrib/passwordcheck 下的 passwordcheck.c
* 编译安装 make && make install
* postgresql配置文件内修改 (postgresql.conf)
* shared_preload_libraries = 'passwordcheck'
* passwordcheck.level = 'true'

# 2.效果
pg数据库用户密码必须包括数字英文和特殊字符
3.使用
#pg_ctl restart
postgres=# alter role postgres encrypted password 'abc123';
ERROR: 22023: password is too short
LOCATION: check_password, passwordcheck.c:102
Time: 0.344 ms
postgres=#
4.密码验证失败延迟
(1)防止暴力破解,验证失败后,需要等待一个时间才能继续验证
[postgres@harbor auth_delay]$ pwd
/data/tools/postgresql-14.3/contrib/auth_delay
$make && make install
(2)修改配置文件
#vi postgresql.conf
shared_preload_libraries = 'auth_delay,passwordcheck'
passwordcheck.level = 'true'
auth_delay.milliseconds = 60000 #(60s)
[postgres@harbor auth_delay]$ psql -h192.168.56.106 -Upostgres postgres -W
Password:
密码如果输入错误会等待到60s返回错误结果,防止暴力破解
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏