操作系统: 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试图登录我的后缀?
我读过后缀可以设置黑名单来禁止某些ip地址的一些材料。
用iptable来禁止它和用postfix的黑名单设置来禁止它的效果是一样的吗?
发布于 2017-10-30 11:48:43
如果您使用iptables (Linux的内置防火墙),那么您可以配置一个规则来丢弃来自该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,我建议你检查它,否则你将整天禁止特定的IP。
https://serverfault.com/questions/880974
复制相似问题