Home> Postfixでセキュアなメールサーバ環境の構築 【その1】

Postfixでセキュアなメールサーバ環境の構築 【その1】

  • 2004年6月12日 21:04

Postfixの設定とSMTP_AUTHの実装。

以前、当メールサーバはQmailで構築をしていましたが、私自身、最初にサーバ構築をしたもので、中がごちゃごちゃとしており不具合もボツボツと出始めてきたので、再構築となりました。
今回もQmailとウイルスメールをメールゲートウェイで叩くためにAntiVir MailGateの導入を検証をしていたのですが私のスキル不足もあり断念いたしました。^^; この為、上記と同じ条件でメールサーバを構築を考えていたところ、Postfix + AntiVir MailGateの組み合わせが数多くHP上に掲載されていたため、こちらを採用いたしました。
なお、今回の設定はFedora2を使っておこないました。

今回メールサーバの構築にあたって、下記ソフトを使いました。
・Postfix (Fedora2/yumによるインストール)
・AntiVir MailGate  http://www.hbedv.com/
・Courier-imap  http://www.inter7.com/courierimap.html 
・SMTP-Auth(Postfixの設定で実現)

まずPostfixをyumコマンドを使ってインストールします。

# yum install postfix

インストールするか確認のメッセージがあるので yを押します。

次に/etc/postfix/main.cfを編集します。( 編集箇所のみ記述してます)

# vi /etc/postfix/main.cf

↓下記からmain.cfの内容
#myhostname = virtual.domain.tld
myhostname = mail.papanda.jp ← ホスト名.ドメイン名を指定

#mydomain = domain.tld
mydomain = papnda.jp ← 追加(ドメイン名を指定) 

#myorigin = $mydomain ← コメント削除

myorigin = $mydomain 
※発信元のアドレスの形式を定義。この場合はtest@papanda.jpとなります。

#inet_interfaces = all ← コメント削除

inet_interfaces = all

inet_interfaces = localhost

#inet_interfaces = localhost ← コメントアウト

mydestination = $myhostname, localhost.$mydomain

#mydestination = $myhostname, localhost.$mydomain ← コメントアウト

#mydestination = $myhostname, localhost.$mydomain $mydomain ← コメント削除

mydestination = $myhostname, localhost.$mydomain $mydomain
※ローカルに配信するドメイン部分を指定します。上記の設定では、test@mail.papanda.jp / test@localhost.papanda.jp / test@papanda.jp宛てのメールアドレスを受け取ります。

#
mynetworks_style = subnet ← コメント削除

mynetworks_style = subnet

#mynetworks = 168.100.189.0/28, 127.0.0.0/8
mynetworks = 192.168.0.0/24, 127.0.0.0/8 ← 追加
※メール中継を許可するネットワークを設定します。上記の設定では192.168.0.0?192.168.0.255まで中継許可をします。 

#relay_domains = $mydestination ← コメント解除

relay_domains = $mydestination
※リレーを許可するドメインを指定します。

#home_mailbox = Maildir/ ← コメント解除

home_mailbox = Maildir/
※Maildir形式を指定します。

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks
                    permit_sasl_authenticated
                    reject_unauth_destination
SMTP_AUTHの設定です。

次にroot宛てのメールを指定する一般ユーザに転送する設定をします。sendmailのaliasファイルをコピーしてそのファイルを編集します。

#cp /etc/aliases /etc/postfix/aliases 
#vi /etc/postfix/aliases

root: user ←転送するユーザー

# postalias /etc/postfix/aliases ← 転送先の設定を反映します。

SMTP_AUTHの認証設定をおこないます。ここでは、システムアカウントを利用した認証の設定を行います。

# vi /usr/lib/sasl2/smtpd.conf ← smtpd.confを編集します。

pwcheck_method: saslauthd
mech_list: plain login

入力して保存します。

認証は。/etc/shadowを認証データを使いますので、以下のようにsaslauthdを起動しておきます。

# saslauthd -a shadow

最後にPostfixの起動を行います。

/etc/rc.d/init.d/sendmail stop ← 起動しているsendmailを停止します。
/usr/sbin/alternatives --config mta ← MTAをPostfixに変更します。

/etc/rc.d/init.d/postfix start ← Postfix起動

以上でPostfixの設定は完了ですが、SMTP(送信)の設定だけでPOP3/IMAP4(受信)の設定は出来ていません。
次ページでは POP3/IMAP4(受信)の設定を行います。

トラックバック:0

TrackBack URL for this entry
http://blog1.papanda.jp/cgi-bin/mt-tb.cgi/12
Listed below are links to weblogs that reference
Postfixでセキュアなメールサーバ環境の構築 【その1】 from Linux備忘録

コメント:0

Comment Form

Index of all entries

Home> Postfixでセキュアなメールサーバ環境の構築 【その1】

カテゴリ
アーカイブ
購読
Powerd By

Return to page top