1、修改kingbase.conf后方追加
shared_preload_libraries参数添加passwordcheck
passwordcheck.enable=on
passwordcheck.password_length=8
passwordcheck.password_condition_letter=2
passwordcheck.password_condition_digit=2
passwordcheck.password_condition_punct=1
identity_pwdexp.password_change_interval=90
passwordcheck.enable
密码参数开关,默认值off
passwordcheck.password_length
设置密码的最小长度限制,默认值8,范围8..63
passwordcheck.password_condition_letter
设置密码至少包含几个字母,默认值2,范围2..61
passwordcheck.password_condition_digit
设置密码至少包含几个数字,默认值2,范围2..61
passwordcheck.password_condition_punct
设置密码至少包含几个特殊字符,默认值0,范围0..59
2、重启服务生效
sys_ctl -D /home/kingbase/KingbaseES/V8 data restart
3、登录数据库创建扩展
create extension passwordcheck;
create extension identity_pwdexp;
4、检查应用服务的数据库配置文件,确认口令设置是否符合要求。
test=# create user test_user with password '12345678';
ERROR: Password should contain at least 2 letter and the current letter is 0
test=# create user test_user with password '12345678ab';
ERROR: Password should contain at least 1 punct and the current punct is 0
test=# create user test_user with password '12345678ab!';
CREATE ROLE
test=#