Sendmail 不会伪装主机名.域组合

Sendmail 不会伪装主机名.域组合

我的 MASQUERADE 设置如下...

dnl # Also accept email sent to "localhost.localdomain" as local email.
dnl #
LOCAL_DOMAIN(`localhost.localdomain')dnl
dnl #
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
MASQUERADE_AS(`wantedomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
FEATURE(masquerade_entire_domain)dnl
dnl #
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MASQUERADE_DOMAIN(localhost02.ux.com.tus)dnl
MASQUERADE_DOMAIN(localhost02)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl

我的 hosts 文件包含...

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.101.129 localhost02.ux.com.tus localhost02
[root@localhost02 mail]# hostname -s
localhost02
[root@localhost02 mail]# hostname -f
localhost02.ux.com.tus
[root@localhost02 mail]#

当我尝试发送邮件时,sendmail 会不断尝试使用 localhost02.ux.com.tus 发送该邮件,并且不会考虑 MASQUERADING 设置(我期望[电子邮件保护]作为发件人)...

[root@localhost02 mail]# mail [email protected]
Subject: TEST
Hello World.
.
EOT
[root@localhost02 mail]# mailq
        /var/spool/mqueue (1 request)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
20JB4OZi054827*      13 Wed Jan 19 12:04 <[email protected]>
                                         <[email protected]>
        Total requests: 1

任何帮助将非常感激!

20222.01.27 - 更新

我创建了一个简短的 shell 脚本,包含以下内容...

#!/bin/sh
[email protected]
[email protected]

/usr/sbin/sendmail -i -v -Am -f$SENDER $RECIPIENT <<END
Subject: TEST
From: $SENDER

Hello World.
END

执行 shell 脚本后,我仍然收到来自 SMTP 服务器的超时错误...

[root@localhost02 mail]# ./sendmail.sh
[email protected]... Connecting to email-smtp.eu-central-1.amazonaws.com. port 587 via relay...
[email protected]... Deferred: Connection timed out with email-smtp.eu-central-1.amazonaws.com.
[root@localhost02 mail]# mailq
        /var/spool/mqueue (6 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
20R7JX1b017298       13 Thu Jan 27 08:19 [email protected]
                 (Deferred: Connection timed out with email-smtp.eu-central-1.)
                                         [email protected]

但是通过端口 587 到服务器的 telnet 连接看起来正常......

[root@localhost02 mail]# telnet email-smtp.eu-central-1.amazonaws.com 587
Trying 172.27.1.14...
Connected to email-smtp.eu-central-1.amazonaws.com.
Escape character is '^]'.
220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-B4HOZL4HF JJQ6jMD4ztoBhcmitWhE
451 4.4.2 Timeout waiting for data from client.
Connection closed by foreign host.
[root@localhost02 mail]#

...最后是 /var/log/maillog 文件的内容...

Jan 27 08:19:33 localhost02 sendmail[17298]: 20R7JX1b017298: [email protected], size=57, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Jan 27 08:25:33 localhost02 sendmail[17298]: 20R7JX1b017298: [email protected], [email protected] (0/0), delay=00:06:00, xdelay=00:06:00, mailer=relay, pri=30057, relay=email-smtp.eu-central-1.amazonaws.com. [18.158.92.82], dsn=4.0.0, stat=Deferred: Connection timed out with email-smtp.eu-central-1.amazonaws.com.

答案1

您的 MASQUERADE_DOMAIN 必须只是您想要传递的内容,与 MASQUERADE_AS 匹配,而不是您想要更改的域。下面是我配置的方式,它有效。

MASQUERADE_AS( wantedomain.com')dnl MASQUERADE_DOMAIN (wantedomain.com')dnl FEATURE(masquerade_envelope)dnl FEATURE(masquerade_entire_domain)dnl

您可能还想添加智能中继,并指定配置的域名,但我建议测试两种方式以查看差异,发送到外部地址并检查邮件日志以查看其如何中继(如果这对您很重要)。

定义(SMART_HOST',smtp.lynden.com')dnl 定义(confDOMAIN_NAME',lynden.com')dnl

相关内容