Sendmail SMTP“我的不合格主机名”和“我的不合格域名”

Sendmail SMTP“我的不合格主机名”和“我的不合格域名”

最近,我在名为“ironfist-droplet”的服务器上为我的网站 (ironfi.st) 设置了 SMTP 邮件服务器。我正在使用 WP-SMTP-MAIL 插件。我已经设置了 apache2 服务器并正确配置了所有内容。使用:并且电子邮件将从服务器完美地发送到我的。但是,当使用我的 WP-MAIL-SMTP 插件发送测试电子邮件时,它不会发送。echo "Subject: sendmail test" | sendmail -v [email protected]

这让我相信主机文件可能存在问题,下面/etc/hosts是我在主机文件中输入的内容:

127.0.0.1 localhost localhost.localdomain 192.168.1.10 ironfist-droplet ironfist-droplet.ironfi.st ironfi.st

以下是我的邮件日志文件:

Feb 17 10:59:18 ironfist-droplet sendmail[3223]: v1HFxI2U003223: from=root, size=196, class=0, nrcpts=1, msgid=<201702171559.v1HFxI2U003223@ironfist-droplet>, relay=root@localhost
Feb 17 10:59:18 ironfist-droplet sm-mta[3225]: v1HFxIYv003225: from=<root@ironfist-droplet>, size=455, class=0, nrcpts=1, msgid=<201702171559.v1HFxI2U003223@ironfist-droplet>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Feb 17 10:59:18 ironfist-droplet sendmail[3223]: v1HFxI2U003223: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30196, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v1HFxIYv003225 Message accepted for delivery)
Feb 17 10:59:18 ironfist-droplet sm-mta[3226]: v1HFxIYv003225: to=<root@ironfist-droplet>, ctladdr=<root@ironfist-droplet> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30682, dsn=2.0.0, stat=Sent
Feb 17 11:04:35 ironfist-droplet sendmail[3261]: v1HG4ZrO003261: from=root, size=196, class=0, nrcpts=1, msgid=<201702171604.v1HG4ZrO003261@ironfist-droplet>, relay=root@localhost
Feb 17 11:04:35 ironfist-droplet sm-mta[3263]: v1HG4ZWL003263: from=<root@ironfist-droplet>, size=455, class=0, nrcpts=1, msgid=<201702171604.v1HG4ZrO003261@ironfist-droplet>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Feb 17 11:04:35 ironfist-droplet sendmail[3261]: v1HG4ZrO003261: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30196, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v1HG4ZWL003263 Message accepted for delivery)
Feb 17 11:04:35 ironfist-droplet sm-mta[3264]: v1HG4ZWL003263: to=<root@ironfist-droplet>, ctladdr=<root@ironfist-droplet> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30682, dsn=2.0.0, stat=Sent
Feb 17 11:04:48 ironfist-droplet sendmail[3269]: v1HG4mAm003269: from=root, size=196, class=0, nrcpts=1, msgid=<201702171604.v1HG4mAm003269@ironfist-droplet>, relay=root@localhost
Feb 17 11:04:48 ironfist-droplet sm-mta[3271]: v1HG4muh003271: from=<root@ironfist-droplet>, size=455, class=0, nrcpts=1, msgid=<201702171604.v1HG4mAm003269@ironfist-droplet>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Feb 17 11:04:48 ironfist-droplet sendmail[3269]: v1HG4mAm003269: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30196, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v1HG4muh003271 Message accepted for delivery)
Feb 17 11:04:48 ironfist-droplet sm-mta[3272]: v1HG4muh003271: to=<root@ironfist-droplet>, ctladdr=<root@ironfist-droplet> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30682, dsn=2.0.0, stat=Sent
Feb 18 09:39:26 ironfist-droplet sendmail[9396]: v1IEdQfV009396: from=root, size=14, class=0, nrcpts=2, msgid=<[email protected]>, relay=root@localhost
Feb 18 09:39:26 ironfist-droplet sm-mta[9397]: v1IEdQrA009397: from=<[email protected]>, size=305, class=0, nrcpts=2, msgid=<[email protected]>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Feb 18 09:39:26 ironfist-droplet sm-mta[9397]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Feb 18 09:39:27 ironfist-droplet sm-mta[9397]: v1IEdQrA009397: to=<[email protected]>, delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=60305, relay=gmail-smtp-in.l.google.com. [173.194.204.26], dsn=2.0.0, stat=Sent (OK 1487428767 a63si3981733qkb.149 - gsmtp)
Feb 18 09:43:27 ironfist-droplet sm-mta[9397]: v1IEdQrA009397: to=<[email protected]>, delay=00:04:01, xdelay=00:04:00, mailer=esmtp, pri=60305, relay=ironfist-droplet.ironfi.st. [192.168.1.10], dsn=4.0.0, stat=Deferred: Connection timed out with ironfist-droplet.ironfi.st.
Feb 18 09:43:27 ironfist-droplet sendmail[9396]: v1IEdQfV009396: to=Example,[email protected], ctladdr=root (0/0), delay=00:04:01, xdelay=00:04:01, mailer=relay, pri=60014, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v1IEdQrA009397 Message accepted for delivery)
Feb 18 09:55:23 ironfist-droplet sm-mta[9426]: v1IEdQrA009397: to=<[email protected]>, delay=00:15:57, xdelay=00:04:15, mailer=esmtp, pri=150305, relay=ironfist-droplet.ironfi.st. [192.168.1.10], dsn=4.0.0, stat=Deferred: Connection timed out with ironfist-droplet.ironfi.st.

