后缀:收件人地址被拒绝:本地收件人表中的用户未知,即使收件人域是外部域

gab*_*der 9 postfix

在我公司的基础设施中,我有一个带有 postfix 的内部邮件服务器,它的名称是srv-internal.central.mydomain.tld,内部 IP 为 10.10.128.200。

为了与网络交换邮件,它使用中继邮件服务器(DMZ 环境中的服务器,具有所有需要的针孔,例如..),甚至使用 postfix,其名称为mailgw.central.mydomain.tld,内部接口 IP 为 10.10。 133.105

我们基础设施的公共域名是(比如说)“ central.mydomain.tld ”,但“ pec.central.mydomain.tld ”不是我们的子域。它由我们网络之外的另一个 ISP 提供(因此,向该域发送邮件,必须退出)。

如果我从user1@central.mydomain.tld(从 srv-internal.central.mydomain.tld 机器)向foo@pec.central.mydomain.tld发送邮件,我从中继服务器收到以下错误:

Sep  4 08:03:16 mailgw postfix/smtpd[26678]: NOQUEUE: reject: RCPT from unknown[10.10.128.200]: 550 5.1.1 <foo@pec.central.mydomain.tld>: Recipient address rejected: User unknown in relay recipient table; from=<user1@central.mydomain.tld> to=<foo@pec.central.mydomain.tld> proto=ESMTP helo=<srv-internal.central.mydomain.tld>
Sep  4 08:03:16 mailgw postfix/smtpd[26678]: disconnect from unknown[10.10.128.200]
Run Code Online (Sandbox Code Playgroud)

我的中继服务器在 Linux CentOS 版本 5.7 上,postfix 版本是来自标准 CentOS 存储库的 postfix-2.3.3-2.1.el5_2。

假设我的域是:

 mydomain = central.mydomain.tld
Run Code Online (Sandbox Code Playgroud)

我在中继服务器上的后缀配置,目前如下:

(postconf -d; postconf -d; postconf -n; ) | 排序 | uniq -u

alias_maps = hash:/etc/aliases
biff = no
body_checks = regexp:/etc/postfix/body_checks
content_filter = filter:127.0.0.1:10025
default_process_limit = 10
disable_vrfy_command = yes
header_checks = pcre:/etc/postfix/header_checks
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 12582912
mime_header_checks = regexp:/etc/postfix/mime_header_checks
mydestination = $myhostname, localhost.$mydomain
myhostname = mailgw.$mydomain
mynetworks = 127.0.0.0/8, 10.10.24.0/24, 10.10.128.200/32, 10.10.128.201/32
newaliases_path = /usr/bin/newaliases.postfix
readme_directory = /etc/postfix/README_FILES
receive_override_options = no_address_mappings
relay_domains = $mydomain, riminiventure.it
relay_recipient_maps = hash:/etc/postfix/relay_recipients
sample_directory = /etc/postfix/samples
sendmail_path = /usr/sbin/sendmail.postfix
smtpd_error_sleep_time = 5s
smtpd_hard_error_limit = 10
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_mynetworks,    permit_sasl_authenticated,    check_client_access hash:/etc/postfix/access_client,    check_helo_access hash:/etc/postfix/access_helo,    check_sender_access hash:/etc/postfix/access_sender, pcre:/etc/postfix/access_sender_pcre,    check_recipient_access hash:/etc/postfix/access_recipient,    reject_unauth_destination,    reject_invalid_hostname,    reject_unauth_pipelining,    reject_non_fqdn_sender,    reject_unknown_sender_domain,    reject_non_fqdn_recipient,    reject_unknown_recipient_domain,    reject_rbl_client bl.spamcop.net,    reject_rbl_client sbl.spamhaus.org,  check_policy_service inet:127.0.0.1:2501,    permit
smtpd_soft_error_limit = 3
strict_rfc821_envelopes = yes
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 450
virtual_alias_domains = riminifar.it
virtual_alias_maps = hash:/etc/postfix/virtual
Run Code Online (Sandbox Code Playgroud)

这是我的 /etc/postfix/transport:

central.mydomain.tld        smtp:[srv-internal.central.mydomain.tld]
someotherdomain.org         smtp:[srv-internal.central.mydomain.tld]
yadomain.it                  smtp:[srv-internal.central.mydomain.tld]
xad.central.mydomain.tld        smtp:[srv-internal.central.mydomain.tld]
test.central.mydomain.tld        smtp:[10.10.15.101]
Run Code Online (Sandbox Code Playgroud)

现在,收件人地址被拒绝:中继收件人表中的用户未知似乎中继服务器(mailgw)“认为”“pec.central.mydomain.tld”是其子域之一,因此它在其relay_recipient_maps中搜索收件人用户,而它不应该恕我直言。

如果我将“.central.mydomain.tld”(带有初始点!)放在我的传输表中,我预计会出现这种行为,但我确实有“central.mydomain.tld”,因此,阅读手册时,它应该只考虑域名,而不是子域。

如果有人可以建议我做错了什么,我将不胜感激。

mas*_*oeh 6

您应该注意的参数是parent_domain_matches_subdomains

Postfix 功能列表,其中模式“example.com”也匹配 example.com 的子域,而不需要明确的“.example.com”模式。这是计划向后兼容性:最终,当您真正想要匹配子域时,所有 Postfix 功能都需要明确的“.example.com”样式模式。

因此, parent_domain_matches_subdomains 包含后缀应该与其子域匹配的域列表,即使它前面没有(点)

不幸的是,该relay_domains参数落入了该列表。

# postconf parent_domain_matches_subdomains
parent_domain_matches_subdomains = debug_peer_list,fast_flush_domains,mynetworks,permit_mx_backup_networks,qmqpd_authorized_clients,relay_domains,smtpd_access_maps
Run Code Online (Sandbox Code Playgroud)

而且因为你的relay_domains包含$mydomaincentral.mydomain.tld,后缀的所有子域名匹配central.mydomain.tld作为relay_domains不对外的。


解决方案已设置,parent_domain_matches_subdomains并且不在这些参数中包含relay_domains。