跳转到内容

LPI Linux 认证/使用电子邮件服务器

来自 Wikibooks,开放世界中的开放书籍

详细目标 (211.1)

[编辑 | 编辑源代码]

(LPIC-2 版本 4.5)


权重 4


描述: 候选人应该能够管理电子邮件服务器,包括配置电子邮件别名、电子邮件配额和虚拟电子邮件域。此目标包括配置内部电子邮件中继和监控电子邮件服务器。


关键知识领域

  • Postfix 的配置文件。
  • Postfix 的基本 TLS 配置
  • SMTP 协议的基本知识
  • 了解 Sendmail 和 Exim


术语和工具

  • Postfix 的配置文件和命令
  • /etc/postfix/
  • /var/spool/postfix/
  • Sendmail 模拟层命令
  • /etc/aliases
  • /var/log/ 中的邮件相关日志

使用 Sendmail

[编辑 | 编辑源代码]

使用 Postfix

[编辑 | 编辑源代码]

Postfix 由 Wietse Venema 编写和维护,他也是 tcp_wrappers 和 Satan 的作者。Postfix 最初名为 VMailer,但 Wietse 在 IBM GPL 下发布了该软件,IBM 的律师发现 VMailer 与现有商标过于相似,因此必须更改名称。Postfix 被写成 Sendmail 的直接替代品,并且它非常接近于实现了这个目标。有一些“陷阱”可能会让你措手不及,但它们并不严重。Wietse 通过 postfix-users 邮件列表积极支持 Postfix,并且还有一个开发者邮件列表。您可以通过以下方式订阅 postfix-users 邮件列表

echo subscribe postfix-users | mail [email protected].

您可以通过以下方式订阅开发者列表

echo subscribe postfix-testers | mail [email protected].

最后,我们应该提到的一个列表是公告列表。您可以通过以下方式加入公告列表:echo subscribe postfix-announce | mail [email protected]。Postfix 的开发正在进行中,截至本文撰写时,这些邮件列表非常活跃。邮件列表的存档可以在以下位置找到:http://www.egroups.com/group/postfix-users/ 和:http://msgs.SecurePoint.com/postfix/.

当一条消息进入 Postfix 邮件系统时,内部的第一站是传入队列。下图显示了与新邮件相关的主要组件。

该图显示了主要的 Postfix 系统组件,以及它们之间的主要信息流。黄色椭圆形是邮件程序,黄色方框是邮件队列或文件,蓝色方框是查找表。

大方框中的程序在 Postfix 常驻主守护进程的控制下运行。大方框中的数据是 Postfix 邮件系统的财产。

邮件在本地发布。Postfix sendmail 程序调用特权 postdrop 程序,将消息放入 maildrop 目录中,该目录由 pickup 守护进程拾取。此守护进程进行一些健全性检查,以保护 Postfix 系统的其余部分。

邮件通过网络进入。Postfix SMTP 服务器接收消息并进行一些健全性检查,以保护 Postfix 系统的其余部分。SMTP 服务器可以配置为基于本地或网络黑名单、DNS 查找和其他客户端请求信息来实现 UCE 控制。邮件由 Postfix 系统本身在内部生成,以便将无法送达的邮件返回给发件人。退回或延迟守护进程会带来坏消息。

邮件由本地传递代理转发,可以通过系统范围的别名数据库中的条目转发,也可以通过每个用户的 .forward 文件中的条目转发。这由无标签箭头表示。

邮件由 Postfix 系统本身在内部生成,以通知邮政管理员问题(此路径也由无标签箭头表示)。Postfix 系统可以配置为通知邮政管理员 SMTP 协议问题、UCE 策略违规等。

cleanup 守护进程实现了新邮件的最终处理阶段。它添加缺失的 From: 和其他消息头,安排将地址重写为标准用户@完全限定域形式,并可选地从消息头中提取收件人地址。cleanup 守护进程将结果作为单个队列文件插入传入队列,并通知队列管理器新邮件到达。cleanup 守护进程可以配置为基于规范和虚拟表查找来转换地址。

