免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2000 | 回复: 1
打印 上一主题 下一主题

iptables TARPIT target [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-08-29 12:02 |只看该作者 |倒序浏览
Adds a TARPIT target to iptables, which captures and holds incoming TCP connections using no local per-connection resources. Connections are accepted, but immediately switched to the persist state(0 byte window), inwhich the remote side stops sending data and asks to continue every 60
-240 seconds. Attempts to close the connection are ignored, forcing the remote side to time out the connection in 12-24 minutes.
??
This offers similar functionality to LaBrea but doesn't require dedicated hardware or IPs. Any TCP port that you would normally DROP or REJECT can instead become a tarpit.
To tarpit connections to TCP port 80 destined for the curren machine:
??
?? iptables -A INPUT -p tcp -m tcp --dport 80 -j TARPIT
??
To significantly slow down Code Red/Nimda-style scans of unused address space, forward unused ip addresses to a Linux box not acting as a router (e.g. "ip route 10.0.0.0 255.0.0.0 ip.of.linux.box" on a Cisco),
enable IP forwarding on the Linux box, and add:
??
?? iptables -A FORWARD -p tcp -j TARPIT
?? iptables -A FORWARD -j DROP
??
??You probably don't want the conntrack module loaded while you are using TARPIT, or you will be using resources per connection


   tarpits,陷阱?它是一个新的iptables target。除了本来可以把一个包log、accept或者drop外,你还可以trapit。我觉得翻译成黑洞好像更贴切。
iptables -A INPUT -p tcp -m tcp --dport 135 -j TARPIT
当一个新的链接过来的时候,连接会正常开始,但是tcp windows size会被设置成0,就是说连接虽然建立了,但是数据不会传输,而且你会发现如果强制终结连接也不管用,直到l连接默认的time out时间到达,链接才会中止。
可能有人已经明白了这个咚咚的用处了吧。用来防止入侵的一种。这种逆反思想很好啊,和传统的屏蔽端口不同,方法正好相反。
我们一般配iptables规则的手法是先打开要用的几个端口.然后把其他的drop掉。在最后那句drop前面加上
iptables -A INPUT -p tcp -j TARPIT
那么当有人用端口扫描工具扫描你的机器的时候,他会发现所有的检测端口都是可用的。
而且如果他扫描的端口范围比较大,那么他的那些链接都要很长时间才会放掉。
注意TARPIT不是iptables的标配,你要用的话,要下载patch-o-matic,patch过内核,然后重新编译内核才能使用,另外有一些linux发行版本,像Gentoo是作为标准配置提供的。
感觉对个人用户可能用处不大,不过对于公司网络,特别是isp应该很有用吧。我看到的应用是利用它来减缓蠕虫病毒的蔓延。;)

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/31547/showart_370213.html

论坛徽章:
0
2 [报告]
发表于 2014-12-05 17:27 |只看该作者
标记一下,看起来还挺有意思的
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP