我有一个电子邮件系统,是根据此处的 ISPMail 指南大致设置的 -https://workaround.org/ispmail/buster/
我正在尝试设置一个用于自动密码方案迁移的脚本,但遇到了问题。我一直在遵循类似这样的指南:https://wiki.dovecot.org/HowTo/ConvertPasswordSchemes
每当我启用 userdb 预取时,Couldn't drop privileges: User is missing UID (see mail_uid setting)
就会出现错误。
我的user_query和password_query如下:
user_query = SELECT user, \ concat('*:bytes=', quota) AS quota_rule, \ '/var/vmail/%d/%n' AS home, \ 5000 AS uid, 5000 AS gid \ FROM users WHERE user='%u';
password_query = SELECT user, password, \ '%w' AS userdb_plain_pass, \ concat('*:bytes=', quota) AS quota_rule, \ '/var/vmail/%d/%n' AS home, \ 5000 AS uid, 5000 AS gid \ FROM users WHERE user='%u';
我已经进行了以下配置:(按此顺序)
passdb { driver = sql args = /etc/dovecot/dovecot-sql.conf.ext } userdb { driver = prefetch } userdb { driver = sql args = /etc/dovecot/dovecot-sql.conf.ext }
查看调试日志,当我删除预取时,一切都按预期工作:
Jan 5 15:21:38 m1 dovecot: auth: Debug: master userdb out: USER#0114090494977#[email protected]#011plain_pass=Password1234#011quota_rule=*:bytes=0#011home=/var/vmail/example.com/aaron#011uid=5000#011gid=5000#011auth_token=bdxxxxx
但是,当启用预取时,它不会获取 passdb 中的 uid 和 gid:
Jan 5 15:18:36 m1 dovecot: auth: Debug: master userdb out: USER#0113382444033#[email protected]#011plain_pass=Password1234#011auth_token=bdxxxx
关于如何在使用预取时解决此问题有什么建议吗?
谢谢!
答案1
事实证明我的 passdb 查询缺少userdb_
前缀。按如下方式调整它解决了问题。
password_query = SELECT user, password, \
'%w' AS userdb_plain_pass, \
concat('*:bytes=', quota) AS quota_rule, \
'/var/vmail/%d/%n' AS home, \
5000 AS userdb_uid, 5000 AS userdb_gid \
FROM users WHERE user='%u';
多夫科特文档预取用户数据库:
预取的基本工作原理是要求 passdb 在
userdb_
带前缀的额外字段中返回 userdb 信息。例如,如果 userdb 通常返回uid
、gid
和home
字段,则 passdb 必须返回userdb_uid
、userdb_gid
和userdb_home
字段。