根据 cleanup 守护进程的要求,trivial-rewrite 守护进程将地址重写为标准用户@完全限定域形式。最初的 Postfix 版本没有实现重写语言。实现一个将需要大量的努力,而且大多数站点不需要它。相反,Postfix 大量使用表查找。

Postfix 的主要配置文件(相当于 /etc/sendmail.cf 的工作文件)是 main.cf。install.cf 文件包含 Postfix 的初始设置,这些设置是在 RPM 安装期间设置的。master.cf 文件是 Postfix 的主进程配置文件。主文件中的每一行都描述了如何运行邮件器组件程序。在调试部分,我们将详细讨论这个文件。postfix-script 是 Postfix 使用的包装器,用于安全地为 Linux 环境执行 Postfix 命令。让我们仔细看看 install.cf 文件,因为此文件包含一些我们在使用 main.cf 配置 Postfix 时需要的数据。

install.cf 文件实际上只是 RPM 中内置的安装程序使用的默认设置列表。

以下是 main.cf 文件,其中包含 Wietse Venema 的注释以及我们建议的更改穿插其中 

  # Global Postfix configuration file. This file lists only a subset
  # of all 100+ parameters. See the sample-xxx.cf files for a full list.
  # 
  # The sample files mentioned above are located in /usr/doc/postfix-19990906_pl06/
  # The general format is lines with parameter = value pairs. Lines
  # that begin with whitespace continue the previous line. A value can
  # contain references to other $names or ${name}s.
  # LOCAL PATHNAME INFORMATION
  #
  # The queue_directory specifies the location of the Postfix queue.
  # This is also the root directory of Postfix daemons that run chrooted.
  # See the files in examples/chroot-setup for setting up Postfix chroot
  # environments on different UNIX systems.
  #
  queue_directory = /var/spool/postfix

这与 Sendmail 用于传入邮件队列的目录相同。

  # The program_directory parameter specifies the default location of
  # Postfix support programs and daemons. This setting can be overruled
  # with the command_directory and daemon_directory parameters.
  #
  program_directory = /some/where/postfix/bin

上面的行必须更正。RPM 默认将 Postfix 二进制文件安装到 /usr/libexec/postfix 中。

  # The command_directory parameter specifies the location of all
  # postXXX commands.  The default value is $program_directory.
  #
  command_directory = /usr/sbin

上面的行是正确的,可以保留。

  # The daemon_directory parameter specifies the location of all Postfix
  # daemon programs (i.e. programs listed in the master.cf file). The
  # default value is $program_directory. This directory must be owned
  # by root.
  #
  daemon_directory = /usr/libexec/postfix

上面的行是正确的,可以保留。

  # QUEUE AND PROCESS OWNERSHIP
  #
  # The mail_owner parameter specifies the owner of the Postfix queue
  # and of most Postfix daemon processes.  Specify the name of a user
  # account THAT DOES NOT SHARE A GROUP WITH OTHER ACCOUNTS AND THAT
  # OWNS NO OTHER FILES OR PROCESSES ON THE SYSTEM.  In particular,
  # don't specify nobody or daemon. PLEASE USE A DEDICATED USER.
  #
  mail_owner = postfix

上面的行是正确的,可以保留。

  # The default_privs parameter specifies the default rights used by
  # the local delivery agent for delivery to external file or command.
  # These rights are used in the absence of a recipient user context.
  # DO NOT SPECIFY A PRIVILEGED USER OR THE POSTFIX OWNER.
  #
  #default_privs = nobody

上面的行是正确的,可以保留,但应该取消注释(例如,删除开头的井号)。

  # INTERNET HOST AND DOMAIN NAMES
  # 
  # The myhostname parameter specifies the Internet hostname of this
  # mail system. The default is to use the fully-qualified domain name
  # from gethostname(). $myhostname is used as a default value for many
  # other configuration parameters.
  #
  #myhostname = host.domain.name

