跳轉到內容

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 majordomo@postfix.org.

您可以透過以下方式訂閱開發者列表

echo subscribe postfix-testers | mail majordomo@postfix.org.

最後,我們應該提到的一個列表是公告列表。您可以透過以下方式加入公告列表:echo subscribe postfix-announce | mail majordomo@postfix.org。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
  # user@that.users.mailhost.
  #
  #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 = $user@other.host
  # luser_relay = $local@other.host
  # 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


華夏公益教科書