Centos7 安全加固密码规则 vi /etc/login.defs
PASS_MAX_DAYS 60 # 密码到期时间 #设置密码过期的天数。 用户必须在几天内更改密码。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为现有用户,请运行命令“chage -M(days)(user)” PASS_MIN_DAYS 3 # 初始密码更改时间 #设置可用密码的最短天数。 至少在改变它之后,用户必须至少使用他们的密码。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为现有用户,请运行命令“chage -m(days)(user)” PASS_MIN_LEN 8 # 密码最小长度 #用户不能将密码长度设置为小于此参数。 PASS_WARN_AGE 7 # 密码过期提示时间 #在到期前设置警告的天数。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为存在用户,请运行命令“chage -W(days)(user)”
账号锁定规则 vi /etc/pam.d/login #%PAM-1.0 auth required pam_tally2.so deny=3 lock_time=300 even_deny_root root_unlock_time=10
deny 设置普通用户和root用户连续错误登陆的最大次数,超过最大次数,则锁定该用户
unlock_time 设定普通用户锁定后,多少时间后解锁,单位是秒;
even_deny_root 也限制root用户;
root_unlock_time 设定root用户锁定后,多少时间后解锁,单位是秒;
Centos7 ssh和vsftp限制IP登录白名单和黑名单(白名单优先级大于黑名单) vi /etc/hosts.deny (黑名单) 最后面加上两行代码的意思是,限制sshd和vsftpd服务所有IP登陆 # hosts.deny This file describes the names of the hosts which are # *not* allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # # The portmap line is redundant, but it is left to remind you that # the new secure portmap uses hosts.deny and hosts.allow. In particular # you should know that NFS uses portmap! sshd:ALL vsftpd:ALL vi /etc/hosts.allow (白名单) 最后面加上的代码意思是,该IP可以访问sshd和vsftpd服务 # hosts.allow This file describes the names of the hosts which are # allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # #sshd sshd:192.168.199.171:allow #vsfptd vsftpd:192.168.199.171:allow
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。