Iteration failure on passwd-file when listing all users?
Dovecot 2.3.16, Ubuntu 22.04.
I'm trying to get a list of all dovecot users, on a simple test setup on my local network (which "works", in that I can get IMAP mails from dovecot):
passdb { driver = passwd-file args = /var/mail/vhosts/%d/shadow } userdb { driver = passwd-file args = /var/mail/vhosts/%d/passwd }
The command 'doveadm user -u foo@example.com' correctly shows that user. However, any attempt to wildcard the user fails:
# doveadm user -u *@example.com Error: auth-master: userdb list: User listing returned failure Fatal: user listing failed
The log file shows
Error: conn unix:auth-worker (pid=13471,uid=129): auth-worker<1>: passwd-file(*@example.com): passwd-file: User iteration isn't currently supported with %variable paths
Any ideas? And, if I can get this to work, is this method any better than just reading /var/mail/vhosts/example.com/passwd and extracting the first field to get the user name? Or just finding all the maildir directories in /var/mail/vhosts/example.com? Thanks.
If you're interested, I'm doing this so that I can automate postfix setup (by mapping new addresses to known dovecot users in the postfix virtual mailbox file). The vmailbox file might look like:
# 'user1' is a known dovecot user foo@example.com example.com/user1
I'm trying to get a list of all dovecot users, on a simple test setup on my local network (which "works", in that I can get IMAP mails from dovecot):
passdb { driver = passwd-file args = /var/mail/vhosts/%d/shadow } userdb { driver = passwd-file args = /var/mail/vhosts/%d/passwd }
The command 'doveadm user -u foo@example.com' correctly shows that user. However, any attempt to wildcard the user fails:
# doveadm user -u *@example.com Error: auth-master: userdb list: User listing returned failure Fatal: user listing failed
The log file shows
quotes? shell expands *
I did try that, but it makes no difference - note the error message in the Dovecot log file, which actually shows the '*' verbatim (or the '?', if you use that), so the special character actually goes through to doveadm (I'm not sure how!)
On 31/12/2022 17:10, Marc wrote:
I'm trying to get a list of all dovecot users, on a simple test setup on my local network (which "works", in that I can get IMAP mails from dovecot):
passdb { driver = passwd-file args = /var/mail/vhosts/%d/shadow } userdb { driver = passwd-file args = /var/mail/vhosts/%d/passwd }
The command 'doveadm user -ufoo@example.com' correctly shows that user. However, any attempt to wildcard the user fails:
# doveadm user -u *@example.com Error: auth-master: userdb list: User listing returned failure Fatal: user listing failed
The log file shows
quotes? shell expands *
On 31/12/2022 19:15 EET EML <sa212+dovecot@cyconix.com> wrote:
I did try that, but it makes no difference - note the error message in the Dovecot log file, which actually shows the '*' verbatim (or the '?', if you use that), so the special character actually goes through to doveadm (I'm not sure how!)
On 31/12/2022 17:10, Marc wrote:
I'm trying to get a list of all dovecot users, on a simple test setup on my local network (which "works", in that I can get IMAP mails from dovecot):
passdb { driver = passwd-file args = /var/mail/vhosts/%d/shadow } userdb { driver = passwd-file args = /var/mail/vhosts/%d/passwd }
The command 'doveadm user -u foo@example.com' correctly shows that user. However, any attempt to wildcard the user fails:
# doveadm user -u *@example.com Error: auth-master: userdb list: User listing returned failure Fatal: user listing failed
The log file shows
quotes? shell expands *
As the log files shows:
Error: conn unix:auth-worker (pid=13471,uid=129): auth-worker<1>: passwd-file(*@example.com): passwd-file: User iteration isn't currently supported with %variable paths
This does not change by providing a domain, it still has a %variable, so it won't work.
Aki
On 31/12/2022 18:50, Aki Tuomi wrote:
As the log files shows:
Error: conn unix:auth-worker (pid=13471,uid=129): auth-worker<1>: passwd-file(*@example.com): passwd-file: User iteration isn't currently supported with %variable paths
This does not change by providing a domain, it still has a %variable, so it won't work.
Aki
But I think it's meant to work - if you look at https://www.mail-archive.com/dovecot@dovecot.org/msg63918.html from 2015, Timo says:
Use userdb passwd-file to get iteration working. passdb isn't used for iteration. userdb static can't be used to iterate.
If I understand this correctly, I can use wildcards if userdb has a passwd-file driver. My setup is:
passdb { driver = passwd-file args = /var/mail/vhosts/%d/shadow } userdb { driver = passwd-file args = /var/mail/vhosts/%d/passwd }
On 31/12/2022 21:03 EET EML <sa212+dovecot@cyconix.com> wrote:
On 31/12/2022 18:50, Aki Tuomi wrote:
As the log files shows:
Error: conn unix:auth-worker (pid=13471,uid=129): auth-worker<1>: passwd-file(*@example.com): passwd-file: User iteration isn't currently supported with %variable paths
This does not change by providing a domain, it still has a %variable, so it won't work.
Aki
But I think it's meant to work - if you look at https://www.mail-archive.com/dovecot@dovecot.org/msg63918.html from 2015, Timo says:
Use userdb passwd-file to get iteration working. passdb isn't used for iteration. userdb static can't be used to iterate.
If I understand this correctly, I can use wildcards if userdb has a passwd-file driver. My setup is:
passdb { driver = passwd-file args = /var/mail/vhosts/%d/shadow } userdb { driver = passwd-file args = /var/mail/vhosts/%d/passwd }
I think Timo forgot it did not work with %variables. Unfortunately missing features cannot be fixed by stating strongly that they should work. Lets see if this could be finally fixed in 2.4.
Aki
On 31/12/2022 19:25, Aki Tuomi wrote:
On 31/12/2022 21:03 EET EML <sa212+dovecot@cyconix.com> wrote:
On 31/12/2022 18:50, Aki Tuomi wrote:
As the log files shows:
Error: conn unix:auth-worker (pid=13471,uid=129): auth-worker<1>: passwd-file(*@example.com): passwd-file: User iteration isn't currently supported with %variable paths
This does not change by providing a domain, it still has a %variable, so it won't work.
Aki
But I think it's meant to work - if you look at https://www.mail-archive.com/dovecot@dovecot.org/msg63918.html from 2015, Timo says:
Use userdb passwd-file to get iteration working. passdb isn't used for iteration. userdb static can't be used to iterate.
If I understand this correctly, I can use wildcards if userdb has a passwd-file driver. My setup is:
passdb { driver = passwd-file args = /var/mail/vhosts/%d/shadow } userdb { driver = passwd-file args = /var/mail/vhosts/%d/passwd }
I think Timo forgot it did not work with %variables. Unfortunately missing features cannot be fixed by stating strongly that they should work. Lets see if this could be finally fixed in 2.4.
Aki
Strange. Not really an issue, though, since I can parse the passwd-file and get 'user' and 'home' from it, which I think is sufficient.
Happy new year! Probably time to stop working...
participants (3)
-
Aki Tuomi
-
EML
-
Marc