On 16/12/2024 22:07 EET Stanislav via dovecot <dovecot@dovecot.org> wrote:
Greetings, I have a mail server for a few folks, basically my family. My current Dovecot configuration is the following, which works like a charm:
passdb { driver = sql args = /usr/local/etc/dovecot/dovecot-sql.conf.ext } userdb { driver = static args = uid=981 gid=981 home=/var/mail/virtual/%d/%n/home }
I've decided to deploy Solr to be able to search faster. Now, when I try to execute "doveadm index -A inbox" I get an error "Error: auth-master: userdb list: User listing returned failure" because I'm using the static userdb.
My question is, how do I implement the listing users feature while using "static driver" or a similar approach? I really want to keep using the template "/var/mail/virtual/%d/%n/home" instead of defining a custom path for each user.
So I came up with this idea to replace "static" with "sql" driver for "userdb" since there's "iterate_query" I can use to achieve my goal, tho I have to define "user_query", so I can do something like:
SELECT '/var/mail/virtual/%d/%n/home' AS maildir, 981 AS uid, 981 AS gid FROM mailbox WHERE username='%u' and active='1';
However, this is a useless waste of resources since I'm not really querying anything, and I'm not even sure if there's template support (e.g., %d/%n) in there.
Appreciate any help Best
You could get rid of the static userdb with these settings
mail_uid = 981 mail_gid = 981 mail_home = /var/mail/virtual/%d/%n/home
and ensure you have iterate_query in your SQL config.
Should do the trick.
Aki