メールサーバー構築
19 11 月 2007
自動実行ファイルはコチラで公開しているスクリプトをそのまま使用しています。
Postfix インストール & 設定
# yum -y install postfix ← Postfix インストール # vi /etc/postfix/main.cf ← 設定ファイル編集 myhostname = mail.lunq.net ← 70行目前後 mydomain = lunq.net ← 78行目前後 myorigin = $mydomain ← 95行目前後 inet_interfaces = all ← 112行目前後 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain ← 160行目前後 home_mailbox = Maildir/ ← 418行目前後 mailbox_command = /usr/bin/procmail ← 449行目前後 header_checks = regexp:/etc/postfix/header_checks ← 545行目前後 body_checks = regexp:/etc/postfix/body_checks ← 546行目前後 追加 smtpd_banner = $myhostname ESMTP unknown ← 572行目前後 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 ※変更、追加箇所だけ抜粋してます。 |
認証プログラム起動
# /etc/rc.d/init.d/saslauthd start # chkconfig saslauthd on |
新規ユーザー作成時の設定
# mkdir -p /etc/skel/Maildir/new # mkdir -p /etc/skel/Maildir/cur # mkdir -p /etc/skel/Maildir/tmp # chmod -R 700 /etc/skel/Maildir/ |
件名に「未承諾広告※」と表示されているメールは削除
# vi /etc/procmailrc
SHELL=/bin/bash
PATH=/usr/bin:/bin
DROPPRIVS=yes
MAILDIR=$HOME/Maildir
DEFAULT=$MAILDIR/
#LOGFILE=$HOME/.procmail.log # ログ出力先
#VERBOSE=ON # 詳細ログ出力
# 文字コードがUTF-8の場合
:0
* ^Subject:.*iso-2022-jp
* ^Subject:/.*
* ? echo "$MATCH" | nkf -mwZ2 | sed 's/[[:space:]]//g' | egrep '未承諾広告※'
/dev/null
# 文字コードがEUCの場合
:0
* ^Subject:.*iso-2022-jp
* ^Subject:/.*
* ? echo "$MATCH" | nkf -meZ2 | sed 's/[[:space:]]//g' | egrep '未承諾広告※'
/dev/null
|
「 sendmail 」 停止 & 「 Postfix 」 切り替え
# /etc/rc.d/init.d/sendmail stop # chkconfig sendmail off # alternatives --config mta ← メールサーバーを 「 Postfix 」 に切替え 2 プログラムがあり 'mta'を提供します。 選択 コマンド ----------------------------------------------- *+ 1 /usr/sbin/sendmail.sendmail 2 /usr/sbin/sendmail.postfix Enterを押して現在の選択[+]を保持するか、選択番号を入力します:2 ← 「 Postfix 」 を選択 |
「 Postfix 」 起動
# /etc/rc.d/init.d/postfix start # chkconfig postfix on |
Dovecot インストール & 設定
# yum -y install dovecot # vi /etc/dovecot.conf protocols = imap imaps pop3 pop3s ← 18行目前後 mail_location = maildir:~/Maildir ← 206行目前後 ※変更、追加箇所だけ抜粋してます。 |
受信サーバー Dovecot を起動↓
# /etc/rc.d/init.d/dovecot start # chkconfig dovecot on |
No comments yet
