Postfix拒绝(而不是BOUNCE)未知的虚拟别名

我们使用虚拟别名映射和spamassassinconfiguration,为许多托pipe域运行一个小的postfix(和dovecot)邮件服务器。

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

我想要做的是改变后缀的行为,以便在SMTP交易过程中拒绝邮件,而不是生成邮件forms的MAILER-DAEMON邮件。

我尝试添加local_recipient_maps( http://www.postfix.org/LOCAL_RECIPIENT_README.html ),但这没有什么区别。 我认为这是因为我正在使用virtual_alias_maps(而其他虚拟邮箱解决scheme似乎也不适用于此)。

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 

谢谢。

经过一番研究,你的问题让我意识到我在邮件服务器上遇到了同样的问题,首先,thanx。

其次,你应该注意到,默认情况下,后缀阻止这种stream量。 在手册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检查目标邮件,但具体而言:

当一个地址匹配一个虚拟(5)别名或一个规范(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. 

由于你的mydestination不包括你的$mydomain (只有服务器名和本地主机),你没有任何*_domains ,没有其他检查“已知”的目的地。

您只需要添加:

virtual_alias_domains = $ mydomain

一个重载后缀。 (如果我的configuration正确,所有的邮件都以“[email protected]”的forms出现)


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

smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination, reject_unverified_recipient

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

这个答案并不完全是你所要求的,但这就是我为自己的用例解决这个问题的方法。

抛弃反弹:

在/etc/postfix/main.cfg中,我有:

 2bounce_notice_recipient = devnull bounce_notice_recipient = devnull bounce_queue_lifetime = 0d delay_warning_time = 0h alias_maps = hash:/etc/postfix/aliases alias_database = hash:/etc/postfix/aliases 

在/ etc / postfix / aliases中,我有:

 devnull: /dev/null 

然后我运行:

 postmap aliases postfix reload 

最终的结果是反弹到/ dev / null。 它可能没有抓住所有的人,所以YMMV。 请让我知道这是否适合你。