首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何禁止ip试图登录我的后缀?

问如何禁止ip试图登录我的后缀?
EN

Server Fault用户
提问于 2017-10-30 11:29:08
回答 1查看 3.9K关注 0票数 3

操作系统: centos7。

代码语言:javascript
复制
 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的黑名单设置来禁止它的效果是一样的吗?

EN

回答 1

Server Fault用户

回答已采纳

发布于 2017-10-30 11:48:43

如果您使用iptables (Linux的内置防火墙),那么您可以配置一个规则来丢弃来自该IP的所有数据包。

该命令是:

代码语言:javascript
复制
iptables -A INPUT -s IP-ADDRESS -j DROP

它的意思是:

代码语言:javascript
复制
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

然后,运行以下命令以应用更改:

代码语言:javascript
复制
service iptables save

在您的例子中,命令将是:

代码语言:javascript
复制
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。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/880974

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档