将上面一行中的值设置为机器的完全限定域名 (FQDN)。例如,如果你的主机名为 turkey,你的域名为 trot.com,那么你的 FQDN 将是“turkey.trot.com”。你还要取消注释此行。

  #myhostname = virtual.domain.name

上面的行对于大多数配置来说是多余的,通常可以保留注释。

  # The mydomain parameter specifies the local Internet domain name.
  # The default is to use $myhostname minus the first component.
  # $mydomain is used as a default value for many other configuration
  # parameters.
  #
  #mydomain = domain.name

上面的行应该是你的域名,不包括在前面添加主机名。在我们上面给出的示例中,这里的值应该是 trot.com。也不要忘记取消注释此行。

  # SENDING MAIL
  # 
  # The myorigin parameter specifies the domain that locally-posted
  # mail appears to come from. The default is to append $myhostname,
  # which is fine for small sites.  If you run a domain with multiple
  # machines, you should (1) change this to $mydomain and (2) set up
  # a domain-wide alias database that aliases each user to
  # [email protected].
  #
  #myorigin = $myhostname
  #myorigin = $mydomain

这里的说明非常好。通常,这里会将其默认设置为 $mydomain。确保取消注释你的选择。

  # RECEIVING MAIL
  # The inet_interfaces parameter specifies the network interface
  # addresses that this mail system receives mail on.  By default,
  # the software claims all active interfaces on the machine. The
  # parameter also controls delivery of mail to user@[ip.address].
  #
  #inet_interfaces = all

这里的说明同样很好。只需取消注释上面列出的行,你应该就没有问题了。除非你有特殊要求,否则接下来的两项可以保留注释。你不需要它们。

  #inet_interfaces = $myhostname
  #inet_interfaces = $myhostname, localhost
  # The mydestination parameter specifies the list of domains that this
  # machine considers itself the final destination for.
  # The default is $myhostname + localhost.$mydomain.  On a mail domain
  # gateway, you should also include $mydomain. Do not specify the
  # names of domains that this machine is backup MX host for. Specify
  # those names via the relay_domains or permit_mx_backup settings for
  # the SMTP server (see sample-smtpd.cf.
  # The local machine is always the final destination for mail addressed
  # to user@[the.net.work.address] of an interface that the mail system
  # receives mail on (see the inet_interfaces parameter).
  # Specify a list of host or domain names, /file/name or type:table
  # patterns, separated by commas and/or whitespace. A /file/name
  # pattern is replaced by its contents; a type:table is matched when
  # a name matches a lookup key.  Continue long lines by starting the
  # next line with whitespace.
  #
  #mydestination = $myhostname, localhost.$mydomain
  #mydestination = $myhostname, localhost.$mydomain $mydomain

最常见的做法是选择上面的行作为你的选择。确保取消注释它并在最后两项之间添加一个逗号,因为看起来它被省略了。

  #mydestination = $myhostname, localhost.$mydomain, $mydomain,
  #       mail.$mydomain, www.$mydomain, ftp.$mydomain
  # INTERNET VERSUS INTRANET
  # The relayhost parameter specifies the default host to send mail to
  # when no entry is matched in the optional transport(5) table. When
  # no relayhost is given, mail is routed directly to the destination.
  # 
  # On an intranet, specify the organizational domain name. If your
  # internal DNS uses no MX records, specify the name of the intranet
  # gateway host instead.
  #
  # Specify a domain, host, host:port, [address] or [address:port].
  # Use the form [destination] to turn off MX lookups. See also the
  # default_transport parameter if you're connected via UUCP.
  #
  #relayhost = $mydomain
  #relayhost = gateway.my.domain
  #relayhost = uucphost
  #relayhost = [mail.$mydomain:9999]

如果你身处某个防火墙后,或者你需要伪装信封(这将在本文档后面介绍),则应将“relayhost”值设置为域的 MTA。如果此主机是域的 *主要* MTA,则将所有这些保留注释。

  # DEFAULT TRANSPORT
  #
  # The default_transport parameter specifies the default message
  # delivery transport to use when no transport is explicitly given in
  # the optional transport(5) table.
  #
  #default_transport = smtp

