Categories
Development System & Network

Postfix: User with aliases has a mailbox, with filename where all aliases are listed

I have a postfix server running on my CentOS 7 machine.

I managed to configure the postfix server to use my LDAP server to retrieve accounts and it works fine, emails are received and saved to a mailbox file.

I use Dovecot as an IMAP server. They work together nicely for all users, except for the ones that have aliases.

The problem is that Dovecot is looking for the mailbox file with the user’s maildrop attribute (which is of course unique). However, the mailbox file created by Postfix is a list of all mail attributes (which are the list of aliases).

For example, let’s suppose a user with cn=user, maildrop=user, mail=user, mail=alias.

In this case, the mailbox file created by Postfix will be called user,alias, while Dovecot will look for a file called user.


Now of course, I could start to find out how to make Dovecot look for a file called user,alias, but this would mean that every time a new alias is added to an account, all of the emails will not be recallable until that alias is deleted.

So what I need help with is to configure Postfix to call the mailbox file user, even when mail=user has multiple aliases.

Relevant part of main.cf:

virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf
virtual_mailbox_domains = mail.ropi.dev, ropi.dev
virtual_mailbox_base = /var/mail/mail_default
virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf
virtual_minimum_uid = 3000
virtual_uid_maps = static:3000
virtual_gid_maps = static:3000
virtual_transport = virtual

ldap-accounts.cf:

# ...
query_filter = (&(objectClass=mailUser)(maildrop=%u))
result_attribute = mail

version = 3

ldap-aliases.cf:

# ...
query_filter = (&(objectClass=mailUser)(mail=%u))
result_attribute = maildrop

version = 3

Leave a Reply

Your email address will not be published. Required fields are marked *