国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Linux > 正文

iptables防火墻實現(xiàn)阻擋常見攻擊的實用設(shè)置分享

2020-07-10 11:31:10
字體:
供稿:網(wǎng)友

從 Yaocheng 那里看到了這篇文章,好東西,需要珍藏下。這里列舉了 Linux 下面幾個經(jīng)常遇見的攻擊手段和應對手段。以下 iptables 規(guī)則應該普遍適應于各種 Linux 版本,只是要注意保存,以免系統(tǒng)重啟后失效

初始創(chuàng)建的 TCP 連接必須含 SYN


復制代碼
代碼如下:

iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP

丟棄 Fragments 碎片數(shù)據(jù)包 (碎片數(shù)據(jù)包攻擊的后果: 可能導致正常數(shù)據(jù)包丟失)

復制代碼
代碼如下:

iptables -A INPUT -f -j DROP

防止 SYN 洪水攻擊 (限制的速度根據(jù)自身情況調(diào)整)


復制代碼
代碼如下:

iptables -A INPUT -p tcp -m state --state NEW -m limit --limit 100/second --limit-burst 300 -j ACCEPT
iptables -A INPUT -p tcp -m state --state NEW -j DROP

丟棄異常的 XMAS 數(shù)據(jù)包 (異常的 XMAS 數(shù)據(jù)包攻擊的后果: 可能導致某些系統(tǒng)崩潰)


復制代碼
代碼如下:

iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL FIN,PSH,URG -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP

丟棄 NULL 空數(shù)據(jù)包


復制代碼
代碼如下:

iptables -A INPIT -p tcp --tcp-flags ALL NONE -j DROP

允許有限的 TCP RST 請求 (限制的速度根據(jù)自身情況調(diào)整)


復制代碼
代碼如下:

iptables -A INPUT -p tcp -m tcp --tcp-flags RST RST -m limit --limit 10/second --limit-burst 30 -j ACCEPT

丟棄無效數(shù)據(jù)包


復制代碼
代碼如下:

iptables -A INPUT -m state --state INVALID -j DROP
iptables -A FORWARD -m state --state INVALID -j DROP
iptables -A OUTPUT -m state --state INVALID -j DROP

阻擋欺詐 IP 地址的訪問 (以下為 RFC1918 類型和 IANA 預留地址,多為 LAN 或者多播地址,這些是不可能作為公網(wǎng)地址源的)


復制代碼
代碼如下:

iptables -A INPUT -s 10.0.0.0/8 -j DROP
iptables -A INPUT -s 169.254.0.0/16 -j DROP
iptables -A INPUT -s 172.16.0.0/12 -j DROP
iptables -A INPUT -s 127.0.0.0/8 -j DROP
iptables -A INPUT -s 224.0.0.0/4 -j DROP
iptables -A INPUT -d 224.0.0.0/4 -j DROP
iptables -A INPUT -s 240.0.0.0/5 -j DROP
iptables -A INPUT -d 240.0.0.0/5 -j DROP
iptables -A INPUT -s 0.0.0.0/8 -j DROP
iptables -A INPUT -d 0.0.0.0/8 -j DROP
iptables -A INPUT -d 239.255.255.0/24 -j DROP
iptables -A INPUT -d 255.255.255.255 -j DROP

阻擋自定義的惡意 IP 地址的訪問


復制代碼
代碼如下:

iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP

禁止 ICMP PING

復制代碼
代碼如下:

iptables -A INPUT -p icmp -m icmp --icmp-type echo-request -j DROP

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 广元市| 和龙市| 仁化县| 遂昌县| 滁州市| 抚州市| 衢州市| 奉节县| 离岛区| 石林| 霍山县| 博客| 西贡区| 天全县| 浦北县| 桂平市| 平陆县| 错那县| 东至县| 梧州市| 宝清县| 乌恰县| 盐池县| 云霄县| 香格里拉县| 容城县| 达拉特旗| 普定县| 曲周县| 双城市| 南和县| 大理市| 三原县| 永城市| 罗源县| 门头沟区| 乐至县| SHOW| 玉树县| 泰州市| 南召县|