在大多数情况下,上面的行应取消注释并保留原样。

  #default_transport = uucp
  # ADDRESS REWRITING
  #
  # Insert text from sample-rewrite.cf if you need to do address
  # masquerading.
  #
  # Insert text from sample-canonical.cf if you need to do address
  # rewriting, or if you need username->Firstname.Lastname mapping.
  # ADDRESS REDIRECTION (VIRTUAL DOMAIN)
  #
  # Insert text from sample-virtual.cf if you need virtual domain support.
  # "USER HAS MOVED" BOUNCE MESSAGES
  #
  # Insert text from sample-relocated.cf if you need "user has moved"
  # style bounce messages. Alternatively, you can bounce recipients
  # with an SMTP server access table. See sample-smtpd.cf.
  # TRANSPORT MAP
  #
  # Insert text from sample-transport.cf if you need explicit routing.
  
  # ALIAS DATABASE
  #
  # The alias_maps parameter specifies the list of alias databases used
  # by the local delivery agent. The default list is system dependent.
  # On systems with NIS, the default is to search the local alias
  # database, then the NIS alias database. See aliases(5) for syntax
  # details.
  # 
  # If you change the alias database, run "postalias /etc/aliases" (or
  # wherever your system stores the mail alias file), or simply run
  # "newaliases" to build the necessary DBM or DB file.
  #
  # It will take a minute or so before changes become visible.  Use
  # "postfix reload" to eliminate the delay.
  #
  #alias_maps = dbm:/etc/aliases
  alias_maps = hash:/etc/aliases

alias_maps 行指向 /etc/aliases 文件,我们之前在删除 Sendmail 之前保留了该文件。最佳实践(推荐)通常更喜欢将所有 Postfix 配置文件放在一起,因此可能需要将此行更改为

  alias_maps = hash:/etc/postfix/aliases

并确保将别名文件放在 /etc/postfix 中。否则,Postfix 会在启动时抱怨并无法运行。Red Hat Linux 上的默认 db 类型是 hash,因此请确保使用它,就像我们这里一样。人们常犯的一个错误是在使用 dbm 而不是 hash 的时候。不要掉入那个陷阱。

  #alias_maps = hash:/etc/aliases, nis:mail.aliases
  #alias_maps = netinfo:/aliases
  # The alias_database parameter specifies the alias database(s) that
  # are built with "newaliases" or "sendmail -bi".  This is a separate
  # configuration parameter, because alias_maps (see above) may specify
  # tables that are not necessarily all under control by Postfix.
  #
  #alias_database = dbm:/etc/aliases
  #alias_database = dbm:/etc/mail/aliases
  #alias_database = hash:/etc/aliases

正如说明所说,如果你想使用 newaliases 命令来处理别名文件(推荐),则应该取消注释上面的行,但要确保(如果你做了我们在 alias_maps 部分中建议的路径更改),并将它更改为

  alias_database = hash:/etc/postfix/aliases

然后确保取消注释此行并在启动 Postfix 之前运行 newaliases 命令。

   #alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases

如果你恰好运行了 majordomo,则应该使用上面的行,而不仅仅是别名行。确保 majordomo 文件的路径正确。最佳实践约定是将它放在 /etc/postfix 中。大多数 Red Hat Linux Sendmail 安装程序都会将它放在 /etc/mail/ 中。在本文档的列表服务器部分,我们将进一步讨论这个问题。

  # DELIVERED-TO
  #
  # The prepend_delivered_header controls when Postfix should prepend
  # a Delivered-To: message header.
  #
  # By default, Postfix prepends a Delivered-To: header when forwarding
  # mail and when delivering to file (mailbox) or command.  Turning off
  # the Delivered-To: header when forwarding mail is not recommended.
  #
  # prepend_delivered_header = command, file, forward
  # prepend_delivered_header = forward

