Linux(CentOS 5.3)でPostfixを使用するための初期設定メモ
【前提】
・DNSは別途構築済み
・SMTP認証を使用
[必要モジュールインストール]
# yum -y install postfix
# yum -y install cyrus-sasl-md5
# yum -y install dovecot
[初期設定]
# system-switch-mail → Postfix を選択
# vi /etc/postfix/main.cf
<以下は変更する行>
myhostname = サーバのホスト名を設定
mydomain = 管理したいドメイン名を設定
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
<以下は追加する行(最後に追加)>
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions =
permit_mynetworks
permit_sasl_authenticated
reject_unauth_destination
message_size_limit = 10485760
# vi /etc/postfix/master.cf
<以下は変更する行>
submission inet n - n - - smtpd ←デフォルトでコメントアウトされているので有効にする(先頭の#を取る)
# vi /usr/lib/sasl2/smtpd.conf
<以下は変更する行>
pwcheck_method: auxprop
# vi /etc/dovecot.conf
<以下は変更する行>
protocols = imap imaps pop3 pop3s
mail_location = maildir:~/Maildir
設定したら適宜サービスを再起動する(service postfix/dovecot restart)
ファイアーウォールも適宜設定する(25/tcp, 110/tcp, 587/tcpを開放)
[ユーザ登録]
# saslpasswd2 -c ユーザ名 ※パスワードを二回入力
パスワードもコマンド内で設定したい場合は以下
# echo パスワード | saslpasswd2 -c ユーザ名 -p
# chgrp postfix /etc/sasldb2
# chmod 640 /etc/sasldb2
[参考サイト]

コメントする