====== dovecot インストール手順 ======
Dovecotについて
DovecotはPOP/IMAPの受信メールサーバを提供するソフトウェアです。
下記の記述はメールサーバ(MTA)のPostfixと連動させる手順となります。
===== 前提条件 =====
* 以下の手順はZoneExpressにdovecotをインストールする場合の手順となります。他のサーバにインストールする場合は設定が異なる場合があります。
* 以下の手順は dovecot 1.0.13を用いて説明しています。バージョンにより内容が異なる場合がありますがご了承ください。
* 以下の説明にはターミナルエミュレータを利用しています。ターミナルエミュレータについてはご自身でご用意ください。
* 弊社ではdovecotに関するサポートは行っておりません。dovecotに関するご質問にはお答えできません。
以下の手順はPostfixバージョン2.4.6を前提に進めています。以前のバージョンで実行する場合は下記手順と齟齬をきたす場合があります。
下記手順からインストールされているPostfixのバージョンを確認出来ます。
$ postconf | grep mail_version
mail_versionの確認を行います。
mail_version = 2.4.6
milter_macro_v = $mail_name $mail_version
バージョン2.4.6以前を確認された場合には[[postfix:install|こちら]]にアップデート手順がありますのでご参照ください。
====== ■前準備 ======
ZoneExpress環境のデフォルトで動作しているPOP/IMAPサーバであるCourierを停止します。
# svcadm disable svc:/application/cswcourier:authlib
# svcadm disable svc:/application/cswcourier:imap
状態確認を行います。左項がdisableとなっていることを確認します。
$ svcs -a | grep courier
disabled 1月_13 svc:/application/cswcourier:authlib
disabled 1月_13 svc:/application/cswcourier:imap
====== ■パッケージインストール ======
パッケージからのインストールを行います。
# pkg-get -i dovecot
正しくインストールされたことを確認します。
$ pkg-get -c | grep dovecot
dovecotがSAME(最新版と一致)となっていることを確認します。
dovecot 1.0.13,REV=2008.03.16 SAME
dovecot_devel [Not installed] 1.0.13,REV=2008.03.16
dovecot_sieve [Not installed] 1.0.2,REV=2007.12.30
dovecotに必要なcyrusパッケージ(認証をサポートするライブラリ群)をインストールします。
# pkg-get -i cyrus_imapd_utils
正しくインストールされたことを確認します。
# pkg-get -c | grep cyrus
各パッケージがSAME(最新版と一致)となっていることを確認します。
cyrus_imapd 2.3.11,REV=2008.03.22 SAME
cyrus_imapd_utils 2.3.11,REV=2008.03.16 SAME
pm_cyrus 2.3.11,REV=2008.03.16 SAME
====== ■dovecotの設定 ======
dovecotの設定ファイルの作成を行います。
# cp -p /opt/csw/etc/dovecot-example.conf /opt/csw/etc/dovecot.conf
設定ファイルの編集を行います。
# vi /opt/csw/etc/dovecot.conf
下記の様にコメントアウトを外し、"pop3" "pop3s"を追記します。
* 修正前
42 #protocols = imap imaps
* 修正後
42 protocols = imap imaps pop3 pop3s
下記の様にコメントアウトを外し、noをyesへ変更します。
* 修正前
108 #ssl_disable = no
* 修正後
108 ssl_disable = yes
loginの記述を追記します。
* 修正前
787 mechanisms = plain
* 修正後
787 mechanisms = plain login
下記の様にコメントアウトを外します。
* 修正前
227 # mail_location = maildir:~/Maildir
1002 #socket listen {
1013 #client {
* 修正後
227 mail_location = maildir:~/Maildir
1002 socket listen {
1013 client {
下記の様にコメントアウトを外し、pathを変更します。
* 修正前
1017 #path = /opt/csw/var/run/dovecot/auth-client
1018 #mode = 0660
1019 #}
1020 #}
1021 #}
* 修正後
1017 path = /opt/csw/var/spool/postfix/private/auth
1018 mode = 0660
1019 }
1020 }
1021 }
設定ファイルの編集は以上です。
====== ■authファイルの削除 ======
authファイルの削除を行います。(起動時に自動で作られます)
dovecot標準のauthファイルとpostfix側のauthファイルの削除を行います。
# rm /opt/csw/var/run/dovecot/dict-server
# rm /opt/csw/var/spool/postfix/private/auth
====== ■Postfix設定 ======
Postfixのmain.cfのSASL項目を下記の様に修正します。
# vi /etc/opt/csw/postfix/main.cf
ZoneExpressのデフォルト設定
## SASL ##
smtpd_enforce_tls = no
# smtpd_tls_cert_file = /opt/csw/openssl/certs/$myhostname.pem
# smtpd_tls_loglevel = 0
# smtpd_use_tls = yes
dovecotを有効にする設定
## SASL ##
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
ZoneExpressデフォルト設定
## Restrictions ##
smtpd_helo_required = yes
smtpd_client_restrictions =
permit_mynetworks,
#permit_sasl_authenticated,
#reject_rbl_client sbl-xbl.spamhaus.org,
#reject_rbl_client spamcop.net,
#reject_rbl_client dynablock.wirehub.net,
#reject_rbl_client list.dsbl.org
dovecotを有効にする設定
## Restrictions ##
smtpd_helo_required = yes
smtpd_client_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
#reject_rbl_client sbl-xbl.spamhaus.org,
#reject_rbl_client spamcop.net,
#reject_rbl_client dynablock.wirehub.net,
#reject_rbl_client list.dsbl.org
====== ■dovecotの起動 ======
起動/停止の際のエラー確認を行うため、もう一つターミナルエミュレータを立ち上げ、以下の手順に併せてサーバログもご確認ください。
$ tail -f /var/log/syslog
※ -f オプションでファイルの更新分もリアルタイムで表示されます。
* dovecotの停止
# svcadm disable svc:/network/cswdovecot:default
* dovecotの起動
# svcadm enable svc:/network/cswdovecot:default
* 状態確認
$ svcs -a | grep dovecot
onlineとなっていることを確認します。
online 14:51:22 svc:/network/cswdovecot:default
* Postfixの再起動(設定再読込)
起動状態の確認
$ svcs -a | grep postfix
online 2月_26 svc:/network/smtp/postfix:default
状態がonlineの場合は下記コマンドで再読込を行います。
# svcadm restart svc:/network/smtp/postfix:default
状態がdisableの場合は下記コマンドでPostfixを起動(読込)を行います。
# svcadm enable svc:/network/smtp/postfix:default
Postfixの起動状態確認を行います。
# svcs -a | grep postfix
online 1月_19 svc:/network/smtp/postfix:default
onlineが確認出来れば完了です。
===== サーバログ =====
出力先は/var/log/syslog
* dovecot起動
Mar 2 10:35:20 ZEUA0618.zone-express.jp dovecot: [ID 673641 mail.info] Dovecot v1.0.13 starting up
* dovecot停止
Mar 2 10:33:55 ホスト名.jp dovecot: [ID 107833 mail.warning] imap-login: Killed with signal 15
Mar 2 10:33:55 ホスト名.jp last message repeated 2 times
Mar 2 10:33:55 ホスト名.jp dovecot: [ID 107833 mail.warning] pop3-login: Killed with signal 15
Mar 2 10:33:55 ホスト名.jp last message repeated 1 time
Mar 2 10:33:55 ホスト名.jp dovecot: [ID 298464 mail.warning] Killed with signal 15
* Postfix停止
Mar 2 10:39:02 ホスト名.jp postfix/postfix-script[466]: [ID 197553 mail.info] stopping the Postfix mail system
Mar 2 10:39:02 ホスト名.jp postfix/master[10249]: [ID 197553 mail.info] terminating on signal 15
* Postfix起動
Mar 2 10:39:02 ホスト名.jp postfix/postfix-script[511]: [ID 197553 mail.info] starting the Postfix mail system
Mar 2 10:39:02 ホスト名.jp postfix/master[512]: [ID 197553 mail.info] daemon started -- version 2.4.6, configuration /etc/opt/csw/postfix
====== ■メールの送受信検証 ======
===== メールの送信 =====
メールの送信をテストします。
mail <有効なメールアドレス>
入力待機の状態となるので以下を入力します。
Subject:<任意の題名>
<任意の本文>
入力後、**** で送信となります。
送信先のメールボックスを確認し、メールが届いていることを確認します。
syslogの出力にてエラー(mail.warningやmail.error)が出力されていないことを確認します。
===== メールの受信 =====
メールの受信テストを行います。
ローカル以外のメールアドレスからメールを送信します。
サーバ側へのメールは<ユーザ名>@<ホスト名>を宛先にして送信してください
宛先にしたユーザの/Maildir/new/配下にメールが届いていることを確認します。
syslogの出力にてエラー(mail.warningやmail.error)が出力されていないことを確認します。
以上でメールの送受信検証は完了です。
====== ■参考リンク ======
[[http://www.dovecot.org/|dovecot公式ページ]](英語)