正如您所看到的,它正在尝试连接到ironfist-droplet.ironfi.st我放入的内容/etc/hosts并超时。

以下是我的邮件错误日志的附件:

Jan 24 23:21:47 ironfist-droplet sendmail[2417]: My unqualified host name (ironfist-droplet) unknown; sleeping for retry
Jan 24 23:22:47 ironfist-droplet sendmail[2417]: unable to qualify my own domain name (ironfist-droplet) -- using short name
Jan 24 23:22:47 ironfist-droplet sm-mta[2486]: My unqualified host name (ironfist-droplet) unknown; sleeping for retry
Jan 24 23:22:50 ironfist-droplet sm-msp-queue[2491]: My unqualified host name (ironfist-droplet) unknown; sleeping for retry
Jan 24 23:23:47 ironfist-droplet sm-mta[2486]: unable to qualify my own domain name (ironfist-droplet) -- using short name
Jan 24 23:23:50 ironfist-droplet sm-msp-queue[2491]: unable to qualify my own domain name (ironfist-droplet) -- using short name

如上所示,在确定ironfist-droplet下的主机名和域名时遇到问题。我对此很陌生,并接受了设置 SMTP 服务器的任务作为挑战自己和获得经验的一种方式。我对这一切都很陌生。然而,根据这些证据,我得出的结论是,我将信息放入主机文件的方式有问题。不过,有两条信息我很肯定:

主机名是ironfist-droplet,hostname -f返回ironfist-droplet,第二行中的私有IP是正确的,hostname -i返回192.168.1.10。我在网上查看过,但无法找到某人的主机文件与我的主机文件的良好比较。

如果有人发现我放入主机文件的方式有任何错误或问题的解决方案,请随时告诉我。感谢所有帮助。

完整主机文件:

# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
#     /etc/cloud/cloud.cfg or cloud-config from user-data
127.0.0.1 localhost localhost.localdomain
192.168.1.10 ironfist-droplet ironfist-droplet.ironfi.st ironfi.st

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

域名信息:

Version 8.14.4
 Compiled with: DNSMAP LDAPMAP LDAP_REFERRALS LOG MAP_REGEX MATCHGECOS
        MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6 NETUNIX
        NEWDB NIS NISPLUS PIPELINING SASLv2 SCANF SOCKETMAP STARTTLS
        TCPWRAPPERS USERDB USE_LDAP_INIT XDEBUG

============ SYSTEM IDENTITY (after readcf) ============
      (short domain name) $w = ironfist-droplet
  (canonical domain name) $j = ironfist-droplet.ironfi.st
         (subdomain name) $m = ironfi.st
              (node name) $k = ironfist-droplet
========================================================

答案1

通常,完全限定的主机名应首先列出/etc/hosts,例如

192.0.2.0 foo.example.org foo bar

系统主机名同样应该是完全限定的。 Sendmail(很可能还有它可能与之通信的大多数远程 MTA)将非常不高兴,除非在所有地方都设置了完全限定的域名。例如,我的桌面(也是我的 MTA)看起来像:

# sendmail -bt -d0.1 </dev/null
Version 8.15.2
 Compiled with: DNSMAP IPV6_FULL LOG MAP_REGEX MATCHGECOS MILTER
                MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6 NETUNIX NEWDB NIS
                PIPELINING SCANF SOCKETMAP STARTTLS USERDB XDEBUG

============ SYSTEM IDENTITY (after readcf) ============
      (short domain name) $w = foo
  (canonical domain name) $j = foo.example.edu
         (subdomain name) $m = example.edu
              (node name) $k = foo.example.edu
========================================================

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> #
# cat /etc/myname
foo.example.edu
#

myname尽管这个(OpenBSD,如主机名文件所示)系统使用 DNS 和不是主机文件;理想的配置是使用 DNS,如果不可能,则获取hostname/etc/hosts正确(特别是上面输出中的$j$m$k值),如果不可能,则可以设置规则集值。

相关内容