Linux/Centos服务器禁止udp发包防udp-flood攻击

作者:hack1990 时间:12-11-30 阅读数:1542人阅读

有的网站被恶意放上UDP发包工具攻击别人 导致流量大量流失

一般服务器只有DNS使用udp协议,其它则可禁用UDP数据包外出

为此写了个脚本只允许目标DNS服务器的UDP数据包外出

其它UDP数据包全部拒绝

本方法仅能做到防止恶意UDP数据包发出

服务器本身做好安全设置防止被恶意放马才是王道。
 
#/bin/bash
#Createdby http://www.hack1990.com
#DROP UDP Flood
list=`grep nameserver /etc/resolv.conf |awk '{print $NF}'`
for i in $list
do
        iptables -A OUTPUT -p udp -d $i --dport 53 -j ACCEPT
done
iptables -A OUTPUT -p udp -j DROP
service iptables save
 

发表评论