redhat(linux)上でのvpopmailインストール

前回のqmailのインストール後の作業になります。

1.材料

vpopmail-5.4.12.tar.gz

2.ユーザアカウントの作成

/etc/groupに以下の行を追加します。

vchkpw:x:89:

下記コマンドでvpopmail用ユーザを追加します。(インストールディレクトリ:/home/vpopmail)

# /usr/sbin/useradd -g vchkpw -d /home/vpopmail -s /sbin/nologin -u 89 vpopmail

3.configure

上記アーカイブ解凍後、下記コマンドでconfigureします。

下記の例では、/home/vpopmailがインストールディレクトリです。

./configure \
–prefix=/home/vpopmail \
–enable-vpopuser=vpopmail \
–enable-vpopgroup=vchkpw \
–enable-roaming-users=y \
–enable-relay-clear-minutes=15 \
–enable-tcpserver-path=/home/vpopmail/etc/tcp.smtp \
–enable-clear-passwd=n –enable-ip-alias-domains=n \
–enable-logging=y \
–enable-log-name=vpopmail

vpopmailではmysqlを使いアカウント管理を行うことも可能ですが、上記configureではその機能は使えません。

vpopmail 5.4.12
Current settings
—————————————

vpopmail directory = /var/qmail
uid = 89
gid = 89
roaming users = ON –enable-roaming-users
tcpserver file = /var/qmail/etc/tcp.smtp
open_smtp file = /var/qmail/etc/open-smtp
rebuild tcpserver file = ON –enable-rebuild-tcpserver-file (default)
password learning = OFF –disable-learn-passwords (default)
md5 passwords = ON –enable-md5-passwords (default)
file locking = ON –enable-file-locking (default)
vdelivermail fsync = OFF –disable-file-sync (default)
make seekable = ON –enable-make-seekable (default)
clear passwd = OFF –disable-clear-passwd
user dir hashing = ON –enable-users-big-dir (default)
address extensions = OFF –disable-qmail-ext (default)
ip alias = OFF –disable-ip-alias-domains (default)
auth module = cdb –enable-auth-module=cdb (default)
auth inc = -Icdb
auth lib =
system passwords = OFF –disable-passwd (default)
pop syslog = show successful and failed login attempts
–enable-logging=y
auth logging = ON –enable-auth-logging (default)

のようなメッセージが出れば configureが成功したことになります。

4.インストール

# make install

で完了です。

5.tcprules用設定ファイル

tcprules用のファイルを2つ用意します。上記のconfig結果で表示されている tcpserver file がそれにあたります。もうひとつはpop起動用になります。

# vi /var/qmail/etc/tcp.smtp
127.0:allow,RELAYCLIENT=””
:allow

# vi /var/qmail/etc/tcp.pop3

127.:allow,RELAYCLIENT=””

6.起動ファイル

vpopmailはqmailの起動ファイル/var/qmail/rcで起動されます。

以下サンプルです。(ホスト名=mail.sample.comの場合)

#!/bin/sh
#
# qmail This shell script takes care
# of starting and stopping qmail.
#
# chkconfig: 2345 80 30
# description: Starts and stops qmail.

case “$1″ in
start)
echo -n ” STEP 1 : CDB ”
/usr/local/bin/tcprules /var/qmail/etc/tcp.smtp.cdb \
/var/qmail/etc/tcp.smtp.tmp < /var/qmail/etc/tcp.smtp

/usr/local/bin/tcprules /var/qmail/etc/tcp.pop3.cdb \
/var/qmail/etc/tcp.pop3.tmp < /var/qmail/etc/tcp.pop3

exec env – PATH=”/var/qmail/bin:$PATH” \
qmail-start ./Maildir/ splogger qmail &
#
# SMTP
#
/usr/local/bin/tcpserver -v -x /var/qmail/etc/tcp.smtp.cdb -HR -u 89 -g 89 0 smtp \
/usr/local/bin/rblsmtpd -r bl.spamcop.net -r list.dsbl.org -r sbl-xbl.spamhaus.org \
/var/qmail/bin/qmail-smtpd 2>&1 | /var/qmail/bin/splogger smtpd 3 &

#
#
# POP3
#
/usr/local/bin/tcpserver -v -x /var/qmail/etc/tcp.pop3.cdb -HR -u 89 -g 89 0 pop3 \
/var/qmail/bin/qmail-popup mail.sample.com \
/var/qmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2>&1 | /var/qmail/bin/splogger pop3d 3 &

touch /var/lock/qmail
exit 0
;;

stop)
echo “Shutting down qmail.”
PID=`/bin/ps -aefw | grep qmail | awk ‘{print $2}’`
if [ ! -z “$PID” ] ; then
/bin/kill ${PID} 1> /dev/null 2>&1
fi
rm -f /var/lock/qmail
;;
*)
echo “Usage: `basename $0` {start|stop}” >&2
exit 64
;;
esac

※追記

後日、別サーバ(FreeBSD)にインストールしているときにハマった記録。

vpopmailインストール後、rcスクリプトで起動したが、popログインが失敗する状態に陥った。rcスクリプトのファイルパスの確認、vpopmailの再config,make,installでも状況は変わらなかった。telnetコマンドでのpopアクセス結果は下記の通り。(アカウント:test@sample.jp)

% telnet sample.jp pop3
Trying ***.**.***.**…
Connected to sample.jp.
Escape character is ‘^]’.
+OK Qpopper (version 4.0.9) at sample.jp starting. <44233.1193382175@sample.jp>
USER test@sample.jp
+OK Password required for test@sample.jp.
PASS *****

-ERR [AUTH] Password supplied for “test@sample.jp” is incorrect.
+OK Pop server at sample.jp signing off.

色々考えた挙句、/etc/inetd.conf を再度確認すると、

pop3 stream tcp nowait root /usr/local/libexec/qpopper qpopper -s

が記載されたままであった。。これをコメントアウトし

# kill -HUP [inetdのpid]

にてinetdをrefreshして、rcスクリプトでqmailを再起動したら、OKになった。

※正常時のtelnetでのpop確認結果。

% telnet sample.jp pop3
Trying **.**.**.**…
Connected to sample.jp.
Escape character is ‘^]’.
+OK <50025.1193387158@**.**.**.**>
user test@sample.jp
+OK
pass ***

+OK
quit
+OK
Connection closed by foreign host.

qmailからvpopmailに乗り換えるときには、上記の点に注意が必要です。