Security iptables-块(通配符)子域,因为bruteforce具有不同的IP';s
在我的Ubuntu14.04服务器的/var/log/mail.log中,我发现了大量类似这样的行:Security iptables-块(通配符)子域,因为bruteforce具有不同的IP';s,security,ubuntu-14.04,iptables,postfix-mta,Security,Ubuntu 14.04,Iptables,Postfix Mta,在我的Ubuntu14.04服务器的/var/log/mail.log中,我发现了大量类似这样的行: Sep 16 13:23:03 server postfix/smtpd[25621]: warning: 212-83-162-157.rev.poneytelecom.eu[212.83.162.157]: SASL LOGIN authentication failed: UGFzc3dvcmQ6 .... Sep 16 12:57:29 server postfix/smtpd[2482
Sep 16 13:23:03 server postfix/smtpd[25621]: warning: 212-83-162-157.rev.poneytelecom.eu[212.83.162.157]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
....
Sep 16 12:57:29 server postfix/smtpd[24828]: warning: 212-83-175-192.rev.poneytelecom.eu[212.83.175.192]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
所以我认为,有人试图通过postfix登录发送垃圾邮件。正如你所看到的,罪犯每次尝试都会使用不同的IP和子域。因此,通过配置iptables来阻止特定的IP是没有意义的。
所以我想做的是用iptables阻止域“poneytelecom.eu”的所有子域
因此,我尝试了不同的方法:
iptables -I INPUT -m string --algo bm --string "*poneytelecom.eu" -j DROP
iptables -I INPUT -m string --string "Host: *poneytelecom.eu" --algo bm -j DROP
iptables –A INPUT –m string --algo bm --string "*poneytelecom.eu" -j DROP
命令“iptables-L-n--line”表示:
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 DROP all -- 0.0.0.0/0 0.0.0.0/0 STRING match "Host: *poneytelecom.eu" ALGO name bm TO 65535
2 DROP all -- 0.0.0.0/0 0.0.0.0/0 STRING match "*poneytelecom.eu" ALGO name bm TO 65535
3 DROP all -- 0.0.0.0/0 0.0.0.0/0 STRING match "*poneytelecom.eu" ALGO name bm TO 65535
但这样做是行不通的;我仍然可以在此域的/var/log/mail.log中看到入侵尝试:
Sep 16 13:32:25 server postfix/smtpd[25922]: warning: 62-210-188-107.rev.poneytelecom.eu[62.210.188.107]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
有人知道我在做什么吗?如何通过iptables阻止子域?据我所知,您的服务器上存在smtp暴力攻击。为了避免此类攻击,您必须使用fail2ban,它支持SSH、SMTP等的暴力保护
检查黑客的IP地址范围: 范围为212.129.0.0/18 然后块范围:
iptables -A INPUT -s 212.129.0.0/18 -j DROP
service iptables save
我想避免使用更多的软件来归档。我编写了一个bash脚本,它已经可以很好地处理IP地址了。稍后,我想扩展这个脚本来监听(子)域。因此,我需要知道为什么子域的iptables配置没有像我那样工作。