Could not override "mail_location" with "userdb_mail" statment in "/etc/passwd"
Hi, ** Using Dovecot 2.2.22 and Postfix 3.1.0 **
I plan to migrate all accounts on my server from mbox to maildir storage but before i want to make some tests on dedicated accounts. To do so i want to overide the general "mail_location" ( mail_location = mbox:~/mail:INBOX=/var/mail/%u ) with "maildir:~/Maildir" only for some test accounts.
To do so i modified my "/etc/passwd" file using something like that :
testm2m_mydomain.tld:x:2122:2122::/home/mail/testm2m_mydomain.tld:/bin/false:userdb_mail=maildir:~/Maildir Also tried testm2m_mydomain.tld:x:2122:2122::/home/mail/testm2m_mydomain.tld:/bin/false::userdb_mail=maildir:~/Maildir
And as mentioned in the doc (https://wiki.dovecot.org/LDA/Postfix) i added -d "$USER" in my Postfix "mailbox_command" but it don't seem to work (my new mail_location for this test user is is not taken into account).
When i try to make an "doveadm user testm2m_mydomain.tld" i get this :
8<-------------------------------- field value uid 2122 gid 2122 home /home/mail/testm2m_mydomain.tld mail mbox:~/mail:INBOX=/var/mail/testm2m_mydomain.tld system_groups_user testm2m_mydomain.tld 8<--------------------------------
My modification is not taken into account ...
Any help is welcome !
/Xavier
On 13/02/2023 11:36 EET Xavier <xavier-mlist@proton.me> wrote:
Hi,
** Using Dovecot 2.2.22 and Postfix 3.1.0 **
I plan to migrate all accounts on my server from mbox to maildir storage but before i want to make some tests on dedicated accounts. To do so i want to overide the general "mail_location" ( mail_location = mbox:~/mail:INBOX=/var/mail/%u ) with "maildir:~/Maildir" only for some test accounts.
To do so i modified my "/etc/passwd" file using something like that :
testm2m_mydomain.tld:x:2122:2122::/home/mail/testm2m_mydomain.tld:/bin/false:userdb_mail=maildir:~/Maildir Also tried testm2m_mydomain.tld:x:2122:2122::/home/mail/testm2m_mydomain.tld:/bin/false::userdb_mail=maildir:~/Maildir
And as mentioned in the doc (https://wiki.dovecot.org/LDA/Postfix) i added -d "$USER" in my Postfix "mailbox_command" but it don't seem to work (my new mail_location for this test user is is not taken into account).
When i try to make an "doveadm user testm2m_mydomain.tld" i get this :
8<-------------------------------- field value uid 2122 gid 2122 home /home/mail/testm2m_mydomain.tld mail mbox:~/mail:INBOX=/var/mail/testm2m_mydomain.tld system_groups_user testm2m_mydomain.tld 8<--------------------------------
My modification is not taken into account ...
Any help is welcome !
/Xavier
Hi!
You need to use passwd-file driver. I would recommend adding secondary userdb for overrides in a separate file instead of modifying /etc/passwd.
userdb { driver = passwd result_success = continue-ok }
userdb { driver = passwd-file args = /etc/dovecot/overrides }
and put in overrides
testm2m_mydomain.tld:::::::userdb_mail=maildir:~/Maildir
Aki
You need to use passwd-file driver. I would recommend adding secondary userdb for overrides in a separate file instead of modifying /etc/passwd.
userdb { driver = passwd result_success = continue-ok }
userdb { driver = passwd-file args = /etc/dovecot/overrides }
and put in overrides
testm2m_mydomain.tld:::::::userdb_mail=maildir:~/Maildir
Hi Aki,
Thanks for your answer !
I've just gived a try and it works partially :
- the "userdb_mail=maildir:~/Maildir" is well taken into account for my user in "/etc/dovecot/overrides" (testm2m_mydomain.tld)
BUT
- all other accounts (located in "/etc/passwd" and not in "/etc/dovecot/overrides") could not connect anymore to the Dovecot server (POP/IMAP...). I got this kind of message in mail mail.log :
8<------------------------------ Feb 13 21:58:14 mail dovecot: imap: Error: Authenticated user not found from userdb, auth lookup id=2769158145 (client-pid=27095 client-id=1) Feb 13 21:58:14 mail dovecot: imap-login: Internal login failure (pid=27095 id=1) (internal failure, 1 successful auths): user=<xavier_mydomain.tld>, method=PLAIN, rip=x.x.x.x, lip=y.y.y.y, mpid=27096, secured, session=<N2VZZ4v0oNABJ3LB> 8<------------------------------
Any idea ?
Thanks for your help !
/Xavier
On 14/02/2023 09:47 EET Xavier <xavier-mlist@proton.me> wrote:
You need to use passwd-file driver. I would recommend adding secondary userdb for overrides in a separate file instead of modifying /etc/passwd.
userdb { driver = passwd result_success = continue-ok }
userdb { driver = passwd-file args = /etc/dovecot/overrides }
and put in overrides
testm2m_mydomain.tld:::::::userdb_mail=maildir:~/Maildir
Hi Aki,
Thanks for your answer !
I've just gived a try and it works partially :
- the "userdb_mail=maildir:~/Maildir" is well taken into account for my user in "/etc/dovecot/overrides" (testm2m_mydomain.tld)
BUT
- all other accounts (located in "/etc/passwd" and not in "/etc/dovecot/overrides") could not connect anymore to the Dovecot server (POP/IMAP...). I got this kind of message in mail mail.log :
8<------------------------------ Feb 13 21:58:14 mail dovecot: imap: Error: Authenticated user not found from userdb, auth lookup id=2769158145 (client-pid=27095 client-id=1) Feb 13 21:58:14 mail dovecot: imap-login: Internal login failure (pid=27095 id=1) (internal failure, 1 successful auths): user=<xavier_mydomain.tld>, method=PLAIN, rip=x.x.x.x, lip=y.y.y.y, mpid=27096, secured, session=<N2VZZ4v0oNABJ3LB> 8<------------------------------
Any idea ?
Thanks for your help !
/Xavier
Try adding both
skip=notfound
and
result_failure = continue-ok
to ignore the not found error, to the override db.
Aki
Try adding both
skip=notfound
and
result_failure = continue-ok
to ignore the not found error, to the override db.
Hi Aki,hi everyone,
Excuse me for this late answer.
It still doesn't work ...
I've try to reproduce this in a fresh new lab environnement (same distro, same Dovecot version, fresh/standard Dovecot config files...) and i got exactly the same problem.
I've now 2 tests users :
"testm2m" and "testm1m"
testm2m is declared in "/etc/passwd" and "/etc/dovecot/dovecot_override" testm1m is declared only in "/etc/passwd"
Content of "/etc/passwd" :
8<--------------------------------------------------------------- testm2m:x:1001:1001::/home/testm2m:/bin/false testm1m:x:1002:1002::/home/testm1m:/bin/false 8<---------------------------------------------------------------
Content of "/etc/dovecot/dovecot_override"
8<--------------------------------------------------------------- testm2m:::::::userdb_mail=maildir:~/Maildir 8<---------------------------------------------------------------
Here is an extract of "doveconf -n" output :
8<--------------------------------------------------------------- # 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.13 (7b14904) # OS: Linux 4.4.0-186-generic x86_64 Ubuntu 16.04.7 LTS auth_debug = yes mail_location = mbox:~/mail:INBOX=/var/mail/%u . . . passdb { driver = pam } userdb { driver = passwd result_success = continue-ok } userdb { args = /etc/dovecot/dovecot_override driver = passwd-file result_failure = continue-ok skip = notfound } 8<---------------------------------------------------------------
When i try an "doveadm auth login testm2m" i got this output :
8<--------------------------------------------------------------- passdb: testm2m auth succeeded extra fields: user=testm2m
userdb extra fields: testm2m system_groups_user=testm2m uid=1001 gid=1001 home=/home/testm2m mail=maildir:~/Maildir 8<---------------------------------------------------------------
It's seem to be OK (mail=maildir:~/Maildir)
But when i try "doveadm auth login testm1m" i got this :
8<--------------------------------------------------------------- passdb: testm1m auth succeeded extra fields: user=testm1m
Error: Authenticated user not found from userdb, auth lookup id=3039428609 (client-pid=1760 client-id=1) Error: userdb lookup failed: Internal error occurred. Refer to server log for more information. 8<---------------------------------------------------------------
It's seem that the user authentication is OK but not the userdb lookup ...
I got this in the log :
8<--------------------------------------------------------------- Feb 17 12:18:43 ubuntu dovecot: auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth Feb 17 12:18:43 ubuntu dovecot: auth: Debug: Wrote new auth token secret to /var/run/dovecot/auth-token-secret.dat Feb 17 12:18:43 ubuntu dovecot: auth: Debug: passwd-file /etc/dovecot/dovecot_override: Read 1 users in 0 secs Feb 17 12:18:43 ubuntu dovecot: auth: Debug: auth client connected (pid=1760) Feb 17 12:18:43 ubuntu dovecot: auth: Debug: client in: AUTH#0111#011PLAIN#011service=doveadm#011resp=<hidden> Feb 17 12:18:43 ubuntu dovecot: auth-worker(1762): Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth Feb 17 12:18:43 ubuntu dovecot: auth-worker(1762): Debug: passwd-file /etc/dovecot/dovecot_override: Read 1 users in 0 secs Feb 17 12:18:43 ubuntu dovecot: auth-worker(1762): Debug: pam(testm1m): lookup service=dovecot Feb 17 12:18:43 ubuntu dovecot: auth-worker(1762): Debug: pam(testm1m): #1/1 style=1 msg=Password: Feb 17 12:18:43 ubuntu dovecot: auth: Debug: client passdb out: OK#0111#011user=testm1m Feb 17 12:18:43 ubuntu dovecot: auth: Debug: master in: REQUEST#0113039428609#0111760#0111#0114f7cc8989b7b02f678d5f08ab1d66b79#011session_pid=1760 Feb 17 12:18:43 ubuntu dovecot: auth-worker(1762): Debug: pam(testm1m): lookup Feb 17 12:18:43 ubuntu dovecot: auth: Debug: passwd-file(testm1m): lookup: user=testm1m file=/etc/dovecot/dovecot_override Feb 17 12:18:43 ubuntu dovecot: auth: passwd-file(testm1m): unknown user Feb 17 12:18:43 ubuntu dovecot: auth: Debug: master userdb out: NOTFOUND#0113039428609 8<---------------------------------------------------------------
If anyone has an idea ...
Thanks.
/Xavier
participants (2)
-
Aki Tuomi
-
Xavier