Topic: A solution for nested mail lists with LDAP backend
==== Required information ====
- iRedMail version: 0.9.1 with iredapd 1.5.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Apache 2.2
- Linux/BSD distribution name and version: CentOS 6.6 x86_64
- Related log if you're reporting an issue:
====
I found that nested mail lists did not work out of the box, so here is one solution that I came up with for LDAP backends.
1. Create a new file /etc/postfix/ldap/virtual_nested_groups.cf which contains:
server_host = 127.0.0.1
server_port = 389
version = 3
bind = yes
start_tls = no
bind_dn = cn=vmail,dc=domain,dc=tld
bind_pw = YOURPASSWORD
search_base = o=domains,dc=domain,dc=tld
scope = sub
query_filter = (&(memberOfGroup=%s)(accountStatus=active)(enabledService=deliver)(objectClass=mailList))
result_attribute= mail
debuglevel = 0
Replace "dc=domain,dc=tld" with your domain info of course, and your password from the iredmail install. This file will expand any mail lists within mail lists. Note: this presumes the LDAP server and iredmail are on the same server. If remote, use port 636 with ldaps:// or start_tls=yes for security, plus whatever remote server host you have.
2. In /etc/postfix/main.cf, *modify* the following line to include the file created above:
virtual_alias_maps = proxy:ldap:/etc/postfix/ldap/virtual_alias_maps.cf,
proxy:ldap:/etc/postfix/ldap/virtual_nested_groups.cf,
proxy:ldap:/etc/postfix/ldap/virtual_group_maps.cf,
proxy:ldap:/etc/postfix/ldap/virtual_group_members_maps.cf,
proxy:ldap:/etc/postfix/ldap/catchall_maps.cf
3. At the command line, do "postfix reload" to get the new configs.
4. Create a high level mail list, which will contain other mail lists. Example: "toplist@domain.tld". Make sure it has at least the attributes "accountStatus" as "active" and "enabledService" including "deliver". You can also add "enabledService" including "displayedInGlobalAddressBook". Add a "cn" and "description" as desired.
5. In the lower level mail lists, example "lower1list@domain.tld" and "lower2list@domain.tld", make sure that each of those lists has the attribute "memberOfGroup" as "toplist@domain.tld". I did not test this, but it seems possible that you could also add individual email users (e.g. "user1@domain.tld") to the top level list through the memberOfGroup attribute of that particular user, in addition to the other mail lists.
That's it. Now when you send an email to "toplist@domain.tld" that will automatically expand into "lower1list@domain.tld" and "lower2list@domain.tld", and as many other lists that you assigned.
One final note: at present I find the accessPolicy feature doesn't seem to work.
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.