二级等保查出来的服务器问题

操作前可在自己服务器测试一下,看看没有

1.服务器定时更换密码

永久(需重启vim /etc/login.defs
PASS_MAX_DAYS 90  # 密码最长过期天数
PASS_MIN_DAYS 0  # 密码最小过期天数
PASS_MIN_LEN  10  # 密码最小长度
PASS_WARN_AGE  15  # 密码过期警告天数
临时(直接生效chage -m 1 root
chage -M 1 root
chage -W 2 root     # 过期前几天提醒

2.登录失败限制登录

vim /etc/pam.d/system-auth
auth required pam_tally2.so  onerr=fail  deny=5  unlock_time=300 even_deny_root root_unlock_time=300
vim /etc/pam.d/sshd
auth required pam_tally2.so  onerr=fail  deny=5  unlock_time=300 even_deny_root root_unlock_time=300

3.超时退出

vim /etc/profile
打开以下设置
export TMOUT=300
保存退出刷新
source /etc/profile

4.日志审计

vim /etc/audit/relus.d/audit.rules

-w /etc/shadow -p wa -k shadow_changes
-w /etc/securetty -p wa -k securetty_changes
-w /etc/group -p wa -k group_changes

# 日志位置
vim /etc/audit/auditd.conf

log_file = /path/to/your/logfile

service auditd restart

5.禁用远程root登录

vi /etc/ssh/sshd_config
# 修改为下面这个
PermitRootLogin no

service sshd restart

6. SSH版本信息可被获取

# 创建banner文件;如果有就不需要创建
touch /etc/ssh/ssh_banner
# 写入登陆时要显示banner信息
echo "Wecome to use system" > /etc/ssh/ssh_banner
# 编辑文件添加banner文件路径
vim /etc/ssh/sshd_config
# 找到 #Banner none在下面添加路径
# Banner none
Banner /etc/ssh/ssh_banner
# 重启ssh
systemctl restart sshd

7.ICMP timestamp请求响应漏洞

在您的防火墙过滤外来的ICMP timestamp类型 13)报文以及外出的ICMP timestamp回复报文

# 查看当前策略
iptables -L -n

iptables -A INPUT -p ICMP --icmp-type timestamp-request -j DROP
iptables -A INPUT -p ICMP --icmp-type timestamp-reply -j DROP
iptables -A OUTPUT -p ICMP --icmp-type timestamp-reply -j DROP

8.允许Traceroute探测

防火墙出站规则中禁用echoreplytype 0)、timeexceeded(type 11)、destination-unreachable(type 3)类型的ICMP包。

iptables -A INPUT -p ICMP --icmp-type time-exceeded -j DROP
iptables -A OUTPUT -p ICMP --icmp-type time-exceeded -j DROP

iptables -A INPUT -p ICMP --icmp-type echo-reply -j DROP
iptables -A OUTPUT -p ICMP --icmp-type echo-reply -j DROP

iptables -A INPUT -p ICMP --icmp-type destination-unreachable -j DROP
iptables -A OUTPUT -p ICMP --icmp-type destination-unreachable -j DROP

9. OpenSSH CBC模式信息泄露漏洞(CVE-2008-5161)

man sshd_config
echo 'Ciphers aes128-ctr,aes192-ctr,aes256-ctr' >> /etc/ssh/sshd_config
systemctl restart sshd

原文地址:https://blog.csdn.net/daitu_/article/details/134706277

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_19797.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注