


CentOS 7にDovecotをインストールしました。
Dovecot
https://www.dovecot.org/
環境
・CentOS Linux release 7.3.1611 (Core)
・Kernel 3.10.0-514.16.1.el7.x86_64
・Dovecot 2.2.10
- インストール
- 基本設定(/etc/dovecot/dovecot.conf)
- 詳細設定(/etc/dovecot/conf.d/)
- ログイン認証の設定(/etc/dovecot/conf.d/10-auth.conf)
- メール保存形式の設定(/etc/dovecot/conf.d/10-mail.conf)
- 自動起動設定
- 起動設定
- テスト
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# yum -y install dovecot # yum info dovecot Loaded plugins: fastestmirror Installed Packages Name : dovecot Arch : x86_64 Epoch : 1 Version : 2.2.10 Release : 7.el7 Size : 9.8 M Repo : installed From repo : base Summary : Secure imap and pop3 server URL : http://www.dovecot.org/ License : MIT and LGPLv2 Description : Dovecot is an IMAP server for Linux/UNIX-like systems, written with security : primarily in mind. It also contains a small POP3 server. It supports mail : in either of maildir or mbox formats. : : The SQL drivers and authentication plug-ins are in their subpackages. |
そのままでも問題なにのですがlmtpは使う予定が無いので無効にしました。
またログイン返答メッセージも変更しました。
1 2 3 4 5 6 |
# vi /etc/dovecot/dovecot.conf # cat /etc/dovecot/dovecot.conf (snip) protocols = imap pop3 login_greeting = pop3/imap ready. (snip) |
各機能については/etc/dovecot/conf.d/ のそれぞれのファイルで設定します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# ls -l /etc/dovecot/conf.d/ -rw-r--r-- 1 root root 5296 Apr 17 2013 10-auth.conf -rw-r--r-- 1 root root 1893 Mar 14 2013 10-director.conf -rw-r--r-- 1 root root 2727 Nov 20 2013 10-logging.conf -rw-r--r-- 1 root root 15515 Nov 6 04:21 10-mail.conf -rw-r--r-- 1 root root 3383 Mar 14 2013 10-master.conf -rw-r--r-- 1 root root 2331 Nov 6 04:21 10-ssl.conf -rw-r--r-- 1 root root 1668 Apr 17 2013 15-lda.conf -rw-r--r-- 1 root root 1137 Mar 14 2013 15-mailboxes.conf -rw-r--r-- 1 root root 2425 May 20 2013 20-imap.conf -rw-r--r-- 1 root root 574 Mar 14 2013 20-lmtp.conf -rw-r--r-- 1 root root 4007 May 20 2013 20-pop3.conf -rw-r--r-- 1 root root 676 Mar 14 2013 90-acl.conf -rw-r--r-- 1 root root 292 Mar 14 2013 90-plugin.conf -rw-r--r-- 1 root root 2502 Apr 17 2013 90-quota.conf -rw-r--r-- 1 root root 499 May 20 2013 auth-checkpassword.conf.ext -rw-r--r-- 1 root root 489 May 20 2013 auth-deny.conf.ext -rw-r--r-- 1 root root 343 May 20 2013 auth-dict.conf.ext -rw-r--r-- 1 root root 924 May 20 2013 auth-ldap.conf.ext -rw-r--r-- 1 root root 561 May 20 2013 auth-master.conf.ext -rw-r--r-- 1 root root 515 May 20 2013 auth-passwdfile.conf.ext -rw-r--r-- 1 root root 788 May 20 2013 auth-sql.conf.ext -rw-r--r-- 1 root root 611 May 20 2013 auth-static.conf.ext -rw-r--r-- 1 root root 2185 May 20 2013 auth-system.conf.ext -rw-r--r-- 1 root root 330 May 20 2013 auth-vpopmail.conf.ext |
プレーンテキスト(暗号化無し)でのログインを許可します。
1 2 3 4 5 |
# vi /etc/dovecot/conf.d/10-auth.conf # cat /etc/dovecot/conf.d/10-auth.conf (snip) disable_plaintext_auth = no (snip) |
配送されたメールが保存されている形式を設定します。
1 2 3 4 5 |
# vi /etc/dovecot/conf.d/10-mail.conf # cat /etc/dovecot/conf.d/10-mail.conf (snip) mail_location = maildir:~/Maildir (snip) |
1 |
# systemctl enable dovecot |
1 |
# systemctl start dovecot |
メールを送信してpop3のテストをします。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# telnet localhost pop3 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. +OK pop3/imap ready. user testuser +OK pass PassWordDAYO +OK Logged in. list +OK 2 messages: 1 9345 2 8534 quit +OK Logging out. Connection closed by foreign host. |
ちなみにインストールしてdovecotを起動するだけでポートが開きました。
使用する、しないに関わらずポートが開くとなるとFirewall等でブロックすることになるのでしょうか?
1 2 3 4 5 6 7 8 9 |
# netstat -at | grep -e pop -e imap tcp 0 0 0.0.0.0:pop3 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:imap 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:imaps 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:pop3s 0.0.0.0:* LISTEN tcp6 0 0 [::]:pop3 [::]:* LISTEN tcp6 0 0 [::]:imap [::]:* LISTEN tcp6 0 0 [::]:imaps [::]:* LISTEN tcp6 0 0 [::]:pop3s [::]:* LISTEN |
【2018/07/27 追記】
pop3でエラーが表示されていました。
dovecot: pop3-login: Disconnected (tried to use disallowed plaintext auth): user=<>, rip=
disable_plaintext_auth = no を設定したにも関わらず Dovecot で PlainTextの認証ができない – (tried to use disallowed plaintext auth)のログが記録される
https://www.ipentec.com/document/linux-dovecot-error-tried-to-use-disallowed-plaintext-auth
/etc/dovecot/conf.d/10-ssl.conf
sslの利用予定が無いのであればssl = requiredをssl = noに変更すればリモートでpop3接続できます。
1 2 3 4 5 6 7 8 9 |
## ## SSL settings ## # 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 = no |
ローカルで接続試験を行ったので見落としてた。