vim /etc/postfix/main.cf smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/access
在/ etc / postfix / access中添加一些ips
vim /etc/postfix/access 86.111.171.141 REJECT 191.96.249.63 REJECT
重新启动后缀。
postmap hash:/etc/postfix/access systemctl restart postfix
经过一段时间。
tail /var/log/maillog Oct 30 10:18:45 localhost postfix/smtpd[3491]: connect from unknown[86.111.171.141] Oct 30 10:18:45 localhost postfix/smtpd[3491]: warning: unknown[86.111.171.141]: SASL LOGIN authentication failed: authentication failure Oct 30 10:18:46 localhost postfix/smtpd[3491]: disconnect from unknown[86.111.171.141] Oct 30 10:18:45 localhost postfix/smtpd[3491]: connect from unknown[191.96.249.63] Oct 30 10:18:45 localhost postfix/smtpd[3491]: warning: unknown[191.96.249.63]: SASL LOGIN authentication failed: authentication failure Oct 30 10:18:46 localhost postfix/smtpd[3491]: disconnect from unknown[191.96.249.63]
为什么ip不能被后缀黑名单禁止?
因为check_sender_access是一个smtpd_sender_restriction ,因此,执行
对于
MAIL FROM地址,域,父域或localpart@,并执行相应的操作。
如果您不想使用Postfix阻止IP地址,请改为查看smtpd_helo_restrictions 。 有可能check_helo_a_access为HELO / EHLO主机名的IP地址。 请记住添加smtpd_helo_required = yes ,也可能添加reject_unknown_helo_hostname 。