Dovecot 说用户不存在,尽管它在 MariaDB 数据库中

Dovecot 说用户不存在,尽管它在 MariaDB 数据库中

我使用 MariaDB 来存储 Dovecot 2.2.10 的用户。Dovecot 一直给出“意外断开连接”错误,我找不到原因。有什么我可以查看的吗?

邮件日志

Aug 29 22:46:15 xxxx postfix/qmgr[3467]: 544A8BB01: from=<>, size=4034, nrcpt=1 (queue active)
Aug 29 22:46:15 xxxx postfix/qmgr[3467]: 65FF1B94D: from=<<myemailaccont>@gmail.com>, size=2769, nrcpt=1 (queue active)
Aug 29 22:46:15 xxxx postfix/qmgr[3467]: CC292B999: from=<[email protected]>, size=411, nrcpt=1 (queue active)
Aug 29 22:46:15 xxxx dovecot: lmtp(1): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
Aug 29 22:46:15 xxxx dovecot: lmtp(1): Connect from local
Aug 29 22:46:15 xxxx dovecot: auth: Debug: Loading modules from directory: /usr/lib64/dovecot/auth
Aug 29 22:46:15 xxxx dovecot: auth: Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_mysql.so
Aug 29 22:46:15 xxxx dovecot: auth: Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
Aug 29 22:46:15 xxxx dovecot: lmtp(12025): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
Aug 29 22:46:15 xxxx dovecot: lmtp(12025): Connect from local
Aug 29 22:46:15 xxxx dovecot: auth: Debug: Read auth token secret from /var/run/dovecot/auth-token-secret.dat
Aug 29 22:46:15 xxxx dovecot: auth: Debug: master in: USER#0111#[email protected]#011service=lmtp
Aug 29 22:46:15 xxxx dovecot: auth: Debug: master in: USER#0111#[email protected]#011service=lmtp
Aug 29 22:46:15 xxxx dovecot: lmtp(12027): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
Aug 29 22:46:15 xxxx dovecot: lmtp(12027): Connect from local
Aug 29 22:46:15 xxxx dovecot: auth: Debug: master in: USER#0111#[email protected]#011service=lmtp
Aug 29 22:46:15 xxxx dovecot: auth-worker(12028): Debug: Loading modules from directory: /usr/lib64/dovecot/auth
Aug 29 22:46:15 xxxx dovecot: auth-worker(12028): Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_mysql.so
Aug 29 22:46:15 xxxx dovecot: auth-worker(12028): Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
Aug 29 22:46:15 xxxx dovecot: auth-worker(12028): Debug: passwd([email protected]): lookup
Aug 29 22:46:15 xxxx dovecot: auth-worker(12028): passwd([email protected]): unknown user
Aug 29 22:46:15 xxxx dovecot: auth: Debug: password([email protected]): passdb doesn't support credential lookups
Aug 29 22:46:15 xxxx dovecot: auth-worker(12028): Debug: sql([email protected]): query: SELECT email as user, password FROM virtual_users WHERE email='[email protected]';
Aug 29 22:46:15 xxxx dovecot: lmtp(1): Error: userdb lookup([email protected]): Disconnected unexpectedly
Aug 29 22:46:15 xxxx dovecot: lmtp(12025): Error: userdb lookup([email protected]): Disconnected unexpectedly
Aug 29 22:46:15 xxxx dovecot: lmtp(12027): Error: userdb lookup([email protected]): Disconnected unexpectedly
Aug 29 22:46:15 xxxx dovecot: auth: Fatal: master: service(auth): child 12023 killed with signal 11 (core dumps disabled)
Aug 29 22:46:15 xxxx dovecot: auth-worker(12031): Debug: Loading modules from directory: /usr/lib64/dovecot/auth
Aug 29 22:46:15 xxxx dovecot: auth-worker(12031): Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_mysql.so
Aug 29 22:46:15 xxxx dovecot: auth-worker(12031): Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
Aug 29 22:46:15 xxxx postfix/lmtp[12020]: 544A8BB01: to=<[email protected]>, relay=xxxx.com[private/dovecot-lmtp], delay=1782, delays=1782/0.02/0/0.06, dsn=4.3.0, status=deferred (host xxxx.com[private/dovecot-lmtp] said: 451 4.3.0 <[email protected]> Internal error occurred. Refer to server log for more information. (in reply to RCPT TO command))
Aug 29 22:46:15 xxxx dovecot: lmtp(1): Disconnect from local: Successful quit
Aug 29 22:46:15 xxxx dovecot: auth-worker(12031): Debug: passwd([email protected]): lookup
Aug 29 22:46:15 xxxx dovecot: auth-worker(12031): passwd([email protected]): unknown user
Aug 29 22:46:15 xxxx postfix/lmtp[12021]: 65FF1B94D: to=<[email protected]>, relay=xxxx.com[private/dovecot-lmtp], delay=1689, delays=1689/0.02/0.01/0.04, dsn=4.3.0, status=deferred (host xxxx.com[private/dovecot-lmtp] said: 451 4.3.0 <[email protected]> Internal error occurred. Refer to server log for more information. (in reply to RCPT TO command))
Aug 29 22:46:15 xxxx dovecot: lmtp(12025): Disconnect from local: Successful quit
Aug 29 22:46:15 xxxx postfix/lmtp[12024]: CC292B999: to=<[email protected]>, relay=xxxx.com[private/dovecot-lmtp], delay=1851, delays=1851/0.02/0.01/0.04, dsn=4.3.0, status=deferred (host xxxx.com[private/dovecot-lmtp] said: 451 4.3.0 <[email protected]> Internal error occurred. Refer to server log for more information. (in reply to RCPT TO command))
Aug 29 22:46:15 xxxx dovecot: lmtp(12027): Disconnect from local: Successful quit
Aug 29 22:46:15 xxxx dovecot: auth-worker(12036): Debug: Loading modules from directory: /usr/lib64/dovecot/auth
Aug 29 22:46:15 xxxx dovecot: auth-worker(12036): Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_mysql.so
Aug 29 22:46:15 xxxx dovecot: auth-worker(12036): Debug: Module loaded: /usr/lib64/dovecot/auth/libdriver_sqlite.so
Aug 29 22:46:15 xxxx dovecot: auth-worker(12036): Debug: passwd([email protected]): lookup
Aug 29 22:46:15 xxxx dovecot: auth-worker(12036): passwd([email protected]): unknown user

