关键字

KingbaseES,口令策略

开启密码复杂度

1、编辑kingbase.conf文件,在shared_preload_libraries中加入passwordcheck:

shared_preload_libraries = ‘passwordcheck’

然后重启服务。

2、以SYSTEM用户登录数据库,创建扩展

TEST =# create extension passwordcheck;

CREATE EXTENSION

3、执行

TEST =# alter system set passwordcheck.enable = on;

ALTER SYSTEM



TEST =# show passwordcheck.enable;

 passwordcheck.enable

-------------------------

 off

(1行记录)



TEST =# call sys_reload_conf();

 sys_reload_conf()

-------------------------

 t

(1行记录)



TEST =# show passwordcheck.enable;

 passwordcheck.enable

-------------------------

 on

(1行记录)

查看口令默认长度

TEST =# show passwordcheck.password_length;

 passwordcheck.password_length

---------------------------------

 8

(1行记录)

查看口令默认包含几个字母

TEST =# show passwordcheck.password_condition_letter;

 passwordcheck.password_condition_letter

-------------------------------------------

 2

(1行记录)

查看口令默认包含几个数字

TEST =# show passwordcheck.password_condition_digit;

 passwordcheck.password_condition_digit

-------------------------------------------

 2

(1行记录)

示例

1、以SYSTEM 用户登录

2创建用户

TEST =# create user u1;

3、为用户设置密码

TEST =# alter user u1 with password '12345678ab';

4、system修改用户的密码

(1)密码为6位数字组成

TEST =# alter user u1 with password '123456';

错误:Password length 6 is too short, should be longer than min password length 8.

(2)密码为8位数字组成

TEST =# alter user u1 with password '12345678';

错误:Password should contain at least 2 letter and the current letter is 0.

(3)密码由数字+一位字母组成

TEST =# alter user u1 with password '12345678a';

错误:Password should contain at least 2 letter and the current letter is 1.

(4)密码由数字+二位以上字母组成

TEST =# alter user u1 with password '12345678abc';

ALTER ROLE

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