我试图build立一个非常简单的共享邮件服务器,其中每个“域”是一个系统用户,即“example.com”是一个真正的用户/home/example.com/,5001的uid和gid' example.com“的5001。
每个域\用户在其主目录中都有自己的maildir,并且具有与该域相关联的虚拟邮件用户的普通passwd文件。
Dovecot版本&configuration信息:
# dovecot -n # 2.2.13: /etc/dovecot/dovecot.conf # OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.8 auth_mechanisms = plain login auth_verbose = yes disable_plaintext_auth = no mail_location = mbox:~/mail:INBOX=/var/mail/%u 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 { args = username_format=%n /home/%d/mail_users driver = passwd-file } protocols = " imap lmtp pop3" ssl = no userdb { args = username_format=%n /home/%d/mail_users default_fields = uid=%d gid=%d home=/home/%d/mail/%n mail=maildir:/home/%d/mail/%n driver = passwd-file }
每次尝试连接到pop3 \ imap端口时,服务器中出现以下错误
dovecot: auth: Fatal: passwd-file userdb: Invalid uid: %d dovecot: master: Error: service(auth): command startup failed, throttling for 2 secs dovecot: imap-login: Disconnected: Auth process broken (disconnected before auth was ready, waited 0 secs): user=<>, rip=192.168.30.10, lip=192.168.20.201, session=<2rgGLBkQ/wDAqB4K>
客户看到:
$ telnet 192.168.20.201 imap Trying 192.168.20.201... Connected to 192.168.20.201. Escape character is '^]'. * BYE Disconnected: Auth process broken Connection closed by foreign host.
检查维基( http://wiki2.dovecot.org/UserDatabase#Userdb_settings )明确指出,default_fields值支持%variables,所以我不知道是否缺less一些其他需要这个工作的configuration。
在客户端发出USER \ LOGIN命令之前,我知道没有提取%d域部分的用户名,因此失败了。 我不明白的是,为什么在客户端发出authentication尝试之前有一个Dovecotauthentication尝试。
如果我改变configuration为一个固定的uid \ gid
default_fields = uid=example.com gid=example.com home=/home/%d/mail/%n mail=maildir:/home/%d/mail/%n
连接被允许一个正确的authentication命令可以发出。 但是,当然访问邮箱的任何用户不是example.com域失败。