所以我有一个后缀继电器适用于我的第一台机器(SLE12 SP5),但不适用于我的第二台机器(SLE12 SP4)。两台机器都在同一个域中,它们也在同一个本地网络和同一个子网中。
该/etc/hosts
文件都充满了继电器:
(postfix's ip) postfix.local-domain.com postfix external-domain.com
该resolv.conf
文件都填充了正确的域:
domain local-domain.com
search local-domain.com
两者都有通过本地网络的默认路由:
ip route show
default via (subnet gateway) dev eth0
(subnet ip/mask) dev eth0 proto kernel scope link src (machine's ip)
这是我正在使用的命令:
echo "This is first machine" | mailx -s "This is Subject" -S smtp="postfix" -v [email protected]
第一台机器上的结果:
Resolving host postfix . . . done.
Connecting to (postfix's ip):smtp . . . connected.
220 postfix.local-domain.com ESMTP Postfix
>>> HELO firstmachine.local-domain.com
250 postfix.local-domain.com
>>> 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>
>>> .
250 2.0.0 Ok: queued as 6B5954D443
>>> QUIT
221 2.0.0 Bye
第二台机器上的相同命令:
echo "This is second machine" | mailx -s "This is Subject" -S smtp="postfix" -v [email protected]
第二台机器上的结果:
Resolving host postfix . . . done.
Connecting to (postfix's ip):smtp . . . connected.
220 postfix.local-domain.com ESMTP Postfix
>>> HELO secondmachine.local-domain.com
250 postfix.local-domain.com
>>> MAIL FROM:<[email protected]>
250 2.1.0 Ok
>>> RCPT TO:<[email protected]>
554 5.7.1 <[email protected]>: Relay access denied
smtp-server: 554 5.7.1 <[email protected]>: Relay access denied
"/root/dead.letter" 11/361
. . . message not sent.
/root/dead.letter 文件的内容:
This is second machine
Date: Wed, 23 Jun 2021 11:34:01 +0200
From: [email protected]
To: [email protected]
Subject: This is Subject
Message-ID: <60d30009.yXYpk0su5Y1hKjCx%[email protected]>
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
我在这里错过了什么吗?我仍在学习,所以请随时分享您的知识!
答案1
我正在回答我自己的帖子,以防有人遇到同样的情况。
所以我发现有一个文件允许机器连接或不连接。
在main.cf
文件中:
smtpd_client_restrictions = check_client_access hash:/etc/postfix/maps/access_client
在/etc/postfix/maps/access_client
文件中:
(second machine's ip) OK
然后输入以下命令:
postmap hash:/etc/postfix/maps/access_client
然后重新启动 postfix 服务:
service postfix restart
为我工作