默认设置可以正常工作,所以你可以保留此部分的注释,除非你有特殊需求或偏好。

  # ADDRESS EXTENSIONS (e.g., user+foo)
  #
  # The recipient_delimiter parameter specifies the separator between
  # user names and address extensions (user+foo). See canonical(5),
  # local(8), relocated(5) and virtual(5) for the effects this has on
  # aliases, canonical, virtual, relocated and .forward file lookups.
  # Basically, the software tries user+foo and .forward+foo before
  # trying user and .forward.
  #
  # recipient_delimiter = +

这个也可以保留注释,除非你有特殊需求或偏好。

  # DELIVERY TO MAILBOX
  #
  # The home_mailbox parameter specifies the optional pathname of a
  # mailbox relative to a user's home directory. The default is to
  # deliver to the UNIX-style /var/spool/mail/user or /var/mail/user.
  # Specify "Maildir/" for qmail-style delivery (the / is required).
  #
  #home_mailbox = Mailbox
  #home_mailbox = Maildir/

在 Red Hat Linux 系统上,除非你知道自己在做什么,否则应该保留原样。如果你要从 qmail 转换为 Postfix(不太可能),那么它可能很有用。

  # The mail_spool_directory parameter specifies the directory where
  # UNIX-style mailboxes are kept. The default setting depends on the
  # system type.
  #
  # mail_spool_directory = /var/mail
  # mail_spool_directory = /var/spool/mail

上一行对于 Red Hat Linux 默认设置是正确的,因此应该取消注释并保留原样。

  # The mailbox_command parameter specifies the optional external
  # command to use instead of mailbox delivery. The command is run as
  # the recipient with proper HOME, SHELL and LOGNAME environment settings.
  # Exception:  delivery for root is done as $default_user.
  #
  # Other environment variables of interest: USER (recipient username),
  # EXTENSION (address extension), DOMAIN (domain part of address),
  # and LOCAL (the address localpart).
  #
  # Unlike other Postfix configuration parameters, the mailbox_command
  # parameter is not subjected to $parameter substitutions. This is to
  # make it easier to specify shell syntax (see example below).
  #
  # Avoid shell meta characters because they will force Postfix to run
  # an expensive shell process. Procmail alone is expensive enough.
  #
  #mailbox_command = /some/where/procmail

Red Hat Linux 系统上的默认 MDA 是 procmail。可以使用命令“which procmail”来验证路径,但除非你更改了 procmail 的位置,否则它位于“/usr/bin/procmail”中。不要忘记取消注释此行。

  #mailbox_command = /some/where/procmail -a "$EXTENSION"
  # The mailbox_transport specifies the optional transport in master.cf
  # to use after processing aliases and .forward files. This parameter
  # has precedence over the mailbox_command, fallback_transport and
  # luser_relay parameters.
  #
  #mailbox_transport = cyrus

在默认的 Red Hat Linux 系统上,应该保留上面的行。

  # The fallback_transport specifies the optional transport in master.cf
  # to use for recipients that are not found in the UNIX passwd database.
  # This parameter has precedence over the luser_relay parameter.
  #
  #fallback_transport =

在默认的 Red Hat Linux 系统上,应该保留上面的行。

  # The luser_relay parameter specifies an optional destination address
  # for unknown recipients.  By default, mail for unknown local recipients
  # is bounced.
  #
  # The following expansions are done on luser_relay: $user (recipient
  # username), $shell (recipient shell), $home (recipient home directory),
  # $recipient (full recipient address), $extension (recipient address
  # extension), $domain (recipient domain), $local (entire recipient
  # localpart), $recipient_delimiter. Specify ${name?value} or
  # ${name:value} to expand value only when $name does (does not) exist.
  #
  # luser_relay = [email protected]
  # luser_relay = [email protected]
  # luser_relay = admin+$local

