是否有内置在Fail2Ban中的过滤器来暂时禁止任何尝试端口扫描活动的IP地址(前提是iptables记录这些活动)?
发布于 2013-09-07 10:54:47
您可以这样添加它(当您有iptables ... -j LOG标记您想要的扫描时),方法是添加像下面这样的额外的fail2ban过滤器
# Option: failregex
# Notes: Looks for attempts on ports not open in your firewall. Expects the
# iptables logging utility to be used. Add the following to your iptables
# config, as the last item before you DROP or REJECT:
# -A <chain_name> -j LOG --log-prefix "PORT DENIED: " --log-level 5 --log-ip-options --log-tcp-options --log-tcp-sequence
# This will place a notice in /var/log/messages about any attempt on a port that isn't open.
failregex = PORT DENIED: .* SRC=<HOST> 通过在/etc/fail2ban/filter.d (而不是/etc/fail2ban/filters.d)目录中创建一个文件。更多信息
或者,您可以使用像PortSentry这样的程序在超时后执行阻塞/发布,这些程序具有一些更高级的特性。但是请注意,阻塞并不是防弹的--由于TCP/IP的工作方式(UDP数据包,或TCP数据包在完成3个路握手之前),很有可能(因为端口扫描器也可以发送大量伪造源IP包以隐藏真正的扫描器),您最终会阻塞许多无辜的用户(可能包括您自己对服务器的管理员访问)。
https://webmasters.stackexchange.com/questions/30821
复制相似问题