当前位置:   article > 正文

5.GaussDB数据库登陆失败次数和锁定时间_高斯数据库 the account has been locked

高斯数据库 the account has been locked

1.GaussDB数据库登陆失败次数和锁定时间设置

  1. --支持自动锁定和解锁用户。
  2. 如果输入密码次数超过一定次数(failed_login_attempts)系统将自动锁定该用户。当用户被锁定时间超
  3. 过设定值(password_lock_time)则自动解锁。管理员可以手动锁定或解锁用户。
  4. • 支持配置口令存储加密方式。
  5. 通过password_encryption_type参数配置,默认采用sha256加密。支持md5加密,不建议使用。
  6. 例: failed_login_attempts:
  7. 查看:openGauss=# SHOW failed_login_attempts;
  8. --设置:
  9. --gs_guc reload -Z coordinator -D /gaussdb/data/coordinator -c "failed_login_attempts=11"
  10. gaussdb=> SHOW failed_login_attempts;
  11. failed_login_attempts
  12. -----------------------
  13. 10
  14. (1 row)
  15. gaussdb=> SHOW password_lock_time;
  16. password_lock_time
  17. --------------------
  18. 1d
  19. (1 row)
  20. --修改所有的实例,所有的节点允许登陆失败11次;
  21. --all必须小写,大写数据库不认识。
  22. gs_guc reload -Z coordinator -Z datanode -N all -I all -c "failed_login_attempts=11"
  23. [omm@gaussdb02 ~]$ gs_guc reload -Z coordinator -Z datanode -N all -I all -c "failed_login_attempts=11"
  24. The gs_guc run with the following arguments: [gs_guc -Z coordinator -Z datanode -N all -I all -c failed_login_attempts=11 reload ].
  25. Begin to perform the total nodes: 3.
  26. Popen count is 3, Popen success count is 3, Popen failure count is 0.
  27. Begin to perform gs_guc for coordinators.
  28. Command count is 3, Command success count is 3, Command failure count is 0.
  29. Total instances: 3. Failed instances: 0.
  30. ALL: Success to perform gs_guc!
  31. Begin to perform the total nodes: 3.
  32. Popen count is 3, Popen success count is 3, Popen failure count is 0.
  33. Begin to perform gs_guc for datanodes.
  34. Command count is 3, Command success count is 3, Command failure count is 0.
  35. Total instances: 9. Failed instances: 0.
  36. ALL: Success to perform gs_guc!
  37. --可以看到修改后立即生效。
  38. gaussdb=> SHOW failed_login_attempts;
  39. failed_login_attempts
  40. -----------------------
  41. 11
  42. (1 row)
  43. --password_lock_time:
  44. 查看:openGauss=# SHOW password_lock_time;
  45. --设置:
  46. --需要注意:password_lock_time的时间只支持d,即锁定多少天。
  47. gs_guc reload -Z coordinator -Z datanode -N all -I all -c "password_lock_time=1d"
  48. gs_guc reload -Z coordinator -Z datanode -N all -I all -c "password_lock_time=2d"
  49. --修改后立即生效。
  50. gaussdb=> SHOW password_lock_time;
  51. password_lock_time
  52. --------------------
  53. 2d
  54. (1 row)

默认GaussDB登陆失败次数10次,密码锁定1天。尅呀通过参数进行修改,且及时生效。

2.账号锁定后用户解锁

  1. --如果账号锁定,可以进行解锁。
  2. gaussdb=> alter user sjzt account unlock;
  3. ALTER ROLE
  4. gaussdb=> alter user sjzt account lock;
  5. ALTER ROLE
  6. --锁定后无法登陆,解锁后又可以重新登陆。
  7. [omm@gaussdb02 ~]$ gsql -d sjzt -U sjzt -W Gauss_123 -p 8000
  8. gsql: ERROR: The account has been locked.

账户锁定后不能登陆,解锁后可以重新登陆。

3.密码重用次数和有效时间查看

  1. --用户口令策略
  2. • 支持口令复杂度校验。
  3. 口令复杂度的要求可以通过参数 password_policy 配置,默认需至少包含大写字母、小写字母、数字和特
  4. 殊字符这四钟字符中的三种,长度不小于8,不能与用户名或用户名倒写相同等。
  5. • 支持弱口令校验。
  6. 可通过 CREATE WEAK PASSWORD DICTIONARY 语句创建弱口令。
  7. • 支持设置口令不可重用天数 password_reuse_time 或次数 password_reuse_max。
  8. • 支持设置口令有效期 password_effect_time
  9. gaussdb=> show password_policy;
  10. password_policy
  11. -----------------
  12. 1
  13. (1 row)
  14. gaussdb=> show password_reuse_time;
  15. password_reuse_time
  16. ---------------------
  17. 0
  18. (1 row)
  19. gaussdb=> show password_reuse_max;
  20. password_reuse_max
  21. --------------------
  22. 0
  23. (1 row)
  24. gaussdb=> show password_effect_time;
  25. password_effect_time
  26. ----------------------
  27. 0
  28. (1 row)

可以看到默认使用1号密码策略,:大写,小写,数字,特殊符号中三种,长度大于8.

密码重用天数:password_reuse_max=0,不可重用。

密码重用次数:password_reuse_max=0;不可重用。

密码有效时间:password_effect_time=0;长久有效。

4.SSL证书是否开启及证书存放位置

  1. --GaussDB数据库默认开始SSL认证。并且服务端证书存放位置为:
  2. [omm@gaussdb03 cn]$ pwd
  3. /data/cluster/data/cn
  4. [omm@gaussdb03 cn]$ ll |grep -E "pem|server"
  5. -rw------- 1 omm omm 1155 Aug 30 18:34 cacert.pem
  6. -rw------- 1 omm omm 4551 Aug 30 18:34 server.crt
  7. -rw------- 1 omm omm 1766 Aug 30 18:34 server.key
  8. -rw------- 1 omm omm 56 Aug 30 18:41 server.key.cipher
  9. -rw------- 1 omm omm 24 Aug 30 18:41 server.key.rand
  10. --即证书存放在CN节点。每个CN节点都有。
  11. --并且每个DN 节点下也有。
  12. --参数查看SSL证书名称。
  13. gaussdb=> show ssl;
  14. show ssl_cert_file;
  15. show ssl_key_file;
  16. show ssl_ca_file; ssl
  17. -----
  18. on
  19. (1 row)
  20. gaussdb=> ssl_cert_file
  21. ---------------
  22. server.crt
  23. (1 row)
  24. gaussdb=> ssl_key_file
  25. --------------
  26. server.key
  27. (1 row)
  28. gaussdb=>
  29. ssl_ca_file
  30. -------------
  31. cacert.pem
  32. (1 row)

SSL认证默认开启,且在CN,DN下都有证书。

5.总结

可以根据需要修改密码有效期,登陆失败次数,锁定时间等。

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/969667
推荐阅读
相关标签
  

闽ICP备14008679号