Linux漏洞修复:禁用外来的ICMP timestamp和禁止Traceroute探测
2022/1/27 7:09:16
本文主要是介绍Linux漏洞修复:禁用外来的ICMP timestamp和禁止Traceroute探测,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、安装iptables服务
下载安装包,下载地址 http://mirrors.163.com/centos/7/os/x86_64/Packages/
然后使用 rpm 命令安装
sudo rpm -Uvh iptables-1.4.21-24.el7.x86_64.rpm
sudo rpm -Uvh iptables-services-1.4.21-24.el7.x86_64.rpm
2、重启iptables服务
sudo service iptables restart
3、直接在终端命令行输入如下命令,禁用外来的ICMP timestamp和禁止Traceroute探测
sudo iptables -A INPUT -p ICMP --icmp-type timestamp-request -j DROP
sudo iptables -A INPUT -p ICMP --icmp-type timestamp-reply -j DROP
sudo iptables -A INPUT -p ICMP --icmp-type time-exceeded -j DROP
sudo iptables -A OUTPUT -p ICMP --icmp-type time-exceeded -j DROP
4、执行命令对修改过的规则进行保存,使其永久生效
sudo service iptables save
5、检查新添加的规则是否生效
sudo iptables -L -n
生效的话会显示添加下面几条规则,13,14是ICMP timestamp 请求响应漏洞的规则,11是解决允许Traceroute探测的
DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 13
DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 14
DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 11
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 11
备注:
修改过的规则保存在/etc/sysconfig/iptables文件下
# Generated by iptables-save v1.4.21 on Wed Jan 26 16:31:39 2022
*filter
:INPUT ACCEPT [76:7013]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [35:5448]
-A INPUT -p icmp -m icmp --icmp-type 13 -j DROP
-A INPUT -p icmp -m icmp --icmp-type 14 -j DROP
-A INPUT -p icmp -m icmp --icmp-type 11 -j DROP
-A OUTPUT -p icmp -m icmp --icmp-type 11 -j DROP
COMMIT
# Completed on Wed Jan 26 16:31:39 2022
这篇关于Linux漏洞修复:禁用外来的ICMP timestamp和禁止Traceroute探测的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-30[译]漫画SELinux概念
- 2024-03-29linux 移动文件
- 2024-03-28linux .so file
- 2024-03-28Linux 磁盘管理
- 2024-03-28Linux学习笔记(十三)磁盘管理(一):磁盘分区
- 2024-03-26linux 创建 文件
- 2024-03-25使用SecureCRT对Linux vim进行颜色设置
- 2024-03-202019-2020-12 20199317 《Linux内核原理与分析》 第十二周作业
- 2024-03-20Linux运维的第二周总结
- 2024-03-13how to count number of directories in linux