![区分大小写的 LDAP 用户登录 Dovecot 时出现问题](https://linux22.com/image/803882/%E5%8C%BA%E5%88%86%E5%A4%A7%E5%B0%8F%E5%86%99%E7%9A%84%20LDAP%20%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95%20Dovecot%20%E6%97%B6%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
我向 dovecot 列表询问了这个问题,但没有结果,所以我也会在这里尝试。请原谅我转发了帖子。
我有一个在 Debian Squeeze 上运行 Dovecot-Postfix 的客户端。我使用的是 Squeeze 存储库中的 Dovecot。
# dovecot --version
1.2.15
我已经实现了一个中央 mail_location 并且正在使用一个 vmail 用户,因为我认为这是实现共享和公共邮箱的最佳方法。
# dovecot -n
# 1.2.15: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-5-xen-686 i686 Debian 6.0.7 ext3
log_timestamp: %Y-%m-%d %H:%M:%S
protocols: imap imaps pop3s managesieve
listen(default): 127.0.0.1:143
listen(imap): 127.0.0.1:143
listen(pop3): 127.0.0.1:110
listen(managesieve): *
ssl_listen(default): *:993
ssl_listen(imap): *:993
ssl_listen(pop3): *:995
ssl_listen(managesieve):
ssl_ca_file: /etc/ssl/certs/RapidSSL_CA_bundle.pem
ssl_cert_file: /etc/ssl/certs/mail.example.com.2013.chain.pem
ssl_key_file: /etc/ssl/private/example.2013.key
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
login_executable(managesieve): /usr/lib/dovecot/managesieve-login
mail_max_userip_connections(default): 40
mail_max_userip_connections(imap): 40
mail_max_userip_connections(pop3): 10
mail_max_userip_connections(managesieve): 10
mail_privileged_group: mail
mail_uid: vmail
mail_gid: vmail
mail_location: maildir:/var/spool/dovecot/%d/%u
mbox_write_locks: fcntl dotlock
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_executable(managesieve): /usr/lib/dovecot/managesieve
mail_plugins(default): quota imap_quota
mail_plugins(imap): quota imap_quota
mail_plugins(pop3):
mail_plugins(managesieve):
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
mail_plugin_dir(managesieve): /usr/lib/dovecot/modules/managesieve
namespace:
type: private
separator: /
inbox: yes
list: yes
subscriptions: yes
lda:
postmaster_address: [email protected]
mail_plugins: sieve quota
log_path: /var/log/dovecot-deliver.log
info_log_path: /var/log/dovecot-deliver.log
auth default:
mechanisms: plain login
passdb:
driver: ldap
args: /etc/dovecot/dovecot-ldap.conf
userdb:
driver: ldap
args: /etc/dovecot/dovecot-ldap-userdb.conf
socket:
type: listen
client:
path: /var/spool/postfix/private/auth
mode: 432
user: postfix
group: postfix
master:
path: /var/run/dovecot/auth-master
mode: 384
user: vmail
group: vmail
plugin:
quota: maildir:User
quota_rule: *:storage=1200M
quota_rule2: Deleted Messages:storage=10%%
quota_rule3: Deleted Items:storage=10%%
quota_rule4: Trash:storage=10%%
sieve: /var/spool/sieve/%d/%u/.dovecot.sieve
sieve_dir: /var/spool/sieve/%d/%u
所有邮件用户都只是 LDAP 用户(不是本地 UNIX 用户 - 不使用 nsswitch)。dovecot-ldap-userdb.conf 是 dovecot-ldap.conf 的符号链接
# grep -v '^ *\(#.*\)\?$' /etc/dovecot/dovecot-ldap.conf
uris = ldaps://mail.example.com/
dn = uid=mail,ou=Services,dc=example,dc=com
dnpass = ******************
tls_require_cert = hard
auth_bind = yes
base = ou=People,dc=example,dc=com
user_attrs = quota=quota_rule=*:storage=%$M
user_filter = (&(objectClass=posixAccount)(mail=%u))
pass_attrs = uid=mail,userPassword=password
pass_filter = (&(objectClass=posixAccount)(mail=%u))
现在,邮件地址为[电子邮件保护]和[电子邮件保护]正确地传递到正确的邮件位置 /var/spool/dovecot/example.com/user,但当用户在 IMAP 客户端中创建电子邮件帐户时,如果用户名中包含大写字符,则会出现问题,例如[电子邮件保护]。这将在 /var/spool/dovecot/exaMPLE.com/user 创建一个新目录,该目录不会接收任何邮件。是否可以忽略用户在邮件客户端中输入的大小写,并始终将他们引导至小写邮件目录?在哪里可以做到这一点?
答案1
您使用的 Dovecot 版本非常老旧,几乎已经过时三年了。我建议您升级到较新的版本,2.2.5 是最新版本。该版本已进行了无数改进和修复,您的设置必定会从中受益。
也就是说,您应该设置auth_username_format = %Lu
Dovecotdovecot.conf
在查找之前将用户名转换为小写。这将使用户名标准化为小写,无论用户在其邮件客户端中设置什么。
注意:从 Dovecot 2.1.x 开始,小写用户名是默认行为。