![postfix:FQDN 临时查找失败](https://linux22.com/image/594223/postfix%EF%BC%9AFQDN%20%E4%B8%B4%E6%97%B6%E6%9F%A5%E6%89%BE%E5%A4%B1%E8%B4%A5.png)
我正在使用 dur.bounceme.net 的 FQDN,我想将其解析为 localhost。也就是说,我想将邮件发送到[电子邮件保护]传送至 user@localhost。
我尝试过Ubuntu 指南看起来有点绕圈子了。
root@dur:~#
root@dur:~# postfix stop
postfix/postfix-script: stopping the Postfix mail system
root@dur:~# postfix start
postfix/postfix-script: starting the Postfix mail system
root@dur:~# telnet dur.bounceme.net 25
Trying 127.0.1.1...
telnet: Unable to connect to remote host: Connection refused
root@dur:~#
root@dur:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 dur.bounceme.net ESMTP Postfix (Ubuntu)
ehlo dur
250-dur.bounceme.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:[email protected]
250 2.1.0 Ok
rcpt to:[email protected]
451 4.3.0 <[email protected]>: Temporary lookup failure
rcpt to:thufir@localhost
451 4.3.0 <thufir@localhost>: Temporary lookup failure
quit
221 2.0.0 Bye
Connection closed by foreign host.
root@dur:~#
root@dur:~# grep telnet /var/log/mail.log
Aug 28 00:24:45 dur postfix/smtpd[18256]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.0 <thufir@localhost>: Temporary lookup failure; from=<[email protected]> to=<thufir@localhost> proto=ESMTP helo=<dur>
Aug 28 00:24:58 dur postfix/smtpd[18256]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.0 <[email protected]>: Temporary lookup failure; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<dur>
Aug 28 00:54:55 dur postfix/smtpd[18825]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.0 <[email protected]>: Temporary lookup failure; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<dur>
Aug 28 00:55:08 dur postfix/smtpd[18825]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.0 <thufir@localhost>: Temporary lookup failure; from=<[email protected]> to=<thufir@localhost> proto=ESMTP helo=<dur>
root@dur:~#
root@dur:~# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
default_transport = smtp
home_mailbox = Maildir/
inet_interfaces = loopback-only
mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/conf.d/01-mail-stack-delivery.conf -m "${EXTENSION}"
mailbox_size_limit = 0
mailman_destination_recipient_limit = 1
mydestination = dur, dur.bounceme.net, localhost.bounceme.net, localhost
myhostname = dur.bounceme.net
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relay_domains = lists.dur.bounceme.net
relay_transport = relay
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/ssl-mail.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-mail.key
smtpd_tls_mandatory_ciphers = medium
smtpd_tls_mandatory_protocols = SSLv3, TLSv1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
transport_maps = hash:/etc/postfix/transport
root@dur:~#
答案1
首先,您错误地设置了 dur.bounceme.net 的别名 - 它尝试连接到 127.0.1.1 而不是 127.0.0.1。
其次,您需要告诉 postfix 它应该将哪个域视为本地域。您链接到的网页是关于设置邮件列表服务的;您应该查看 postfix 文档。有关如何让“假域”工作的信息,请访问自述文件。
答案2
好吧,我不确定我是否完全理解了 Jenny 给出的答案,这个问题是有缺陷的(当然)。解决方案是使用两个回送,这将实现所需的结果,如下所示:
thufir@dur:~$
thufir@dur:~$
thufir@dur:~$ swaks --to thufir@localhost
=== Trying localhost:25...
=== Connected to localhost.
<- 220 dur.bounceme.net ESMTP Postfix (Ubuntu)
-> EHLO dur.bounceme.net
<- 250-dur.bounceme.net
<- 250-PIPELINING
<- 250-SIZE 10240000
<- 250-VRFY
<- 250-ETRN
<- 250-STARTTLS
<- 250-ENHANCEDSTATUSCODES
<- 250-8BITMIME
<- 250 DSN
-> MAIL FROM:<[email protected]>
<- 250 2.1.0 Ok
-> RCPT TO:<thufir@localhost>
<- 250 2.1.5 Ok
-> DATA
<- 354 End data with <CR><LF>.<CR><LF>
-> Date: Sun, 08 Jun 2014 04:24:58 -0700
-> To: thufir@localhost
-> From: [email protected]
-> Subject: test Sun, 08 Jun 2014 04:24:58 -0700
-> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/
->
-> This is a test mailing
->
-> .
<- 250 2.0.0 Ok: queued as 2FDAB221E21
-> QUIT
<- 221 2.0.0 Bye
=== Connection closed with remote host.
thufir@dur:~$
thufir@dur:~$ swaks --to [email protected]
=== Trying dur.bounceme.net:25...
=== Connected to dur.bounceme.net.
<- 220 dur.bounceme.net ESMTP Postfix (Ubuntu)
-> EHLO dur.bounceme.net
<- 250-dur.bounceme.net
<- 250-PIPELINING
<- 250-SIZE 10240000
<- 250-VRFY
<- 250-ETRN
<- 250-STARTTLS
<- 250-ENHANCEDSTATUSCODES
<- 250-8BITMIME
<- 250 DSN
-> MAIL FROM:<[email protected]>
<- 250 2.1.0 Ok
-> RCPT TO:<[email protected]>
<- 250 2.1.5 Ok
-> DATA
<- 354 End data with <CR><LF>.<CR><LF>
-> Date: Sun, 08 Jun 2014 04:25:05 -0700
-> To: [email protected]
-> From: [email protected]
-> Subject: test Sun, 08 Jun 2014 04:25:05 -0700
-> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/
->
-> This is a test mailing
->
-> .
<- 250 2.0.0 Ok: queued as A7365221E21
-> QUIT
<- 221 2.0.0 Bye
=== Connection closed with remote host.
thufir@dur:~$
thufir@dur:~$
邮件至localhost
和 邮件至dur.bounceme.net
均已正确送达。
我不清楚 127.0.0.1 和 127.0.1.1 的环回之间的区别,因为:
IPv4 网络标准将整个 127.0.0.0/8 地址块保留用于环回。这意味着发送到这 16,777,214 个地址(127.0.0.1 至 127.255.255.254)之一的任何数据包都将被环回。
http://en.wikipedia.org/wiki/Localhost#Name_resolution
无论如何,具体的问题不是由 Postfix 或 Dovecot 引起的,因为它们是默认配置,而是由http://packages.ubuntu.com/trusty/mail-stack-delivery包,无需额外配置即可正常运行。
我不清楚为什么为本地主机保留特定的 IP 地址,但会进一步阅读。