在这里你可以选择做什么,但每天收到大量的退信可能会很烦人。请保持原样(推荐)。

  # JUNK MAIL CONTROLS
  # 
  # The controls listed here are only a very small subset. See the file
  # sample-smtpd.cf for an elaborate list of anti-UCE controls.
  # The header_checks parameter restricts what may appear in message
  # headers. This requires that POSIX or PCRE regular expression support
  # is built-in. Specify "/^header-name: stuff you do not want/ REJECT"
  # in the pattern file. Patterns are case-insensitive by default. Note:
  # specify only patterns ending in REJECT. Patterns ending in OK are
  # mostly a waste of cycles.
  #
  #header_checks = regexp:/etc/postfix/filename
  #header_checks = pcre:/etc/postfix/filename

上面的部分启用了一个过滤器,你可以用它来检测和“退回”与特定正则表达式(REGEXP)匹配的邮件。使用 procmail 和 regexp 或 PCRE 的区别在于,这两种方法都会在邮件传递之前捕获邮件,并且可以在 SMTP 端口有效地阻止不需要的邮件。

  # The relay_domains parameter restricts what domains (and subdomains
  # thereof) this mail system will relay mail from or to.  See the
  # smtpd_recipient_restrictions restriction in the file sample-smtpd.cf.
  #
  # By default, Postfix relays mail only from or to sites in or below
  # $mydestination, or in the optional virtual domain list.
  # 
  # Specify a list of hosts or domains, /file/name patterns or type:name
  # lookup tables, separated by commas and/or whitespace.  Continue
  # long lines by starting the next line with whitespace. A file name
  # is replaced by its contents; a type:name table is matched when a
  # (parent) domain appears as lookup key.
  #
  # NOTE: Postfix will not automatically forward mail for domains that
  # list this system as their primary or backup MX host. See the
  # permit_mx_backup restriction in the file sample-smtpd.cf.
  #
  #relay_domains = $mydestination, $virtual_maps

对于任何了解 MX 记录工作原理的人来说,这是 Postfix 配置中的一个关键组件。家庭用户可能不需要这一行,但处理多个域名邮件的任何人都会需要。

以下是一个使用示例

   relay_domains = $mydestination, /etc/postfix/relay-domains

在这个例子中,你想中继的域名将被放置在文件 /etc/postfix/relay-domains 中。每行一个,如下所示

  here.com 
  mail.here.com 
  there.org 
  mail.there.org 

注意:这个文件 *不* 被哈希或映射。它只是一个简单的文本文件。你也可以使用 IP 地址代替名称。

  # The mynetworks parameter specifies the list of networks that are
  # local to this machine.  The list is used by the anti-UCE software
  # to distinguish local clients from strangers. See permit_mynetworks
  # and smtpd_recipient_restrictions in the file sample-smtpd.cf file.
  #
  # The default is a list of all networks attached to the machine:  a
  # complete class A network (X.0.0.0/8), a complete class B network
  # (X.X.0.0/16), and so on. If you want stricter control, specify a
  # list of network/mask patterns, where the mask specifies the number
  # of bits in the network part of a host address. You can also specify
  # the absolute pathname of a pattern file instead of listing the
  # patterns here.
  #
  #mynetworks = 168.100.189.0/28, 127.0.0.0/8

上面的行是 Postfix 配置中的另一个关键组件。正如说明所说,它指定了本地到此主机的网络列表。对于那些不熟悉所用语法的,它被称为无类别域间路由 (CIDR) 或超网。对于那些熟悉网络类别 (A、B、C 等) 的人来说,它是一种在不引用类别的情况下划分 IP 地址的方法。

  #mynetworks = $config_directory/mynetworks
  # SHOW SOFTWARE VERSION OR NOT
  #
  # The smtpd_banner parameter specifies the text that follows the 220
  # status code in the SMTP greeting banner. Some people like to see
  # the mail version advertised. By default, Postfix shows no version.
  #
  # You MUST specify the $myhostname at the start of the text. When
  # the SMTP client sees its own hostname at the start of an SMTP
  # greeting banner it will report a mailer loop. That's better than
  # having a machine meltdown.
  #
  #smtpd_banner = $myhostname ESMTP $mail_name
  #smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)

