暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

GBase 8a 数据库密码策略参数

生命之源 2022-04-22
1095

password_format_option

密码内容格式参数。包括大写字母、小写字母、数字以及特殊字符4种中的几种。该参数在9.5.2.44以前的版本含义有变动,请参考后面文章介绍。

建议参数值:3。

说明

密码的组合要求,默认值为 0,表示无复杂度要求。

组合中可包含数字(1)、小写字符(2)、大写字符(4)、其它字符(8)中的 1 种或多种。
1:表示必须包含数字。
2:表示必须包含小写字母。
4:表示必须包含大写字母。
8:表示必须包含其它字符。
16:表示不能和用户名相同。
要限定组合时配置为上述值的和,可以任 意组合。 例 如 : 限 定 包 含 所 有 种 类 字 符 为 (1+2+4+8=15)。 对非英文字符,按其对应的 ASII 码范围分类

注意:从9.5.2.44版本开始,该参数改变为0-4,表示从4种组合种最少选择几种。比如3,表示最少要从数字,大写字母,小写字母,特殊字符这4种组合中选择3种。

样例

[root@gbase86_1 zxq]# gccli -umasked -pmasked12
GBase client 8.6.2.38-R1.105911. Copyright (c) 2004-2018, GBase. All Rights Reserved.
gbase> set password=password('masked12');
ERROR 1802 (HY000): Invalid password format,length should >= 8 and contain 'number' 'small letter' 'captital letter' 'special character'.
gbase> set password=password('masked12#Z');
Query OK, 0 rows affected (Elapsed: 00:00:00.01)
gbase> ^CAborted
[root@gbase86_1 zxq]# gccli -umasked -pmasked12#Z
GBase client 8.6.2.38-R1.105911. Copyright (c) 2004-2018, GBase. All Rights Reserved.
gbase>

password_max_contain_continuous_char

包含连续字段字符的最大长度,默认值0为不限制。允许范围0-65535。

字典在password_format_option里有说明,。如果一个字典类型内的字符连续长度超过参数,则为不符合要求的密码。 新版集群数据库用户(root和gbase)默认密码符合参数值为4的要求。

建议参数值:4

password_not_same_reverse_username

密码是否可以包含和用户名相同或逆序。默认为0表示禁止该参数;1表示不允许包含用户名或逆序。

建议参数值:1

password_min_length

密码最短长度,默认值0表示禁用参数。允许范围0-65535。

建议参数值:不小于8

默认配置

gbase> show variables like '%password%';
+------------------------------+-------+
| Variable_name | Value |
+------------------------------+-------+
| _gbase_check_password_format | OFF |
| old_passwords | OFF |
| password_format_option | 0 |
| password_life_time | 0 |
| password_min_length | 0 |
| password_reuse_max | 0 |
| password_reuse_time | 0 |
| report_password | |
+------------------------------+-------+
8 rows in set (Elapsed: 00:00:00.00)


修改所有管理节点和计算节点的配置文件,增加
password_min_length=8
参数,重启集群所有节点


[root@gbase86_1 zxq]# gccli
GBase client 8.6.2.38-R1.105911. Copyright ? 2004-2018, GBase. All Rights Reserved.
gbase> show variables like ‘%password%’;
±-----------------------------±------+
| Variable_name | Value |
±-----------------------------±------+
| _gbase_check_password_format | OFF |
| old_passwords | OFF |
| password_format_option | 0 |
| password_life_time | 0 |
| password_min_length | 8 |
| password_reuse_max | 0 |
| password_reuse_time | 0 |
| report_password | |
±-----------------------------±------+
8 rows in set (Elapsed: 00:00:00.02)
gbase> ^CAborted
[root@gbase86_1 zxq]# gccli -umasked -pmasked
GBase client 8.6.2.38-R1.105911. Copyright ? 2004-2018, GBase. All Rights Reserved.



– 密码长度不符合要求,不会对当前已经使用的用户造成影响。


gbase> use testdb;
Query OK, 0 rows affected (Elapsed: 00:00:00.00)
gbase> show tables;
±-----------------+
| Tables_in_testdb |
±-----------------+
| mask_default |
| mask_default2 |
| t |
| t1 |
| t2 |
| t_enc |
±-----------------+
6 rows in set (Elapsed: 00:00:00.00)


– 只有在密码变动,创建用户等设计密码时,才会检查。

gbase> set password=password(‘masked’);
ERROR 1802 (HY000): Invalid password format,length should >= 8.
gbase> set password=password(‘masked12’);
Query OK, 0 rows affected (Elapsed: 00:00:00.02)
gbase> ^CAborted
[root@gbase86_1 zxq]# gccli -umasked -pmasked
ERROR 1045 (28000): Access denied for user ‘masked’@‘localhost’ (using password: YES)
[root@gbase86_1 zxq]# gccli -umasked -pmasked12
GBase client 8.6.2.38-R1.105911. Copyright ? 2004-2018, GBase. All Rights Reserved.
gbase>
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论