Os:centos7。
tail -f /var/log/maillog Oct 30 07:18:13 localhost postfix/smtpd[3181]: warning: unknown[191.96.249.63]: SASL LOGIN authentication failed: authentication failure Oct 30 07:19:12 localhost postfix/smtpd[3181]: warning: unknown[191.96.249.70]: SASL LOGIN authentication failed: authentication failure Oct 30 07:21:00 localhost postfix/smtpd[3184]: warning: unknown[41.191.224.5]: SASL LOGIN authentication failed: authentication failure
如何禁止ip试图login我的后缀?
我看了一些资料,说postfix可以设置黑名单来禁止一些ip地址。
禁止它与iptable和禁止与postfix的黑名单设置它们是相同的效果?
如果你使用iptables(Linux的内置防火墙),那么你可以configuration一个规则来丢弃来自该IP的所有数据包。
该命令是:
iptables -A INPUT -s IP-ADDRESS -j DROP
这意味着:
iptables - the name of the command which manages iptables. -A - Appends the rule. INPUT - is the name of the chain where the rule will be appended to. -s - Defines source address. IP-ADDRESS - The address you want the rule to affect on. -j - Specifies the target of the rule DROP - The action to take
然后,运行以下命令来应用更改:
service iptables save
在你的情况下,这些命令将是:
iptables -A INPUT -s 191.96.249.63 -j DROP iptables -A INPUT -s 191.96.249.70 -j DROP iptables -A INPUT -s 41.191.224.5 -j DROP service iptables save
还有一件事情你可以做,那就是安装Fail2Ban ,它会自动禁止恶意IP,我build议你检查一下,否则你将会整天禁止特定的IP。