Hi, on my vps (debian stable) I have an email system with postfix, dovecot, virtual users and domains. I have 3 users with different mail_locations.
the first mail_location = maildir: ~ / Maildir the second mail_location = maildir: ~ / user1 / Maildir the third mail_location = maildir: ~ / user2 / mail
In postfix the above schema is represented in virtual_mailbox_maps.
In dovecot mail_location is set maildir:~/Maildir.
The first user receives regular mail, the other two none. I tried to see if in dovecot there was the possibility to configure the mail_location specifically for each single user, but with namespaces and userdb I am a bit confused and I have not found specific examples for my case.
regards
Gab
GPG fingerprint: 5A6A F742 ACEA C9A7 93A8 8D5E 7AEF 5A02 D080 89F7
Contact: xmpp://gabx@jabber.tcpreset.net
On 5/28/21 11:51 AM, Aki Tuomi wrote:
If I understand correctly I can repeat the userdb section:
userdb { driver = passwd override_fields = mail=~/Maildir }
userdb { driver = passwd override_fields = mail=/home/user1/user1/Maildir }
userdb { driver = passwd override_fields = mail=/home/user2/user2/mail }
What do you think of this setup ?
Gab
GPG fingerprint: 5A6A F742 ACEA C9A7 93A8 8D5E 7AEF 5A02 D080 89F7
Contact: xmpp://gabx@jabber.tcpreset.net
On 5/28/21 12:49 PM, Aki Tuomi wrote:
auth_debug=yes
That's what i wrote in the TXT file /etc/dovecot/override.passwd
gabriel1: mail=~/Maildir user1: mail=~/user1/Maildir user2: mail=~/user2/mail
Thanks and regards
Gab
-- GPG fingerprint: 5A6A F742 ACEA C9A7 93A8 8D5E 7AEF 5A02 D080 89F7
Contact: xmpp://gabx@jabber.tcpreset.net
On 5/28/21 12:56 PM, Gabx wrote:
On 5/28/21 12:49 PM, Aki Tuomi wrote:
auth_debug=yes
Dovecot still sees the main(default) mail_location: ~/Maildir
dovecot: lmtp(13181, user2): Debug: maildir++: root=/home/user2/Maildir, index=, indexpvt=, control=, inbox=/home/user2/Maildir
When it should be:
dovecot: lmtp(13181, user2): Debug: maildir++: root=/home/user2/user2/mail, index=, indexpvt=, control=, inbox=/home/user2/user2/mail
Gab
GPG fingerprint: 5A6A F742 ACEA C9A7 93A8 8D5E 7AEF 5A02 D080 89F7
Contact: xmpp://gabx@jabber.tcpreset.net
On 5/28/21 1:24 PM, Aki Tuomi wrote:
Then there is something wrong with your config, can you send
doveconf -n
and output ofdoveadm user user2
?
doveconf -n:
https://cryptpad.fr/pad/#/2/pad/edit/UjvNTPoEmNDBFm8dmzzp67YM/
And this is doveadm user user2
field value uid 1003 gid 1003 home /home/user2 mail maildir:~/Maildir system_groups_user user2
Gab
-- GPG fingerprint: 5A6A F742 ACEA C9A7 93A8 8D5E 7AEF 5A02 D080 89F7
Contact: xmpp://gabx@jabber.tcpreset.net
Your configuration has no userdb referencing /etc/dovecot/passwd.override, so of course it is not taken into account.
I implore you to read up on how userdbs function in dovecot to properly understand what you are doing, because you seem to be fumbling a bit, however a working configuration is probably to add result_success = continue-ok
to your existing userdb, and then add a following userdb that allows you to override some fields (such as "home") for some users:
/etc/dovecot/dovecot.conf:
userdb { driver = passwd result_success = continue-ok } userdb { driver = passwd-file args = /etc/dovecot/override.passwd }
This means that user information will first be looked up through the passwd driver (/etc/passwd), and then subsequently (because of "continue-ok") override any extra fields from the override file /etc/dovecot/override.passwd for any users listed in this file.
With that said, the override file you created is also invalid. It should be something like this:
/etc/dovecot/override.passwd:
gabriel1:*::::::mail=~/Maildir user1:*::::::mail=~/user1/Maildir user2:*::::::mail=~/user2/mail
The colons in this file are -not- optional. They are required to conform to the passwd-file format ("user:password:uid:gid:(gecos):home:(shell):extra_fields"). Empty fields should contain the empty string. See:
https://doc.dovecot.org/configuration_manual/authentication/passwd_file/
- Eirik
Sorry, I believe overriding the userdb field mail
must be prefixed with userdb_
, otherwise it will be considered a passdb field instead, so the correct format would be:
gabriel1:*::::::userdb_mail=~/Maildir user1:*::::::userdb_mail=~/user1/Maildir user2:*::::::userdb_mail=~/user2/mail
https://doc.dovecot.org/configuration_manual/authentication/user_database_ex...
On 5/28/21 4:30 PM, Eirik Rye wrote:
Looking at dovecot's logs 'passwd-file' was read
dovecot: auth-worker(14095): Debug: passwd-file
/etc/dovecot/override.passwd: Read 3 users in 0 secs
dovecot: auth-worker(14095): Debug: passwd(yamn): lookup
And userdb says:
userdb out:
USER#0111#011user1#011system_groups_user=user1#011uid=1001#011gid=1001#011home=/home/user1
That's where dovecot looks for user1 maildir:
maildir++: root=/home/user1/Maildir, index=, indexpvt=, control=,
inbox=/home/user1/Maildir
And inbox should be
maildir++: root=/home/user1/user1/Maildir, index=, indexpvt=,
control=, inbox=/home/user1/user1/Maildir
Same for user2 My dovecot still can't find user1 and user2 maildir. Instead gabriel1 is found because is where i said it is in mail_location directive for namespace inbox, the default. Some sort of per user root= inbox=
I come from procmail experience as lda but i'd like to do without it.
Gab
-- GPG fingerprint: 5A6A F742 ACEA C9A7 93A8 8D5E 7AEF 5A02 D080 89F7
Contact: xmpp://gabx@jabber.tcpreset.net
participants (3)
-
Aki Tuomi
-
Eirik Rye
-
Gabx