我的Squid(Ubuntu 13.04上的3.1.20)受到DDoS攻击(有大约1000个不同的IP)。
我正在使用基本身份validation,所有这些请求都获得拒绝响应,但仍然增加服务器的负载。
如何防御Squid上的DDoS攻击?
如何使用鱿鱼filterfail2ban?
这里有一个configuration示例:
# Fail2Ban configuration file for squid # # Author: Jackie Craig Sparks # # $Revision: 728 $ # [INCLUDES] # Read common prefixes. If any customizations available -- read them from # common.local before = common.conf [Definition] _daemon = squid # Option: failregex # Notes.: regex to match the password failures messages in the logfile. The # host must be matched by a group named "host". The tag "<HOST>" can # be used for standard IP/hostname matching and is only an alias for # (?:::f{4,6}:)?(?P<host>[\w\-.^_]+) # Values: TEXT # failregex = \d{0,10}.*\d{0,3}\ .* \ \d <HOST> TCP_DENIED\/407 .*$ # Option: ignoreregex # Notes.: regex to ignore. If this regex matches, the line is ignored. # Values: TEXT # ignoreregex =
如果你能够把Squidconfiguration成仅绑定到本地主机,并从SSH隧道(或通过VPN,如果这是一个选项)访问它,你会改变你的攻击面,应该有较less的性能影响。 我会使用iptables来限制传入的SSH连接的访问速度(这正是我自己的Squidcaching,实际上)。