2008年4月13日日曜日

全Dom0にPostfixを入れる

しまった、面倒なことになってしまった。
PHPやPerlはsendmailをコマンドラインで叩いてメール送信するので、各Dom0にMTAを導入してやらないとメールを集約できないじゃん・・・。。。

Webminで全mail01を除く各Dom0にPostfixを入れて、設定ファイルをコピーすることにする。ああ、まんどい。
※alphaには入れない。Dom0が常に動いているとは言い切れないのでトラブルの元。

全DomUに
# yum -y install postfix

全DomUに設定追記
myhostname = stats01.hoge.com
mydomain = hoge.com
myorigin = $mydomain
inet_interfaces = all
#proxy_interfaces =
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/

#SMTP-Auth
smtpd_banner = $myhostname ESMTP unknown
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

#MailSizeLimitter 100MB
message_size_limit = 104857600

#MailBoxSizeLimitter 500MB
mailbox_size_limit = 512000000

mynetworks = 192.168.0.0/24, 127.0.0.0/8
relay_domains = $mydestination

relayhost = mail01.hoge.com
#transport_maps = hash:/etc/postfix/transport
#alias_maps = hash:/etc/aliases, hash:/etc/mailman/aliases

#manual setting
allow_mail_to_commands = alias,forward,include
allow_mail_to_files = alias,forward,include
disable_vrfy_command = yes
allow_percent_hack = yes
swap_bangpath = yes
forward_path = $home/.forward$recipient_delimiter$extension,$home/.forward
sendmail_path = /usr/sbin/sendmail

これでローカル配信以外は全部mail01.hoge.comにリレーされる。
全DomUで
# /etc/rc.d/init.d/saslauthd start
# chkconfig saslauthd on
# chkconfig --list saslauthd
# mkdir -p /etc/skel/Maildir/new
# mkdir -p /etc/skel/Maildir/cur
# mkdir -p /etc/skel/Maildir/tmp
# chmod -R 700 /etc/skel/Maildir/
# /etc/rc.d/init.d/sendmail stop
# chkconfig sendmail off
# chkconfig --list sendmail
# alternatives --set mta /usr/sbin/sendmail.postfix
# /etc/rc.d/init.d/postfix start
# chkconfig postfix on
# chkconfig --list postfix

これでよしと。

■動作まとめ
○mail01
@hoge.com宛・・・ローカル配信する。
外向け・・・携帯はプロバイダSMTPサーバ、その他は直接当該SMTPサーバにリレー。
外から@xxx.hoge.com宛・・・全部ローカル配信。

○mail01以外
@hoge.com宛・・・ローカル配信する。
@xxx.hoge.com宛・・・該当xxx.hoge.comにリレー。
外向け・・・mail01.hoge.com宛にリレー。
外から@xxx.hoge.com宛・・・全部ローカル配信。

0 件のコメント: