我在 Amazon EC2 Linux 上安装了 Postfix、Dovecot、Roundcube 和 Postfixadmin。
我分别配置了 Postfix、Dovecot、Roundcube 和 Postfixadmin,可以通过 Postfixadmin 创建新邮箱,但是无法通过 Roundcube 登录新建的邮箱,Roundcube 日志显示:
IMAP 错误:登录失败[电子邮件保护]来自 11.22.33.44。AUTHENTICATE PLAIN:身份验证失败。位于 /var/www/html/roundcube/program/lib/Roundcube/rcube_imap.php 第 193 行 (POST /roundcube/?_task=login&_action=login)
对于/var/log/maillog
,它显示:
ip-172-31-13-226 dovecot:imap-login:已断开连接(身份验证失败,4 秒内尝试 1 次):用户 =、方法 = PLAIN、rip = 127.0.0.1、lip = 127.0.0.1、安全、会话 =
Dovecot 配置更改如下(/etc/dovecot/dovecot.conf
):
protocols = imap lmtp
dict {
}
!include conf.d/*.conf
!include_try local.conf
对于conf.d/10-mail.conf
:
mail_location = maildir:~/Maildir
namespace inbox {
}
mbox_write_locks = fcntl
对于conf.d/10-master.conf
:
service imap-login {
inet_listener imap {
}
inet_listener imaps {
}
}
service pop3-login {
inet_listener pop3 {
}
inet_listener pop3s {
}
}
service lmtp {
unix_listener lmtp {
}
}
service imap {
}
service pop3 {
}
service auth {
unix_listener auth-userdb {
user = postfix
group = postfix
}
}
service auth-worker {
}
service dict {
unix_listener dict {
}
}
为了conf.d/10-auth.conf
:
disable_plaintext_auth = no
!include auth-system.conf.ext
持续conf.d/auth-system.conf.ext
:
passdb {
driver = pam
}
userdb {
driver = passwd
}
那么我到底配置了什么错误导致登录失败呢?
启用auth_debug = yes
和后auth_verbose = yes
,显示的日志如下/var/log/maillog
:
May 31 02:43:30 ip-11-22-33-44 dovecot: auth: Debug: Loading modules from directory: /usr/lib64/dovecot/auth
May 31 02:43:30 ip-11-22-33-44 dovecot: auth: Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
May 31 02:43:30 ip-11-22-33-44 dovecot: auth: Debug: Read auth token secret from /var/run/dovecot/auth-token-secret.dat
May 31 02:43:30 ip-11-22-33-44 dovecot: auth: Debug: auth client connected (pid=12671)
May 31 02:43:30 ip-11-22-33-44 dovecot: auth: Debug: client in: AUTH#0111#011PLAIN#011service=imap#011secured#011session=2vyhVho0cgB/AAAB#011lip=127.0.0.1#011rip=127.0.0.1#011lport=143#011rport=49266#011resp=<hidden>
May 31 02:43:30 ip-11-22-33-44 dovecot: auth-worker(12673): Debug: Loading modules from directory: /usr/lib64/dovecot/auth
May 31 02:43:30 ip-11-22-33-44 dovecot: auth-worker(12673): Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
May 31 02:43:30 ip-11-22-33-44 dovecot: auth-worker(12673): Debug: pam([email protected],127.0.0.1): lookup service=dovecot
May 31 02:43:30 ip-11-22-33-44 dovecot: auth-worker(12673): Debug: pam([email protected],127.0.0.1): #1/1 style=1 msg=Password:
May 31 02:43:32 ip-11-22-33-44 dovecot: auth-worker(12673): pam([email protected],127.0.0.1): unknown user
May 31 02:43:34 ip-11-22-33-44 dovecot: auth: Debug: client passdb out: FAIL#0111#[email protected]
May 31 02:43:34 ip-11-22-33-44 dovecot: imap-login: Disconnected (auth failed, 1 attempts in 4 secs): user=<[email protected]>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<2vyhVho0cgB/AAAB>
出现“未知用户”错误。看来 Dovecot / Roundcube 读取的不是同一个用户数据库。我如何确保它们读取的是同一个用户数据库?