CentOS6でPostfixのバーチャルメールボックスにアクセスできるようにDovecotを設定します。
/etc/dovecot/conf.d/10-auth.conf ファイルを編集します。
10-auth.confファイルの下部の
#!include auth-deny.conf.ext
#!include auth-master.conf.ext
!include auth-system.conf.ext
#!include auth-sql.conf.ext
#!include auth-ldap.conf.ext
#!include auth-passwdfile.conf.ext
#!include auth-checkpassword.conf.ext
#!include auth-vpopmail.conf.ext
#!include auth-static.conf.ext
とincludeが並んでいる部分を
#!include auth-deny.conf.ext
#!include auth-master.conf.ext
!include auth-system.conf.ext
#!include auth-sql.conf.ext
#!include auth-ldap.conf.ext
!include auth-passwdfile.conf.ext
#!include auth-checkpassword.conf.ext
#!include auth-vpopmail.conf.ext
#!include auth-static.conf.ext
とします。(!include auth-passwdfile.conf.extを有効にします。)
Version2のDovecotでは、デフォルトでPaintTextの認証が無効になっています。/etc/dovecot/conf.d/10-auth.confファイルの
# Disable LOGIN command and all other plaintext authentications unless
# SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
# matches the local IP (ie. you're connecting from the same computer), the
# connection is considered secure and plaintext authentication is allowed.
#disable_plaintext_auth = yes
を
# Disable LOGIN command and all other plaintext authentications unless
# SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
# matches the local IP (ie. you're connecting from the same computer), the
# connection is considered secure and plaintext authentication is allowed.
#disable_plaintext_auth = yes
disable_plaintext_auth = no
とします。
当初のDovcot2 では設定の必要がありませんでしたが、新しいバージョンのDovecot2 では、SSL強制設定が有効になっているため、無効化する必要があります。この設定をしないと、10-auth.conf で設定した disable_plaintext_auth = no の設定が有効になりません。詳細についてはこちらの記事も参照してください。
/etc/dovecot/conf.d/10-ssl.conf ファイルを編集します。
# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
# disable plain pop3 and imap, allowed are only pop3+TLS, pop3s, imap+TLS and imaps
# plain imap and pop3 are still allowed for local connections
ssl = required
# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
# disable plain pop3 and imap, allowed are only pop3+TLS, pop3s, imap+TLS and imaps
# plain imap and pop3 are still allowed for local connections
ssl = yes
"ssl = required" を "ssl = yes" に変更します。この設定によりsslが必須でなくなります。
pam認証を使っていない場合は無効化しておいたほうが良い場合があります。詳しくはこちらの記事を参照してください。
pam認証を無効化する場合は、10-auth.confファイルの下部の
#!include auth-deny.conf.ext
#!include auth-master.conf.ext
!include auth-system.conf.ext
#!include auth-sql.conf.ext
#!include auth-ldap.conf.ext
!include auth-passwdfile.conf.ext
#!include auth-checkpassword.conf.ext
#!include auth-vpopmail.conf.ext
#!include auth-static.conf.ext
を
#!include auth-deny.conf.ext
#!include auth-master.conf.ext
#!include auth-system.conf.ext
#!include auth-sql.conf.ext
#!include auth-ldap.conf.ext
!include auth-passwdfile.conf.ext
#!include auth-checkpassword.conf.ext
#!include auth-vpopmail.conf.ext
#!include auth-static.conf.ext
とします。(!include auth-system.conf.extをコメントアウトします。)
/etc/dovecot/conf.d/auth-passwdfile.conf.ext ファイルを編集します。
# Authentication for passwd-file users. Included from auth.conf.
#
# passwd-like file with specified location.
# <doc/wiki/AuthDatabase.PasswdFile.txt>
passdb {
driver = passwd-file
args = scheme=CRYPT username_format=%u /etc/dovecot/users
}
userdb {
driver = passwd-file
args = username_format=%u /etc/dovecot/users
}
となっているのを
# Authentication for passwd-file users. Included from auth.conf.
#
# passwd-like file with specified location.
# <doc/wiki/AuthDatabase.PasswdFile.txt>
passdb {
driver = passwd-file
# args = scheme=CRYPT username_format=%u /etc/dovecot/users
args = /etc/dovecot/passwd
}
userdb {
driver = passwd-file
# args = username_format=%u /etc/dovecot/users
args = /etc/dovecot/passwd
}
と変更します。
/etc/dovecot/passwd ファイルを作成します。
ファイルには
CentOS 7ではdovecotpwコマンドがなくなったため、doveadm コマンドを利用します。
コマンドを入力します。
パスワード入力プロンプトが表示されますので、パスワードを入力すると、HMAC-MD5のハッシュ値が出力されます。
下記のdovecotpwコマンドで取得したハッシュ値を入れます。
コマンドを用いてパスワードのハッシュ値を取得します。
今回は以下の記述をしました。
test@ipentec.com:{HMAC-MD5}78ed1abd527d1aa3921f58bfe651b178d23aff2d88ed7b567e30069ad6ae45c6:5000:5000:::::Maildir:/home/vmail/vhosts/ipentec.com/test/Maildir
info@ipentec.com:{HMAC-MD5}78ed1abd527d1aa3921f58bfe651b178d23aff2d88ed7b567e30069ad6ae45c6:5000:5000:::::Maildir:/home/vmail/vhosts/ipentec.com/info/Maildir
penguin@ipentec.com:{HMAC-MD5}78ed1abd527d1aa3921f58bfe651b178d23aff2d88ed7b567e30069ad6ae45c6:5000:5000:::::Maildir:/home/vmail/vhosts/ipentec.com/penguin/Maildir
info@ixx.jp:{HMAC-MD5}78ed1abd527d1aa3921f58bfe651b178d23aff2d88ed7b567e30069ad6ae45c6:5000:5000:::::Maildir:/home/vmail/vhosts/ixx.jp/info/Maildir
Maildir形式を採用するためメールボックスのパスの前にMaildir:を追記します。メールボックスのパスはPostfixの設定時にvirtual_mailbox_baseに設定したパスとvmailboxに記載したディレクトリがメールボックスのパスになります。
ディレクトリパスはメールディレクトリ名の"Maildir"まで必要です。
詳しくはこちらの記事を参照してください。
dovecot を起動します。
または
コマンドを実行します。
または
コマンドを実行します。