重要的部分是:

Aug 29 22:46:15 xxxx dovecot: auth-worker(12028): Debug: passwd([email protected]): lookup
Aug 29 22:46:15 xxxx dovecot: auth-worker(12028): passwd([email protected]): unknown user
Aug 29 22:46:15 xxxx dovecot: auth: Debug: password([email protected]): passdb doesn't support credential lookups
Aug 29 22:46:15 xxxx dovecot: auth-worker(12028): Debug: sql([email protected]): query: SELECT email as user, password FROM virtual_users WHERE email='[email protected]';
Aug 29 22:46:15 xxxx dovecot: lmtp(1): Error: userdb lookup([email protected]): Disconnected unexpectedly
Aug 29 22:46:15 xxxx dovecot: lmtp(12025): Error: userdb lookup([email protected]): Disconnected unexpectedly
Aug 29 22:46:15 xxxx dovecot: lmtp(12027): Error: userdb lookup([email protected]): Disconnected unexpectedly
Aug 29 22:46:15 xxxx dovecot: auth: Fatal: master: service(auth): child 12023 killed with signal 11 (core dumps disabled)

“不支持凭证查找”是什么意思?这是 MariaDB 或 Dovecot 的问题吗?

Dovecot 配置

[root@myhost ~]# doveconf -n
# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-1160.95.1.el7.x86_64 x86_64 CentOS Linux release 7.9.2009 (Core) ext4
auth_debug = yes
auth_mechanisms = plain login
auth_verbose = yes
mail_debug = yes
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_privileged_group = mail
mbox_write_locks = fcntl
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix = 
}
passdb {
  driver = pam
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  unix_listener auth-userdb {
    mode = 0600
    user = vmail
  }
  user = dovecot
}
service imap-login {
  inet_listener imap {
    port = 0
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
service pop3-login {
  inet_listener pop3 {
    port = 0
  }
  inet_listener pop3s {
    port = 995
    ssl = yes
  }
}
ssl = required
ssl_cert = </etc/letsencrypt/live/xxxx.com/fullchain.pem
ssl_key = </etc/letsencrypt/live/xxxx.com/privkey.pem
userdb {
  driver = passwd
}
userdb {
  args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
  driver = static
}
verbose_ssl = yes

MariaDB 表

该用户确实存在:

MariaDB [(none)]> SELECT * FROM mailserver.virtual_domains;
+----+--------------------+
| id | name               |
+----+--------------------+
|  1 | xxxx.com           |
|  2 | xxxx.xxxx.com      |
|  3 | xxxx               |
|  4 | localhost.xxxx.com |
+----+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]> SELECT * FROM mailserver.virtual_users;
+----+-----------+--------------+----------------+
| id | domain_id | password     | email          |
+----+-----------+--------------+----------------+
|  1 |         1 | <mypassword> | [email protected] |
|  2 |         1 | <mypassword> | [email protected] |
+----+-----------+--------------+----------------+
2 rows in set (0.00 sec)

答案1

好吧,无论如何我解决了这个问题。但是,这实际上不是一个解决方案。我只是简单地将我的 dovecot 更新到最新版本(从 2.2.10 到 2.2.36)。我不知道为什么这样做有效(可能是因为某种超自然力量)。所以,如果有人知道为什么 dovecot 2.2.10 不能与 MariaDB 正常工作,请在下面回答。

相关内容