赞
踩
添加以下设置到 /etc/ssh/sshd_config
//空闲超时限制为 10分钟
ClientAliveInterval 600
//存活最大数量
ClientAliveCountMax 2
在/etc/pam.d/password-auth和/etc/pam.d/system-auth中password sufficient pam_unix.so 这行的末尾配置remember参数为5-24之间,原来的内容不用更改,只在末尾加了remember=5。
编辑/etc/security/pwquality.conf,把minlen(密码最小长度)设置为9-32位,把minclass(至少包含小写字母、大写字母、数字、特殊字符等4类字符中等3类或4类)设置为3或4。如:
minlen=10
minclass=3
使用非密码登陆方式如密钥对,请忽略此项。在 /etc/login.defs中将 PASS_MAX_DAYS 参数设置为 60-180之间,如:PASS_MAX_DAYS 90
需同时执行命令设置root密码失效时间:chage --maxdays 90 root
在 /etc/login.defs 中将 PASS_MIN_DAYS 参数设置为7-14之间,建议为7:PASS_MIN_DAYS 7
需同时执行命令为root用户设置:chage --mindays 7 root
编辑文件/etc/ssh/sshd_config,将PermitEmptyPasswords配置为no:PermitEmptyPasswords no
编辑 /etc/ssh/sshd_config 文件以按如下方式设置参数(取消注释):LogLevel INFO
chown root:root /etc/hosts.allow
chown root:root /etc/hosts.deny
chmod 644 /etc/hosts.deny
chmod 644 /etc/hosts.allow
chown root:root /etc/passwd /etc/shadow /etc/group /etc/gshadow
chmod 0644 /etc/group
chmod 0644 /etc/passwd
chmod 0400 /etc/shadow
chmod 0400 /etc/gshadow
它将进程的内存空间地址随机化来增大入侵者预测目的地址难度,从而降低进程被成功入侵的风险
在/etc/sysctl.conf或/etc/sysctl.d/*文件中设置以下参数: kernel.randomize_va_space = 2 执行命令: sysctl -w kernel.randomize_va_space=2
除root以外其他UID为0的用户都应该删除,或者为其分配新的UID
除root以外其他UID为0的用户(查看命令cat /etc/passwd | awk -F: '($3 == 0) { print $1 }'|grep -v '^root$')都应该删除,或者为其分配新的UID
https://blog.csdn.net/weixin_40165163/article/details/100854301
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。