在我公司的基础设施中,我有一个内部邮件服务器,其名称是srv-internal.central.mydomain.tld ,其内部IP为10.10.128.200。
为了与networking交换邮件,它使用中继邮件服务器 (DMZ环境中的服务器,例如所有需要的针孔),即使使用postfix,其名称为mailgw.central.mydomain.tld ,内部接口IP为10.10。 133.105
我们基础设施的公有域名是(比如说)“ central.mydomain.tld ”, 但是“ pec.central.mydomain.tld ”不是我们的子域名 。 它是由我们的networking外的另一个ISP提供的(所以,邮件到这个域,必须出去)。
如果我从[email protected] (从srv-internal.central.mydomain.tld机器)发送一个邮件到[email protected] ,我从中继服务器得到以下错误:
Sep 4 08:03:16 mailgw postfix/smtpd[26678]: NOQUEUE: reject: RCPT from unknown[10.10.128.200]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in relay recipient table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<srv-internal.central.mydomain.tld> Sep 4 08:03:16 mailgw postfix/smtpd[26678]: disconnect from unknown[10.10.128.200]
我的中继服务器在Linux CentOS版本5.7上,postfix版本是标准CentOS版本库中的postfix-2.3.3-2.1.el5_2。
假设我的域名是:
mydomain = central.mydomain.tld
而我的中继服务器上的后缀configuration,目前如下:
(postconf -d; postconf -d; postconf -n;)| sorting| 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
这是我的/ 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]
现在, 收件人地址被拒绝:中继收件人表中的用户未知似乎是中继服务器(mailgw)“认为”“pec.central.mydomain.tld”是其子域之一,因此它search收件人用户到其relay_recipient_maps,而它不应该恕我直言。
我期望这种行为,如果我把“.central.mydomain.tld”(与初始点!)在我的运输表,但我真的有“central.mydomain.tld”,所以,阅读手册,它应该只考虑域名,而不是子域名。
我非常感谢,如果有人可以build议我做错了什么。
你应该知道的参数是parent_domain_matches_subdomains 。
模式“example.com”也与example.com的子域匹配的Postfixfunction列表,而不是需要明确的“.example.com”模式。 这是计划向后兼容:最终,所有的Postfixfunction预计需要明确的“.example.com”样式模式,当你真的想要匹配的子域名。
因此,parent_domain_matches_subdomains拥有后缀应该与其子域名匹配的域名列表,即使前面没有(dot)也是如此 。
不幸的是, 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
而且因为你的relay_domains包含$mydomain或者central.mydomain.tld ,所以postfix将central.mydomain.tld的所有子域匹配为relay_domains而不是外部子域。
解决方法是设置parent_domain_matches_subdomains并且不包括这些参数上的relay_domains。