Dovecot虚拟用户不authentication

我们有一个标准的Postfix / Dovecot安装与真实用户完美的工作,但不能解决如何添加虚拟用户,所有的虚拟用户login尝试失败,身份validation错误。

以下是来自configuration文件的片段: /etc/postfix/main.cf:

 virtual_mailbox_domains = virtualexample.com
 virtual_mailbox_base = / var / spool / vhosts
 virtual_mailbox_recipients = hash:/ etc / postfix / virtual_mailbox_recipients 

/etc/dovecot/dovecot.conf:
!include conf.d / *。conf

/etc/dovecot/conf.d/10-auth.conf
auth_mechanisms = cram-md5 digest -md5 plain
passdb {
驱动程序= passwd文件
#passwd文件的path。 还要设置默认的密码scheme。
args = scheme = cram-md5 /etc/cram-md5.pwd
}

/etc/cram-md5.pwd
[email protected]:{} MD5 $ 1 $ uIMvzy92 $ 9Xt67B / qw4u6txkkxzne80
这是login尝试时日志中的一个片段:


auth:Debug:从目录加载模块:/ usr / lib64 / dovecot / auth
auth:Debug:加载模块:/usr/lib64/dovecot/auth/libauthdb_ldap.so
auth:Debug:加载模块:/usr/lib64/dovecot/auth/libdriver_sqlite.so
auth:Debug:加载模块:/usr/lib64/dovecot/auth/libmech_gssapi.so
auth:Debug:passwd-file /etc/cram-md5.pwd:阅读1个用户
auth:Debug:auth client connected(pid = 21990)
auth:Debug:client in:AUTH#0111#011CRAM-MD5#011service = imap#011lip = 1.1.1.1#011rip = 2.2.2.2#011lport = 143#011rport = 51774
auth:Debug:client out:CONT#0111#011PDI1Njc0NjQ1NzQ3MTY0NTkuMTM0MTIxNzkwN0BncDM +
auth:Debug:客户端:CONT
auth:Debug:passwd-file(virtualuser @ virtualexample.com,2.2.2.2):lookup:[email protected] file = / etc / cram-md5.pwd
auth:Debug:client out:OK#0111#011user = [email protected]
auth:Debug:master in:请求#0111630404609#01121990#0111#011b66b5f46b520a08e1d19d3d249be7073
auth:Debug:passwd(virtualuser @ virtualexample.com,2.2.2.2):lookup
auth:passwd(virtualuser @ virtualexample.com,2.2.2.2):未知用户
auth:错误:userdb(virtualuser @ virtualexample.com,2.2.2.2):userdb未finduserdb passwd
auth:Debug:master out:NOTFOUND#0111630404609
imap:错误:未从用户数据库中find经过身份validation的用户,auth lookup id = 1630404609(client-pid = 21990 client-id = 1)
imap-login:内部login失败(pid = 21990 id = 1)(auth失败,1次尝试):user =,method = CRAM-MD5,rip = 2.2.2.2,lip = 1.1.1.1,mpid = 21993
auth:Debug:auth客户端连接(pid = 22010)
auth:Debug:client in:AUTH#0111#011CRAM-MD5#011service = imap#011lip = 1.1.1.1#011rip = 2.2.2.2#011lport = 143#011rport = 51775
auth:Debug:client out:CONT#0111#011PDcxMDkwNDY1NTQzODUzMDkuMTM0MTIxNzkyOEBncDM +
auth:Debug:客户端:CONT
auth:Debug:passwd-file(virtualuser @ virtualexample.com,2.2.2.2):lookup:[email protected] file = / etc / cram-md5.pwd
auth:Debug:client out:OK#0111#011user = [email protected]
auth:Debug:master in:请求#011343539713#01122010#0111#011e47b1345784e2845d59e794afa9a6bbe
auth:Debug:passwd(virtualuser @ virtualexample.com,2.2.2.2):lookup
auth:passwd(virtualuser @ virtualexample.com,2.2.2.2):未知用户
auth:错误:userdb(virtualuser @ virtualexample.com,2.2.2.2):userdb未finduserdb passwd
auth:Debug:master out:NOTFOUND#011343539713
imap:错误:从userdb中找不到validation的用户,auth lookup id = 343539713(client-pid = 22010 client-id = 1)
imap-login:内部login失败(pid = 22010 id = 1)(auth失败,1次尝试):user =,method = CRAM-MD5,rip = 2.2.2.2,lip = 1.1.1.1,mpid = 22011

看起来,用户查找不起作用,即使日志表明Dovecot正在使用/etc/cram-md5.pwd文件,并且用户被configuration在同一个文件中。

当然有数十个使用Dovecot的虚拟用户的例子,但是我们发现的所有的例子都是指Dovecot 1.x(我们使用2.x),只使用虚拟用户(我们必须使用真正的和虚拟的用户)或者想要使用一个MySQL数据库,我们需要使用一个文本文件。

dovecot.org上的例子很好,但是他们没有提供的例子是如何在不使用MYSQL的情况下结合真实和虚拟用户的例子。

有关我们出错的一些提示将非常感激。 编辑

config中主要的缺失部分是/etc/dovecot/conf.d/10-auth.conf文件中缺less'userdb'部分。 现在看起来像这样:


passdb {
驱动程序= passwd文件
#passwd文件的path。 还要设置默认的密码scheme。
args = scheme = cram-md5 /etc/cram-md5.pwd
}
userdb {
司机=静态
args = uid = vmail gid = vmail home = / var / spool / vhosts /%d /%n / etc / dovecot / userdb
}

一个新的用户和组“vmail”也被创build并赋予了虚拟用户的“home”目录的所有权。

这些改变已经完成了大部分的工作,现在我们可以发送邮件给虚拟用户,遗憾的是还有一些与真实用户有关的缺失,因为系统现在正在寻找他们的电子邮件的错误的地方,所以他们都消失了。 我们将为这个主题创build一个新的问题,因为它是一个相关的问题,真实的和虚拟的用户,而不是关于authentication。

我第一眼就注意到的是,您在/etc/cram-md5.pwd文件中错过了用户名和密码之间的冒号。 在这里您可以find关于文件格式和如何生成密码的更多信息。

编辑:此外,您的用户密码似乎被encryption使用MD5scheme,而在Dovecot维基陈述 , "if you're going to use CRAM-MD5 authentication, the password needs to be stored in either PLAIN or CRAM-MD5 scheme. If you want to allow both CRAM-MD5 and DIGEST-MD5, the password must be stored in plaintext." 但是,我不确定这是否是“未find用户”问题的根本原因。