Postfix 临时查找失败

Postfix 临时查找失败

我正在尝试设置 Postfix,但收到“临时查找失败”错误

主文件:

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

虚拟邮箱:

[email protected]      dzervas.gr/dzervas
[email protected]          dzervas.gr/dna
[email protected]  ns0.dzervas.gr/dzervas

值:

[email protected]    [email protected]
[email protected]   [email protected]
[email protected]   [email protected]
#[email protected] [email protected]

通用的:

[email protected]      root

telnet测试:

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: [email protected]
250 2.1.0 Ok
 rcpt to: [email protected]
451 4.3.0 <[email protected]>: 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 "[email protected]"
May 09 15:09:43 ns0 postfix/smtpd[7754]: NOQUEUE: reject: RCPT from <client-ip>: 451 4.3.0 <[email protected]>: Temporary lookup failure; from=<[email protected]> to=<[email protected]> 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: [email protected]
550 5.1.1 <[email protected]>: 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通过local_recipient_maps =在 main.cf 中设置解决了这个问题,但是现在我的邮件[电子邮件保护]排队!它没有像应该的那样进入 /var/mail/vmail/dzervas.gr/dzervas/!

答案1

运行newaliases。如果 /etc/aliases 不存在,则先创建它,然后运行newaliases​​。
也可以更新/添加alias_maps = hash:/etc/aliases到 /etc/postfix/main.cf 以消除其他警告。
然后再试一次。
(如果您使用 telnet 进行测试,则不需要有效的 DNS)。


第二个问题:首先$myhostname, $mydomain,从 中删除mydestination,因为虚拟域不应列在此处。
然后添加(到 main.cf):

virtual_mailbox_domains=dzervas.gr

重新加载 postfix 并重试。

答案2

mynetworks 需要严格的网络范围

就我的情况而言,有一个错误的 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 postfix/smtpd[25056]: 警告:“172.16.0.0/8”中的非空主机地址位,也许您应该改用“172.0.0.0/8”

如果有人通过 google 的热门搜索来到这里Temporary lookup failure,我想说请仔细检查你的$mynetworks格式。

答案3

我的看法:

我确实更改了 main.conf,但我忘了重新加载 postfix。

重新加载后它就起作用了。

答案4

就我而言,“临时查找失败”问题的原因是我开始使用聚合酶链反应我的配置中的表:

mydestination = $myhostname,
   pcre:/etc/postfix/local-host-patterns,
   $mydomain, 
   localhost.$mydomain,
   localhost

事实证明我从未安装过该postfix-pcre软件包。在 RHEL 风格的发行版中,可以使用以下命令安装

dnf install postfix-pcre

相关内容