上面的配置项是个人喜好问题。它不是必需的,由管理员选择。

  # PARALLEL DELIVERY TO THE SAME DESTINATION
  #
  # How many parallel deliveries to the same user or domain? With local
  # delivery, it does not make sense to do massively parallel delivery
  # to the same user, because mailbox updates must happen sequentially,
  # and expensive pipelines in .forward files can cause disasters when
  # too many are run at the same time. With SMTP deliveries, 10
  # simultaneous connections to the same domain could be sufficient to
  # raise eyebrows.
  # 
  # Each message delivery transport has its XXX_destination_concurrency_limit
  # parameter.  The default is $default_destination_concurrency_limit.
  local_destination_concurrency_limit = 2
  default_destination_concurrency_limit = 10

正如上面的文本所说,这一部分实际上是关于速率限制的。它本质上是 Postfix 的油门。除非你有充分的理由更改这些默认值,否则应该没问题。当你运行 Postfix 一段时间后(特别是那些在专业环境中使用它的人),你可能会更好地了解如何为你的环境设置它。

  # DEBUGGING CONTROL
  #
  # The debug_peer_level parameter specifies the increment in verbose
  # logging level when an SMTP client or server host name or address
  # matches a pattern in the debug_peer_list parameter.
  #
  debug_peer_level = 2

我们推荐这里使用默认值,除非有充分的理由更改它。调试将在本文档的后续章节中介绍。值得一提的是,除非下一部分被启用,否则这一部分没有实际意义。

  # The debug_peer_list parameter specifies an optional list of domain
  # or network patterns, /file/name patterns or type:name tables. When
  # an SMTP client or server host name or address matches a pattern,
  # increase the verbose logging level by the amount specified in the
  # debug_peer_level parameter.
  #
  # debug_peer_list = 127.0.0.1
  # debug_peer_list = some.domain

这一部分与 debug_peer_level 一起使用,因此如果 debug_peer_level 没有被启用,那么这一部分就毫无意义。这实际上是 Postfix 的一个非常酷的功能。想一分钟。如果一切正常,但有一个主机似乎在接收或发送邮件到你的主机或从你的主机发送邮件时遇到了问题,那么你可以使用此功能来提高仅针对该主机的日志记录级别。

  # The debugger_command specifies the external command that is executed
  # when a Postfix daemon program is run with the -D option.
  #
  # Use "command .. & sleep 5" so that the debugger can attach before
  # the process marches on. If you use an X-based debugger, be sure to
  # set up your XAUTHORITY environment variable before starting Postfix.
  #
  debugger_command =
           PATH=/usr/bin:/usr/X11R6/bin
           xxgdb $daemon_directory/$process_name $process_id & sleep 5

现在请保持这一部分不变。我们将在本文档的后续部分详细介绍调试。就是这样。我们已经完成了 main.cf 文件,并且几乎可以开始启动它了。

master.cf

[编辑 | 编辑源代码]

主守护进程是一个监督应用程序,它控制和监视所有其他 Postfix 进程。master.cf 文件是主守护进程的配置文件。master.cf 文件是 Postfix 的节流阀。在这里,你设置所有守护进程进程计数限制。一个有用的限制的很好的例子是,设置可以同时执行的 SMTP 进程的数量限制,毕竟,你可能不想同时接收 50 个传入消息。这里要理解的关键点是,任何没有明确限制的进程默认限制为 50 个进程。

总的来说,master.cf 文件使用默认值就可以了,因此你可以保持原样。

这只是默认别名文件,它可以与你在 sendmail 中使用的完全相同(推荐),并且它与使用 newaliases 命令的方式相同。如果你使用 majordomo,你的 majordomo 别名将以与往常相同的方式工作,并且它们也将与 newaliases 命令一起工作。

postfix 服务器的控制是通过 init.d 脚本完成的。不要忘记在更改配置后发出 postfix reload 命令!如果你修改别名数据库 (/etc/aliases),不要忘记通过发出 newaliases 命令来激活更改(与 sendmail 一样)

关键术语、文件和实用程序:/etc/aliases /etc/postfix/main.cf /etc/postfix/master.cf /var/spool/postfix


华夏公益教科书