针对Centos7下的系统用户的密码规则复杂度的设置,处于安全考虑,说明如下:
一、设置密码规则
1)密码长度、有效期
/etc/login.defs文件是当创建用户时的一些规划,比如创建用户时,是否需要家目录,UID和GID的范围;用户的期限等等,这个文件是可以通过root来定义的。
1 2 3 4 5 6 |
|
2)查看用户的密码规则
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
3) 设置密码过期的天数。 用户必须在几天内更改密码。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为现有用户,请运行命令"chage -M(days)(user)"
1 2 3 |
|
4)设置可用密码的最短天数。 至少在改变它之后,用户必须至少使用他们的密码。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为现有用户,请运行命令"chage -m(days)(user)"
1 2 3 |
|
5)在到期前设置警告的天数。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为存在用户,请运行命令"chage -W(days)(user)"
1 2 3 |
|
6)5次更改密码不能有重复(即最近5次使用过的密码就不能再用作新密码了),并且每次修改密码都会将历史密码记录在/etc/security/opasswd文件中
1 2 3 |
|
7)设置最小密码长度。 用户不能将密码长度设置为小于此参数
1 2 3 |
|
8)为新密码设置所需的最少字符类数(种类⇒大写字母/小写字母/数字/特殊字符)
1 2 3 |
|
9)在新密码中设置允许的连续相同字符的最大数量
1 2 3 |
|
10)在新密码中设置同一类的最大允许连续字符数
1 2 3 |
|
11)新密码中至少需要一个小写字符
1 2 3 |
|
12)新密码中至少需要一个大写字符
1 2 3 |
|
13)新密码中至少需要一位数字
1 2 3 |
|
14)新密码中至少需要一个其他字符
1 2 3 |
|
15)在新密码中设置单调字符序列的最大长度(ex⇒’12345’,’fedcb’)
1 2 3 |
|
16)设置旧密码中不能出现的新密码中的字符数
1 2 3 |
|
17)检查新密码中是否包含用户passwd项的GECOS字段中长度超过3个字符的单词
1 2 3 |
|
18)设置不能包含在密码中的Ssace分隔列表
1 2 3 |
|
19)为新密码设置散列/密码算法。 (默认是sha512)
1 2 3 4 5 6 |
|
二、账户锁定策略实现
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
***************当你发现自己的才华撑不起野心时,就请安静下来学习吧***************