赞
踩
1.GaussDB数据库登陆失败次数和锁定时间设置
- --支持自动锁定和解锁用户。
- 如果输入密码次数超过一定次数(failed_login_attempts)系统将自动锁定该用户。当用户被锁定时间超
- 过设定值(password_lock_time)则自动解锁。管理员可以手动锁定或解锁用户。
- • 支持配置口令存储加密方式。
- 通过password_encryption_type参数配置,默认采用sha256加密。支持md5加密,不建议使用。
- 例: failed_login_attempts:
- 查看:openGauss=# SHOW failed_login_attempts;
- --设置:
- --gs_guc reload -Z coordinator -D /gaussdb/data/coordinator -c "failed_login_attempts=11"
-
-
- gaussdb=> SHOW failed_login_attempts;
- failed_login_attempts
- -----------------------
- 10
- (1 row)
-
- gaussdb=> SHOW password_lock_time;
- password_lock_time
- --------------------
- 1d
- (1 row)
-
-
- --修改所有的实例,所有的节点允许登陆失败11次;
- --all必须小写,大写数据库不认识。
- gs_guc reload -Z coordinator -Z datanode -N all -I all -c "failed_login_attempts=11"
-
- [omm@gaussdb02 ~]$ gs_guc reload -Z coordinator -Z datanode -N all -I all -c "failed_login_attempts=11"
- The gs_guc run with the following arguments: [gs_guc -Z coordinator -Z datanode -N all -I all -c failed_login_attempts=11 reload ].
- Begin to perform the total nodes: 3.
- Popen count is 3, Popen success count is 3, Popen failure count is 0.
- Begin to perform gs_guc for coordinators.
- Command count is 3, Command success count is 3, Command failure count is 0.
- Total instances: 3. Failed instances: 0.
- ALL: Success to perform gs_guc!
- Begin to perform the total nodes: 3.
- Popen count is 3, Popen success count is 3, Popen failure count is 0.
- Begin to perform gs_guc for datanodes.
- Command count is 3, Command success count is 3, Command failure count is 0.
- Total instances: 9. Failed instances: 0.
- ALL: Success to perform gs_guc!
- --可以看到修改后立即生效。
- gaussdb=> SHOW failed_login_attempts;
- failed_login_attempts
- -----------------------
- 11
- (1 row)
-
-
- --password_lock_time:
- 查看:openGauss=# SHOW password_lock_time;
- --设置:
- --需要注意:password_lock_time的时间只支持d,即锁定多少天。
-
- gs_guc reload -Z coordinator -Z datanode -N all -I all -c "password_lock_time=1d"
- gs_guc reload -Z coordinator -Z datanode -N all -I all -c "password_lock_time=2d"
- --修改后立即生效。
- gaussdb=> SHOW password_lock_time;
- password_lock_time
- --------------------
- 2d
- (1 row)

默认GaussDB登陆失败次数10次,密码锁定1天。尅呀通过参数进行修改,且及时生效。
2.账号锁定后用户解锁
- --如果账号锁定,可以进行解锁。
- gaussdb=> alter user sjzt account unlock;
- ALTER ROLE
- gaussdb=> alter user sjzt account lock;
- ALTER ROLE
- --锁定后无法登陆,解锁后又可以重新登陆。
- [omm@gaussdb02 ~]$ gsql -d sjzt -U sjzt -W Gauss_123 -p 8000
- gsql: ERROR: The account has been locked.
-
账户锁定后不能登陆,解锁后可以重新登陆。
3.密码重用次数和有效时间查看
- --用户口令策略
- • 支持口令复杂度校验。
- 口令复杂度的要求可以通过参数 password_policy 配置,默认需至少包含大写字母、小写字母、数字和特
- 殊字符这四钟字符中的三种,长度不小于8,不能与用户名或用户名倒写相同等。
- • 支持弱口令校验。
- 可通过 CREATE WEAK PASSWORD DICTIONARY 语句创建弱口令。
- • 支持设置口令不可重用天数 password_reuse_time 或次数 password_reuse_max。
- • 支持设置口令有效期 password_effect_time 。
- gaussdb=> show password_policy;
- password_policy
- -----------------
- 1
- (1 row)
- gaussdb=> show password_reuse_time;
- password_reuse_time
- ---------------------
- 0
- (1 row)
- gaussdb=> show password_reuse_max;
- password_reuse_max
- --------------------
- 0
- (1 row)
- gaussdb=> show password_effect_time;
- password_effect_time
- ----------------------
- 0
- (1 row)

可以看到默认使用1号密码策略,:大写,小写,数字,特殊符号中三种,长度大于8.
密码重用天数:password_reuse_max=0,不可重用。
密码重用次数:password_reuse_max=0;不可重用。
密码有效时间:password_effect_time=0;长久有效。
4.SSL证书是否开启及证书存放位置
- --GaussDB数据库默认开始SSL认证。并且服务端证书存放位置为:
- [omm@gaussdb03 cn]$ pwd
- /data/cluster/data/cn
- [omm@gaussdb03 cn]$ ll |grep -E "pem|server"
- -rw------- 1 omm omm 1155 Aug 30 18:34 cacert.pem
- -rw------- 1 omm omm 4551 Aug 30 18:34 server.crt
- -rw------- 1 omm omm 1766 Aug 30 18:34 server.key
- -rw------- 1 omm omm 56 Aug 30 18:41 server.key.cipher
- -rw------- 1 omm omm 24 Aug 30 18:41 server.key.rand
-
- --即证书存放在CN节点。每个CN节点都有。
- --并且每个DN 节点下也有。
-
- --参数查看SSL证书名称。
- gaussdb=> show ssl;
- show ssl_cert_file;
- show ssl_key_file;
- show ssl_ca_file; ssl
- -----
- on
- (1 row)
- gaussdb=> ssl_cert_file
- ---------------
- server.crt
- (1 row)
- gaussdb=> ssl_key_file
- --------------
- server.key
- (1 row)
- gaussdb=>
- ssl_ca_file
- -------------
- cacert.pem
- (1 row)

SSL认证默认开启,且在CN,DN下都有证书。
5.总结
可以根据需要修改密码有效期,登陆失败次数,锁定时间等。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。