我有一个真正的问题腌制:
我有一个Postfix 2.6.6 / CentOS 6服务器,可以将邮件从特定的别名转发到特定的目的地。 这是通过一个mysql的virtual_alias_maps表完成的,因为别名/目标是由基于web的前端生成的。
问题是, 有时和没有明显的原因 Postfix不打扰在virtual_alias_maps中查看,并给予某些别名的“中继访问被拒绝”状态。
我不能把它归结为configuration或数据库问题,因为在交付失败的时间:
postmap -q [email protected] mysql:/etc/postfix/mysql_virtual_alias_maps.cf ,即使在那个命令之前和之后,当telnet进入SMTP服务器时,我得到了同一地址的“中继访问被拒绝”。 postfix reload也不重启解决问题; 它似乎在任意时间自行解决,而且在两者之间的日志中没有任何明显的performance。 真正让我发疯的事情是,当我find几个不工作的地址的例子时,我可以find很多同时工作的地方。
在所有情况下,地址是@ mydomain.com AND都可以使用postmap -q成功查找。
我没有看到任何日志(mysql / postfix / syslog)中的任何故障。 看来,Postfix只是简单地将查询转换成虚拟别名映射。
Postfixdebugging日志(失败案例) :
May 28 16:37:39 ext-node01 postfix/smtpd[28115]: < debug_peer.something.com[64.34.10.20]: rcpt to:[email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: extract_addr: input: [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: smtpd_check_addr: [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: send attr request = rewrite May 28 16:37:39 ext-node01 postfix/smtpd[28115]: send attr rule = local May 28 16:37:39 ext-node01 postfix/smtpd[28115]: send attr address = [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: flags May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: flags May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute value: 0 May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: address May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: address May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute value: [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: (list terminator) May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: (end) May 28 16:37:39 ext-node01 postfix/smtpd[28115]: rewrite_clnt: local: [email protected] -> [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: send attr request = resolve May 28 16:37:39 ext-node01 postfix/smtpd[28115]: send attr sender = May 28 16:37:39 ext-node01 postfix/smtpd[28115]: send attr address = [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: flags May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: flags May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute value: 0 May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: transport May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: transport May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute value: smtp May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: nexthop May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: nexthop May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute value: mydomain.com May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: recipient May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: recipient May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute value: [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: flags May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: flags May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute value: 4096 May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: (list terminator) May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: (end) May 28 16:37:39 ext-node01 postfix/smtpd[28115]: resolve_clnt: `' -> `[email protected]' -> transp=`smtp' host=`mydomain.com' rcpt=`[email protected]' flags= class=default May 28 16:37:39 ext-node01 postfix/smtpd[28115]: ctable_locate: install entry key [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: extract_addr: in: [email protected], result: [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: send attr request = rewrite May 28 16:37:39 ext-node01 postfix/smtpd[28115]: send attr rule = local May 28 16:37:39 ext-node01 postfix/smtpd[28115]: send attr address = double-bounce May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: flags May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: flags May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute value: 0 May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: address May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: address May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute value: [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: private/rewrite socket: wanted attribute: (list terminator) May 28 16:37:39 ext-node01 postfix/smtpd[28115]: input attribute name: (end) May 28 16:37:39 ext-node01 postfix/smtpd[28115]: rewrite_clnt: local: double-bounce -> [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: >>> START Recipient address RESTRICTIONS <<< May 28 16:37:39 ext-node01 postfix/smtpd[28115]: generic_checks: name=permit_mynetworks May 28 16:37:39 ext-node01 postfix/smtpd[28115]: permit_mynetworks: debug_peer.something.com 64.34.10.20 May 28 16:37:39 ext-node01 postfix/smtpd[28115]: match_hostname: debug_peer.something.com ~? 127.0.0.0/8 May 28 16:37:39 ext-node01 postfix/smtpd[28115]: match_hostaddr: 64.34.10.20 ~? 127.0.0.0/8 May 28 16:37:39 ext-node01 postfix/smtpd[28115]: match_list_match: debug_peer.something.com: no match May 28 16:37:39 ext-node01 postfix/smtpd[28115]: match_list_match: 64.34.10.20: no match May 28 16:37:39 ext-node01 postfix/smtpd[28115]: generic_checks: name=permit_mynetworks status=0 May 28 16:37:39 ext-node01 postfix/smtpd[28115]: generic_checks: name=reject_unauth_destination May 28 16:37:39 ext-node01 postfix/smtpd[28115]: reject_unauth_destination: [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: permit_auth_destination: [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: ctable_locate: leave existing entry key [email protected] May 28 16:37:39 ext-node01 postfix/smtpd[28115]: NOQUEUE: reject: RCPT from debug_peer.something.com[64.34.10.20]: 450 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=SMTP helo=<fuack> May 28 16:37:39 ext-node01 postfix/smtpd[28115]: generic_checks: name=reject_unauth_destination status=2 May 28 16:37:39 ext-node01 postfix/smtpd[28115]: > debug_peer.something.com[64.34.10.20]: 450 4.7.1 <[email protected]>: Relay access denied
后缀debugging日志(成功案例)
May 28 17:14:20 ext-node01 postfix/smtpd[31233]: < debug_peer.something.com[64.34.10.20]: rcpt to:[email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: extract_addr: input: [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: smtpd_check_addr: [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: send attr request = rewrite May 28 17:14:20 ext-node01 postfix/smtpd[31233]: send attr rule = local May 28 17:14:20 ext-node01 postfix/smtpd[31233]: send attr address = [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: private/rewrite socket: wanted attribute: flags May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute name: flags May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute value: 0 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: private/rewrite socket: wanted attribute: address May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute name: address May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute value: [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: private/rewrite socket: wanted attribute: (list terminator) May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute name: (end) May 28 17:14:20 ext-node01 postfix/smtpd[31233]: rewrite_clnt: local: [email protected] -> [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: send attr request = resolve May 28 17:14:20 ext-node01 postfix/smtpd[31233]: send attr sender = May 28 17:14:20 ext-node01 postfix/smtpd[31233]: send attr address = [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: private/rewrite socket: wanted attribute: flags May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute name: flags May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute value: 0 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: private/rewrite socket: wanted attribute: transport May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute name: transport May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute value: error May 28 17:14:20 ext-node01 postfix/smtpd[31233]: private/rewrite socket: wanted attribute: nexthop May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute name: nexthop May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute value: User unknown in virtual alias table May 28 17:14:20 ext-node01 postfix/smtpd[31233]: private/rewrite socket: wanted attribute: recipient May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute name: recipient May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute value: [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: private/rewrite socket: wanted attribute: flags May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute name: flags May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute value: 512 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: private/rewrite socket: wanted attribute: (list terminator) May 28 17:14:20 ext-node01 postfix/smtpd[31233]: input attribute name: (end) May 28 17:14:20 ext-node01 postfix/smtpd[31233]: resolve_clnt: `' -> `[email protected]' -> transp=`error' host=`User unknown in virtual alias table' rcpt=`[email protected]' flags= class=alias May 28 17:14:20 ext-node01 postfix/smtpd[31233]: ctable_locate: install entry key [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: extract_addr: in: [email protected], result: [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: >>> START Recipient address RESTRICTIONS <<< May 28 17:14:20 ext-node01 postfix/smtpd[31233]: generic_checks: name=permit_mynetworks May 28 17:14:20 ext-node01 postfix/smtpd[31233]: permit_mynetworks: debug_peer.something.com 64.34.10.20 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: match_hostname: debug_peer.something.com ~? 127.0.0.0/8 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: match_hostaddr: 64.34.10.20 ~? 127.0.0.0/8 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: match_list_match: debug_peer.something.com: no match May 28 17:14:20 ext-node01 postfix/smtpd[31233]: match_list_match: 64.34.10.20: no match May 28 17:14:20 ext-node01 postfix/smtpd[31233]: generic_checks: name=permit_mynetworks status=0 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: generic_checks: name=reject_unauth_destination May 28 17:14:20 ext-node01 postfix/smtpd[31233]: reject_unauth_destination: [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: permit_auth_destination: [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: ctable_locate: leave existing entry key [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: generic_checks: name=reject_unauth_destination status=0 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: >>> END Recipient address RESTRICTIONS <<< May 28 17:14:20 ext-node01 postfix/smtpd[31233]: >>> CHECKING RECIPIENT MAPS <<< May 28 17:14:20 ext-node01 postfix/smtpd[31233]: ctable_locate: leave existing entry key [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: maps_find: recipient_canonical_maps: [email protected]: not found May 28 17:14:20 ext-node01 postfix/smtpd[31233]: match_string: mydomain.com ~? mx01.mail.myhosting.net May 28 17:14:20 ext-node01 postfix/smtpd[31233]: match_list_match: mydomain.com: no match May 28 17:14:20 ext-node01 postfix/smtpd[31233]: maps_find: recipient_canonical_maps: @mydomain.com: not found May 28 17:14:20 ext-node01 postfix/smtpd[31233]: mail_addr_find: [email protected] -> (not found) May 28 17:14:20 ext-node01 postfix/smtpd[31233]: maps_find: canonical_maps: [email protected]: not found May 28 17:14:20 ext-node01 postfix/smtpd[31233]: match_string: mydomain.com ~? mx01.mail.myhosting.net May 28 17:14:20 ext-node01 postfix/smtpd[31233]: match_list_match: mydomain.com: no match May 28 17:14:20 ext-node01 postfix/smtpd[31233]: maps_find: canonical_maps: @mydomain.com: not found May 28 17:14:20 ext-node01 postfix/smtpd[31233]: mail_addr_find: [email protected] -> (not found) May 28 17:14:20 ext-node01 postfix/smtpd[31233]: dict_mysql_get_active: attempting to connect to host 127.0.0.1 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: dict_mysql: successful connection to host 127.0.0.1 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: dict_mysql: successful query from host 127.0.0.1 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: dict_mysql_lookup: retrieved 1 rows May 28 17:14:20 ext-node01 postfix/smtpd[31233]: maps_find: virtual_alias_maps: mysql:/etc/postfix/mysql_virtual_alias_maps.cf(0,lock|fold_fix): [email protected] = [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: mail_addr_find: [email protected] -> [email protected] May 28 17:14:20 ext-node01 postfix/smtpd[31233]: smtpd_check_rewrite: trying: permit_inet_interfaces May 28 17:14:20 ext-node01 postfix/smtpd[31233]: permit_inet_interfaces: debug_peer.something.com 64.34.10.20 May 28 17:14:20 ext-node01 postfix/smtpd[31233]: before input_transp_cleanup: cleanup flags = enable_header_body_filter enable_automatic_bcc enable_address_mapping enable_milters May 28 17:14:20 ext-node01 postfix/smtpd[31233]: after input_transp_cleanup: cleanup flags = enable_header_body_filter enable_automatic_bcc enable_address_mapping May 28 17:14:20 ext-node01 postfix/smtpd[31233]: connect to subsystem public/cleanup May 28 17:14:21 ext-node01 postfix/smtpd[31233]: public/cleanup socket: wanted attribute: queue_id May 28 17:14:21 ext-node01 postfix/smtpd[31233]: input attribute name: queue_id May 28 17:14:21 ext-node01 postfix/smtpd[31233]: input attribute value: 012DCF8003F May 28 17:14:21 ext-node01 postfix/smtpd[31233]: public/cleanup socket: wanted attribute: (list terminator) May 28 17:14:21 ext-node01 postfix/smtpd[31233]: input attribute name: (end) May 28 17:14:21 ext-node01 postfix/smtpd[31233]: send attr flags = 178 May 28 17:14:21 ext-node01 postfix/smtpd[31233]: 012DCF8003F: client=debug_peer.something.com[64.34.10.20] May 28 17:14:21 ext-node01 postfix/smtpd[31233]: > debug_peer.something.com[64.34.10.20]: 250 2.1.5 Ok
请注意,这些日志片段上的时间戳大约相隔37分钟。 在那段时间,我正在倾倒日志, 而不是进行configuration更改。
同样,在两个日志片段之前和之后:
postmap -q [email protected] mysql:/etc/postfix/mysql_virtual_alias_maps.cf [email protected]
服务器处于低负载状态。 可能每分钟大约2-3次SMTP会话。
除了我自己的testing之外,我在日志中看到有效收件人和有效发件人的相同行为,中继访问将被拒绝几次(如上游SMTP服务器重试发送),然后在没有干预的情况下突然成功。
我将拒绝状态设置为软失败(4xx)作为临时措施,以便其他SMTP服务器将随时间重试。
我还设置了一个cron作业,每5分钟做一次postfix reload ,但仍然在野外观察,这没有帮助。
任何关于下一步的build议都会受到欢迎。 谢谢!
编辑: postconf -n的输出postconf -n :
access_map_reject_code = 450 alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix content_filter = amavisfeed:[127.0.0.1]:10024 daemon_directory = /usr/libexec/postfix debug_peer_level = 2 debug_peer_list = 64.34.10.20 html_directory = no inet_interfaces = localhost, 192.168.1.1 //SANITIZED IP inet_protocols = ipv4 mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man maps_rbl_reject_code = 450 mydestination = mx01.mail.myhosting.net //SANITIZED HOST myhostname = mx01.mail.myhosting.net //SANITIZED HOST mynetworks = 127.0.0.0/8 newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES reject_code = 450 relay_domains = mysql:/etc/postfix/mysql_relay_domains.cf relay_domains_reject_code = 450 sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtp_host_lookup = native smtpd_client_connection_count_limit = 10 smtpd_error_sleep_time = 1s smtpd_hard_error_limit = 20 smtpd_soft_error_limit = 10 transport_maps = mysql:/etc/postfix/mysql_transport_maps.cf unknown_local_recipient_reject_code = 450 unknown_relay_recipient_reject_code = 450 unknown_virtual_alias_reject_code = 450 unknown_virtual_mailbox_reject_code = 450 virtual_alias_domains = mysql:/etc/postfix/mysql_virtual_alias_domains.cf virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf