Postfix REJECT(不是 BOUNCE)未知的虚拟别名

Dav*_*ave 5 postfix aliases

我们为多个托管域运行一个小型 postfix(和 dovecot)邮件服务器,使用虚拟别名映射并配置了 spamassassin。

最近很明显我们正在产生一些反向散射;垃圾邮件进入不存在的电子邮件地址,然后被退回给伪造的发件人。就我们的邮件服务器的声誉而言,这显然是一个问题,也意味着我们代表垃圾邮件发送者发送垃圾邮件。

我想要做的是更改后缀行为,以便在 SMTP 事务期间拒绝邮件,而不是从 MAILER-DAEMON 生成退回电子邮件。

我试过添加 local_recipient_maps ( http://www.postfix.org/LOCAL_RECIPIENT_README.html ),但这没有区别。我认为这是因为我使用的是 virtual_alias_maps(其他虚拟邮箱解决方案似乎也不适用于此处)。

postconf -n 生成:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = all
inet_protocols = all
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 0
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = verrotech.com
myhostname = mail.verrotech.com
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.domain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.domain.com/privkey.pem
smtpd_tls_security_level = may
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
Run Code Online (Sandbox Code Playgroud)

谢谢你。

NuT*_*TyX 8

经过一番研究,你的问题让我意识到我的邮件服务器也有同样的问题,所以首先,thanx。

其次,您应该注意,默认情况下,postfix 会阻止此类流量。在手册smtpd_reject_unlisted_recipient 中

smtpd_reject_unlisted_recipient (默认值:是)

请求 Postfix SMTP 服务器拒绝未知收件人地址的邮件,即使未指定明确的 reject_unlisted_recipient 访问限制。这可以防止 Postfix 队列被无法传递的 MAILER-DAEMON 消息填满。

那么,为什么您会收到250 OK未知目的地的邮件?由于这些行:

mydestination = $myhostname, localhost.$mydomain, localhost
virtual_alias_maps = hash:/etc/postfix/virtual

smtpd_reject_unlisted_recipient检查目的地邮件,但非常明确:

当地址与 virtual(5) 别名或 canonical(5) 映射匹配时,它总是被认为是“已知的”。

   The recipient domain matches $mydestination, $inet_interfaces or $proxy_interfaces, but the recipient is not listed in $local_recipient_maps, and $local_recipient_maps is not null.
   The recipient domain matches $virtual_alias_domains but the recipient is not listed in $virtual_alias_maps.
   The recipient domain matches $virtual_mailbox_domains but the recipient is not listed in $virtual_mailbox_maps, and $virtual_mailbox_maps is not null.
   The recipient domain matches $relay_domains but the recipient is not listed in $relay_recipient_maps, and $relay_recipient_maps is not null. 
Run Code Online (Sandbox Code Playgroud)

由于您mydestination不包括您的$mydomain(仅服务器名和本地主机)并且您没有任何*_domains地方,因此没有其他对“已知”目的地的检查。

您只需要添加:

virtual_alias_domains = $mydomain

重新加载后缀。(如果我正确设置了您的配置并且您的所有邮件都采用“user@domain.com”形式)


如果这不起作用,你可以试试这个:

smtpd_recipient_restrictions = permit_mynetworks、reject_unauth_destination、reject_unverified_recipient

注意:它将通过RCPT TO命令检查传入传出消息的目标是否确实存在。请谨慎使用,因为它会为每个新目的地建立额外的连接,并且需要一些时间来响应您的服务器处理的每封邮件(测试每个目的地可能需要几秒钟)。