Addition/OpenLDAP/Catch-all

From iRedMail
Jump to: navigation, search

Note: This feature was added in iRedMail-0.6.0.

iRedMail-0.5.1 and eariler versions with OpenLDAP backend doesn't support catch-all account by default, but you can implement it with below steps:

  • Change your postfix setting in /etc/postfix/main.cf:
File: /etc/postfix/main.cf
virtual_alias_maps =
    proxy:ldap:/etc/postfix/ldap_virtual_alias_maps.cf,
    proxy:ldap:/etc/postfix/ldap_virtual_group_maps.cf,
    proxy:ldap:/etc/postfix/ldap_sender_login_maps.cf,      # <-- Add this line.
    proxy:ldap:/etc/postfix/ldap_catch_all_maps.cf          # <-- Add this line.

File /etc/postfix/ldap_sender_login_maps.cf is used here to return email addresses who doesn't forward their email to other accounts (stored in attribute mailForwardingAddress, per-user setting.), it will prevent postfix delivering incoming mails which sent to these accounts to catch-all address.

  • File /etc/postfix/ldap_sender_login_maps.cf already exist by default, so what you need to do is adding new file: /etc/postfix/ldap_catch_all_maps.cf.
File: /etc/postfix/ldap_catch_all_maps.cf
#
# This is a sample config. Please REPLACE bind_dn, bind_pw, search_base below.
#
server_host     = 127.0.0.1
server_port     = 389
version         = 3
bind            = yes
start_tls       = no
bind_dn         = cn=vmail,dc=iredmail,dc=org
bind_pw         = JnvF4UQheMdImdXYnRVEgKpsdCXJy3
search_base     = domainName=%d,o=domains,dc=iredmail,dc=org
scope           = sub
query_filter    = (&(objectClass=mailUser)(accountStatus=active)(mail=@%d))
result_attribute= mailForwardingAddress
debuglevel      = 0

As you see, below attributes and values are required to make catch-all account work:

Attribute Name Value
objectClass mailUser
mail @your_domain_name
accountStatus active
  • Restart postfix service to make it work.
  • Add sample catch-all account under ou=Users container.
Terminal:
dn: mail=@a.cn,ou=Users,domainName=a.cn,o=domains,dc=iredmail,dc=org
accountstatus: active
cn: catch-all
mail: @a.cn
mailForwardingAddress: www@a.cn
mailForwardingAddress: www2@a.cn
objectclass: inetOrgPerson
objectclass: mailUser
sn: catch-all
uid: catch-all
Personal tools