1

Running Postfix 2.6.6 on CentOS 6.4. I have configured virtual user look-up in Active Directory. When sending mail to an individual address the mail is correctly delivered to the virtual user's Maildir. More than one recipient however results in a file being written in the vmail users's home directory with the list of recipients as the filename.

Here is my main.cf:

virtual_mailbox_domains = $mydomain
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf,ldap:/etc/postfix/ldap-groups.cf
virtual_uid_maps = static:75003
virtual_gid_maps = static:75003

ldap-users.cf:

server_host = mailhost.example.com
search_base = cn=Users,dc=example,dc=com
version = 3
query_filter = (&(objectclass=person)(mail=%s))
result_attribute = samaccountname
result_format = %s/Maildir/

postmap query result:

postmap -q usera@example.com ldap:/etc/postfix/ldap-users.cf
usera/Maildir

ldap-groups.cf

server_host = mailhost.example.com
search_base = ou=Test,dc=example,dc=com
version = 3
query_filter = (&(objectclass=group)(mail=%s))
leaf_result_attribute = samaccountname
special_result_attribute = member
result_format = %s/Maildir/

postmap query result:

postmap -q testgroup@example.group ldap:/etc/postfix/ldap-groups.cf
usera/Maildir/,userb/Maildir/,userc/Maildir/

When I send mail to usera@example.com the mail is correctly delivered to /home/vmail/usera/Maildir/new but when I send mail to testgroup@example.com the email body is written under the first recipient's Maildir /home/vmail/usera/Maildir like this:

drwx------. 3 vmail vmail  8192 May 21 13:01 ,userb
drwx------. 3 vmail vmail  8192 May 21 12:58 ,userc
drwx------. 2 vmail vmail  8192 Jun  3 10:32 cur

The maillog reveals this:

Jun  3 11:09:02 mailhost postfix/virtual[13081]: mail_addr_find: testgroup@example.com -> usera/Maildir/,userb/Maildir/,userc/Maildir/

Jun  3 11:09:02 mailhost postfix/virtual[13081]: deliver_mailbox[2]: set user
_attr: /home/vmail/usera/Maildir/,userb/Maildir/,userc/Maildir/, uid = 75003, gid = 75003

The virtual_mailbox_base directive in main.cf is only being applied the first recipient. I'm guessing this is a problem, but even if it wasn't why is mail for the second and third recipients being delivered under the first recipient's Maildir?

Thanks in advance for any suggestions on how to fix this.

0

What I was missing is the ldap:/etc/postfix/ldap-groups.cf needs to be assigned to the virtual_alias_maps in /etc/postfix/main.cf and NOT against the virtual_mailbox_maps

The corrected /etc/postfix/main.cf:

# Active Directory/LDAP virtual user info
virtual_mailbox_domains = $mydomain
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf
virtual_alias_maps = ldap:/etc/postfix/ldap-groups.cf
virtual_uid_maps = static:75003
virtual_gid_maps = static:75003

and the corrected /etc/postfix/ldap-groups.cf:

server_host = mailhost.example.com
search_base = ou=Test,dc=example,dc=com
version = 3   
query_filter = (&(objectclass=group)(mail=%s))
leaf_result_attribute = mail
special_result_attribute = member

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.