Postfix

Postfix 臨時查找失敗

  • January 8, 2021

我正在嘗試設置後綴,但出現“臨時查找失敗”錯誤

main.cf:

inet_protocols = ipv4
inet_interfaces = all

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
mail_owner = postfix

myhostname = ns0.dzervas.gr
mydomain = dzervas.gr
myorigin = dzervas.gr
mynetworks_style = host
mydestination = localhost, localhost.$mydomain, $myhostname, $mydomain, mail.$mydomain, www.$mydomain

virtual_mailbox_base = /var/mail/vhost
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 1000
virtual_uid_maps = static:2000
virtual_gid_maps = static:2000
virtual_alias_maps = hash:/etc/postfix/valias

smtp_generic_maps = hash:/etc/postfix/generic

郵箱:

dzervas@dzervas.gr      dzervas.gr/dzervas
dna@dzervas.gr          dzervas.gr/dna
dzervas@ns0.dzervas.gr  ns0.dzervas.gr/dzervas

將要:

webmaster@dzervas.gr    dzervas@dzervas.gr
hostmaster@dzervas.gr   dzervas@dzervas.gr
postmaster@dzervas.gr   dzervas@dzervas.gr
#dzervas@ns0.dzervas.gr dzervas@dzervas.gr

通用的:

dzervas@dzervas.gr      root

遠端登錄測試:

Trying <ip>...
Connected to <ip>.
Escape character is '^]'.
220 ns0.dzervas.gr ESMTP Postfix
ehlo test.com
250-ns0.dzervas.gr
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: testing@test.com
250 2.1.0 Ok
rcpt to: dzervas@dzervas.gr
451 4.3.0 <dzervas@dzervas.gr>: Temporary lookup failure
quit
221 2.0.0 Bye
Connection closed by foreign host.

journalctl 報告:

May 09 15:09:22 ns0 postfix/smtpd[7754]: error: open database /etc/aliases.db: No such file or directory
May 09 15:09:22 ns0 postfix/smtpd[7754]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 09 15:09:22 ns0 postfix/smtpd[7754]: connect from <client-ip>
May 09 15:09:43 ns0 postfix/smtpd[7754]: warning: hash:/etc/aliases is unavailable. open database /etc/aliases.db: No such file or directory
May 09 15:09:43 ns0 postfix/smtpd[7754]: warning: hash:/etc/aliases lookup error for "dzervas@dzervas.gr"
May 09 15:09:43 ns0 postfix/smtpd[7754]: NOQUEUE: reject: RCPT from <client-ip>: 451 4.3.0 <dzervas@dzervas.gr>: Temporary lookup failure; from=<testing@test.com> to=<dzervas@dzervas.gr> proto=ESMTP helo=<test.com>
May 09 15:09:52 ns0 postfix/smtpd[7754]: disconnect from <client-ip>

我應該指出我還沒有設置 DNS 記錄(dzervas.gr 還沒有指向我的新伺服器)而且我在 arch linux x86_64

編輯:我創建了一個空的 /etc/aliases,然後創建了newaliases 新問題(在 telnet 中):

rcpt to: dzervas@dzervas.gr
550 5.1.1 <dzervas@dzervas.gr>: Recipient address rejected: User unknown in local recipient table

但!:

rcpt to: root@localhost
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
hhahahahha
.
250 2.0.0 Ok: queued as <some-code>

編輯 2:Recipient address rejected: User unknown in local recipient table通過在 main.cf 中設置解決了local_recipient_maps =然而,現在我發給 dzervas@dzervas.gr 的郵件排隊了!它沒有像它應該的那樣進入 /var/mail/vmail/dzervas.gr/dzervas/ !

執行newaliases。如果 /etc/aliases 不存在,則先創建它,然後執行newaliases.

也可能更新/添加alias_maps = hash:/etc/aliases到 /etc/postfix/main.cf 以消除其他警告。

然後再試一次。

(如果您使用 telnet 進行測試,則不需要使用 DNS)。


第 2 期:首先從 中刪除$myhostname, $mydomain,mydestination因為此處不應列出虛擬域。

然後添加(到 main.cf):

virtual_mailbox_domains=dzervas.gr

重新載入後綴並重試。

mynetworks 需要嚴格的網路範圍

就我而言,.ip 中的 IP 範圍有誤/etc/postfix/main.cf

# Wrong; Temporary lookup failure
mynetworks = 172.16.0.0/8
# OK
mynetworks = 172.16.0.0/12

/var/log/maillog我後來注意到了一個錯誤。

10 月 4 日 13:47:54 後綴/smtpd

$$ 25056 $$:警告:“172.16.0.0/8”中的非空主機地址位,也許您應該改用“172.0.0.0/8”

如果有人從Google的熱門搜尋中來到這裡Temporary lookup failure,我會說請檢查您的$mynetworks格式。

引用自:https://serverfault.com/questions/506347