dovecot の基本的な設定 (POP3)

(1) サービス起動直後

ログインできない。

# id test01
uid=502(test01) gid=502(test01) 所属グループ=502(test01)
#
# ls -l /var/spool/mail/| grep test
-rw-rw----  1 test01   mail   0  8月 28 02:39 2014 test01
# ls -laR /home/test01/
/home/test01/:
合計 20
drwx------  2 test01 test01 4096  8月 28 02:39 2014 .
drwxr-xr-x. 5 root   root   4096  8月 28 02:39 2014 ..
-rw-r--r--  1 test01 test01   18  2月 22 06:09 2013 .bash_logout
-rw-r--r--  1 test01 test01  176  2月 22 06:09 2013 .bash_profile
-rw-r--r--  1 test01 test01  124  2月 22 06:09 2013 .bashrc
#
# telnet localhost 110
Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user test01
+OK
pass test
Connection closed by foreign host.
#

以下は、maillog

Aug 28 02:40:34 LVS dovecot: master: Dovecot v2.0.9 starting up (core dumps disabled)
Aug 28 02:40:53 LVS dovecot: pop3-login: Login: user=<test01>, method=PLAIN, rip=::1, lip=::1, mpid=1737, secured
Aug 28 02:40:53 LVS dovecot: pop3(test01): Error: user test01: Initialization failed: mail_location not set and autodetection failed: Mail storage autodetection failed with home=/home/test01
Aug 28 02:40:53 LVS dovecot: pop3(test01): Error: Invalid user settings. Refer to server log for more information.


(2) 基本的な設定

/etc/dovecot/conf.d/10-mail.conf に以下を追加

#メールボックスの位置の指定
mail_location = mbox:~/mail:INBOX=/var/mail/%u

#メールボックスの作成で必要
mail_access_groups=mail

/etc/dovecot/conf.d/10-auth.conf に以下を追加

#外部からの接続 (平文での接続) を許可
disable_plaintext_auth = no

※以下は参考 URL
http://server-setting.info/centos/dovecot.html
http://www.atmarkit.co.jp/fnetwork/rensai/netpro07/pop3-commands.html


ログイン (telnet コマンド) できた。

#  telnet localhost 110
Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user test01
+OK
pass test
+OK Logged in.
stat
+OK 0 0
quit
+OK Logging out.
Connection closed by foreign host.

ログイン後のファイルの生成状況は以下のとおり。

# ls -l /var/spool/mail/| grep test
-rw-rw----  1 test01   mail   0  8月 28 02:39 2014 test01
# ls -laR /home/test01/
/home/test01/:
合計 24
drwx------  3 test01 test01 4096  8月 28 02:52 2014 .
drwxr-xr-x. 5 root   root   4096  8月 28 02:39 2014 ..
-rw-r--r--  1 test01 test01   18  2月 22 06:09 2013 .bash_logout
-rw-r--r--  1 test01 test01  176  2月 22 06:09 2013 .bash_profile
-rw-r--r--  1 test01 test01  124  2月 22 06:09 2013 .bashrc
drwx------  3 test01 test01 4096  8月 28 02:52 2014 mail

/home/test01/mail:
合計 12
drwx------ 3 test01 test01 4096  8月 28 02:52 2014 .
drwx------ 3 test01 test01 4096  8月 28 02:52 2014 ..
drwx------ 3 test01 test01 4096  8月 28 02:52 2014 .imap

/home/test01/mail/.imap:
合計 12
drwx------ 3 test01 test01 4096  8月 28 02:52 2014 .
drwx------ 3 test01 test01 4096  8月 28 02:52 2014 ..
drwxrwx--- 2 test01 mail   4096  8月 28 02:52 2014 INBOX

/home/test01/mail/.imap/INBOX:
合計 12
drwxrwx--- 2 test01 mail   4096  8月 28 02:52 2014 .
drwx------ 3 test01 test01 4096  8月 28 02:52 2014 ..
-rw-rw---- 1 test01 mail    148  8月 28 02:52 2014 dovecot.index.log★ログイン時、生成された
#


以下は、maillog

Aug 28 02:52:54 LVS dovecot: pop3-login: Login: user=<test01>, method=PLAIN, rip=::1, lip=::1, mpid=1780, secured
Aug 28 02:52:58 LVS dovecot: pop3(test01): Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0


※参考ドキュメント
http://www.dovecot.jp/wiki/BasicConfiguration.txt