qmail+vpopmail+courier-imap
qmail+vpopmailに更にCourier-IMAPを使ってIMAP(SSL)を構築してみる
インストール
courier-authlibとcourier-imapをダウンロードし、authlibから先にインストールする
# courier-authlib
export CFLAGS="-DHAVE_OPEN_SMTP_RELAY"
./configure
--prefix=/opt/courier_authlib
--with-authvchkpw
--without-authmysql
--without-authpgsql
make
sudo make install
# courier-imap
./configure
--prefix=/opt/courier_imap
--without-authdaemon
--enable-unicode=iso-2022-jp
COURIERAUTHCONFIG=/opt/courier_authlib/bin/courierauthconfig
CPPFLAGS=-I/opt/courier_authlib/include
make
sudo make install
courier-authlibの設定
/opt/courier_authlib/etc/authlib/authdaemonrc.distを/opt/courier_authlib/etc/authlib/authdaemonrcに変更し、以下の部分を修正する
# 修正するのは以下の二つを先頭にauthvhkpwを持ってくるだけ
authmodulelist="authvchkpw authuserdb (以下省略)"
authmodulelistorig="authvchkpw authuserdb (以下省略)"
courier-imapの設定
ほとんど設定は必要無し。SSLの設定だけを行う
# TLSプロトコルを指定
TLS_PROTOCOL=SSL3
# 証明書ファイルのパスを指定
TLS_CERTFILE=/opt/courier_imap/imap.pem
証明書作成は
openssl req -new -nodes -x509 -days 365 -keyout imap.pem -out imap.pem
サーバー起動・テスト
/opt/courier_imap/libexec/imapd.rc start
/opt/courier_imap/libexec/imapd-ssl.rc start
備考
IMAP over SSLにおいてメールログにSSL3_GET_RECORD:wrong version numberと出た場合には上で設定したTLS_PROTOCOLをSSL3からSSL23にする事で回避可能