我已在 Postfix 中配置了 check_recipient_mx_access 选项,以便拒绝发送拼写错误的域名的电子邮件。我们有一个发送航班确认的系统,很多时候用户会写错联系电子邮件帐户。
该文件指出以下内容
check_recipient_mx_access type:table
Search the specified access(5) database for the MX hosts for the
RCPT TO domain, and execute the corresponding action. If no MX
record is found, look up A or AAAA records, just like the Postfix
SMTP client would. Note: a result of "OK" is not allowed for safety
reasons. Instead, use DUNNO in order to exclude specific hosts from
denylists. This feature is available in Postfix 2.1 and later.
我的配置如下:
main.cf
smtpd_recipient_restrictions = reject_invalid_hostname,
reject_unauth_pipelining,
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
check_client_access hash:/etc/postfix/rbl_override,
check_recipient_mx_access hash:/etc/postfix/bogus_mx,
下列规则被添加到文件bogus_mx中:
54.159.98.68 REJECT
当我尝试通过 telnet 发送电子邮件时,它并没有被拒绝:
root@mailserver:~# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mail-front.kiusys.com ESMTP Postfix (Debian/GNU)
ehlo me
250-mail-front.kiusys.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: [email protected]
250 2.1.0 Ok
rcpt to: [email protected]
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: Test Telnet
Hello dear,
.
250 2.0.0 Ok: queued as D161160E5D
quit
221 2.0.0 Bye
Connection closed by foreign host.
系统信息:
root@mailserver:/etc/postfix# postconf mail_version
mail_version = 2.11.3
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.11 (jessie)
Release: 8.11
Codename: jessie
有任何想法吗??
问候,