31.5.故障排除

31.5.1.为什么在我的网站上的主机必须使用 FQDN?

主机实际上可能在一个不同的域中。例如,为了让 foo.bar.edu 中的主机能够到达 bar.edu 域中一个叫 mumble 的主机,要用完全限定域名 FQDN,mumble.bar.edu,而不能只用 mumble

这是因为 FreeBSD 的 BIND 版本不再为本地域以外的非 FQDN 提供默认缩写。像 mumble 这样的非限定主机必须以 mumble.foo.bar.edu 的形式出现,否则就会在根域中搜索到它。

在老版本的 BIND 中,搜索继续跨越 mumble.bar.edumumble.edu。RFC 1535 详细说明了为什么这被认为是不好的做法甚至是一个安全漏洞。

作为一个很好的解决方法,把这一行放在:

search foo.bar.edu bar.edu

而不是之前的把:

domain foo.bar.edu

放入 /etc/resolv.conf。然而,要确保搜索顺序不超过 RFC 1535 所说的“地方和公共管理之间的边界”。

31.5.2.如何在拨号的 PPP 主机上运行一个邮件服务器?

连接到 LAN 上的 FreeBSD 邮件网关。这个 PPP 连接是非专用的。

一种方法是让一个全职的互联网服务器为该域名提供二级 MX 服务。在这个例子中,域名是 example.com,ISP 配置了 example.net 来为该域名提供二级 MX 服务:

example.com.          MX        10      example.com.
                      MX        20      example.net.

只有一个主机应该被指定为最终收件人。对于 Sendmail,在 /etc/mail/sendmail.cf 中的 example.com 上添加 Cw example.com

当发送 MTA 试图投递邮件时,它将尝试通过 PPP 链接连接到 example.com 这个系统。如果目的地是离线的,这将超时。MTA 将自动把邮件送到互联网服务提供商(ISP)的二级 MX 站点 example.net。二级 MX 站点将定期尝试连接到一级 MX 主机 example.com`。

使用类似这样的东西作为登录脚本:

#!/bin/sh
# Put me in /usr/local/bin/pppmyisp
( sleep 60 ; /usr/sbin/sendmail -q ) &
/usr/sbin/ppp -direct pppmyisp

当为用户创建一个单独的登录脚本时,在上面的脚本中改用 sendmail -qRexample.com。这将迫使 example.com 的队列中的所有邮件被立即处理。

FreeBSD 互联网服务提供商的邮件列表中的这个例子可以看出对这种情况的进一步细化:

> we provide the secondary MX for a customer. The customer connects to
> our services several times a day automatically to get the mails to
> his primary MX (We do not call his site when a mail for his domains
> arrived). Our sendmail sends the mailqueue every 30 minutes. At the
> moment he has to stay 30 minutes online to be sure that all mail is
> gone to the primary MX.
>
> Is there a command that would initiate sendmail to send all the mails
> now? The user has not root-privileges on our machine of course.

In the privacy flags section of sendmail.cf, there is a
definition Opgoaway,restrictqrun

Remove restrictqrun to allow non-root users to start the queue processing.
You might also like to rearrange the MXs. We are the 1st MX for our
customers like this, and we have defined:

# If we are the best MX for a host, try directly instead of generating
# local config error.
OwTrue

That way a remote site will deliver straight to you, without trying
the customer connection.  You then send to your customer.  Only works for
hosts, so you need to get your customer to name their mail
machine customer.com as well as
hostname.customer.com in the DNS.  Just put an A record in
the DNS for customer.com.

最后更新于

FreeBSD 中文社区