fedora13でpostfix2.7.0を設定する。

先の書籍と、こちらのサイトを参考にさせていただいて、MTAを設定してみたので覚え書き。postfixの基本的な知識については、こちらも参考になる。
先のログでBindを設定した機械に導入する。先のログでこのホストをMTAに指定している。

という設定。

メイルはクラウドが主流だろうし、企業でもそうなっていくと思われる。ということもあって、TCOの高いMTAを自前で構築・運用することは少なくなっていくと思う。
ここでも、アプリケーションユースを前提と考えている。

postfixの導入

[root@fc13-x60 etc]# yum install postfix

以下がインストールされた。

[root@fc13-x60 etc]# rpm -qa | grep postfix
postfix-2.7.0-1.fc13.i686

sendmailを止める

service sendmail stop
chkconfig sendmail off

/etc/postfix/main.cfの編集

Maildir形式にする。
まず、ユーザー作成時に/home/[username]/Maildirができるようにする。作業はrootで行う。

mkdir /etc/skel/Maildir/new
mkdir /etc/skel/Maildir/cur
mkdir /etc/skel/Maildir/tmp
chroot -R 700 /etc/skel/Maildir

# 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.tld
myhostname = fc13-x60.tetsuyaodaka.com

# 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.tld
mydomain = tetsuyaodaka.com

# For the sake of consistency between sender and recipient addresses,
# myorigin also specifies the default domain name that is appended
# to recipient addresses that have no @domain part.
#
myorigin = $myhostname
#myorigin = $mydomain

# Note: you need to stop/start Postfix when this parameter changes.
#
inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost

# Enable IPv4, and IPv6 if supported
inet_protocols = all

# 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 (the right-hand side is ignored).
# Continue long lines by starting the next line with whitespace.
#
# See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
#
#mydestination = $myhostname, localhost.$mydomain, localhost
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
#       mail.$mydomain, www.$mydomain, ftp.$mydomain

#mynetworks = 168.100.189.0/28, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table
#ここは信頼するネットワークなので不正中継を防止するために重要です。LAN環境に合わせて変更してください。
mynetworks = 10.0.1.0/24,127.0.0.0/8

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

#smtpd_banner = $myhostname ESMTP $mail_name
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
smtpd_banner = $myhostname ESMTP unknown

MTAの変更

[root@fc13-x60 postfix]# alternatives --config mta

2 プログラムがあり 'mta' を提供します。

選択 コマンド

                                                                                            • -

1 /usr/sbin/sendmail.sendmail

  1. 2 /usr/sbin/sendmail.postfix

2を選ぶ。

サービスのスタート

service postix start
chkconfig postfix on