Keep in mind that Postfix is very flexible, so many different configurations are possible, most of which are beyond the scope of this document.
A few examples of the Kopano Core - Postfix integration are described in the following section. Please select appropriate user-backend for your installation
All Postfix configuration files can be found in /etc/postfix
directory. The main configuration file is logically called main.cf
By default Postfix will only accept incoming emails from localhost. To accept emails from the complete network, configure the following option:
inet_interfaces = all
In order to make Postfix aware of the local email domains, add the following line to the main.cf
.
virtual_mailbox_domains = example.com, example.org, example.net
Postfix will now see the configured domains as its local email domains, however, to accept incoming emails, Postfix will do a recipient check. Add the following lines to the main.cf
to have Postfix use LDAP for looking up (valid) recipients:
virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf, ldap:/etc/postfix/ldap-groups.cf, ldap:/etc/postfix/ldap-groups-expand.cf virtual_transport = lmtp:127.0.0.1:2003
All incoming emails are delivered to the LMTP service of the kopano-dagent
. The delivery needs to be done on the primary mail address of a user.
For resolving the primary mail address of the user, create the file /etc/postfix/ldap-users.cf
and add the following lines:
server_host = localhost search_base = ou=Users,dc=example,dc=com version = 3 scope = sub query_filter = (&(objectClass=posixAccount)(mail=%s)) result_attribute = mail
For lookups of mail aliases create the file /etc/postfix/ldap-aliases.cf
and add the following lines:
server_host = localhost search_base = ou=Users,dc=example,dc=com version = 3 scope = sub query_filter = (&(objectClass=posixAccount)(kopanoAliases=%s)) result_attribute = mail
To deliver mails to member of a group the email addresses of the individual must be resolved:
For resolving group members create the file /etc/postfix/ldap-groups.cf
and add the following lines:
server_host = localhost search_base = ou=Groups,dc=example,dc=com version = 3 scope = sub query_filter = (&(objectclass=kopano-group)(mail=%s)) result_attribute = memberUid
To expand group members’ mail into uid create the file /etc/postfix/ldap-groups-expand.cf
and add the following lines:
server_host = localhost search_base = ou=Groups,dc=example,dc=com version = 3 scope = sub query_filter = (&(objectclass=kopano-user)(uid=%s)) result_attribute = mail
The search base of users and aliases need to match the search base of the LDAP server. After the configuration files have been changed Postfix needs to be restarted:
$ sudo service postfix restart
The above configuration requires the package postfix-ldap to be installed
All Postfix configuration files can be found in /etc/postfix
directory. The main configuration file is logically called main.cf
.
By default Postfix will only accept incoming emails from localhost. To accept emails from the complete network, configure the following option:
inet_interfaces = all
In order to make Postfix aware of the local emaildomains, add the following line to the main.cf
:
virtual_mailbox_domains = example.com, example.org, example.net
Postfix will now see the configured domains as its local email domains, however, to accept incoming emails Postfix will do a recipient check. This recipient check can be done on the Active Directory server. Add the following lines to the main.cf
virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf virtual_transport = lmtp:127.0.0.1:2003
All incoming emails are delivered to the LMTP service of the kopano-dagent
. The delivery needs to be done on the primary mail address of a user. For resolving the primary mail address of the user, create the file /etc/postfix/ldap-users.cf
and add the following lines:
server_host = 192.168.0.100 search_base = ou=Users,dc=example,dc=local version = 3 bind = yes bind_dn = cn=kopano,ou=Users,dc=example,dc=local bind_pw = secret scope = sub query_filter = (&(objectClass=user)(mail=%s)) result_attribute = mail
For lookups of mail aliases create the file /etc/postfix/ldap-aliases.cf
and add the following lines:
server_host = 192.168.0.100 search_base = ou=Users,dc=example,dc=local version = 3 bind = yes bind_dn = cn=kopano,ou=Users,dc=example,dc=local bind_pw = secret scope = sub query_filter = (&(objectClass=user)(otherMailbox=%s)) result_attribute = mail
Active Directory has the possibility to create distribution groups which can be used as email distribution list in KC. To use integrate Postfix with distribution groups, Postfix 2.4 or higher is required.
To support distribution groups add the following line to the virtual_alias_maps
:
virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf, ldap:/etc/postfix/ldap-groups.cf
Create a new file /etc/postfix/ldap-groups.cf
and insert the LDAP group configuration in there:
server_host = 192.168.0.100 search_base = ou=groups,dc=example,dc=local version = 3 bind = yes bind_dn = cn=kopano,ou=Users,dc=example,dc=local bind_pw = secret query_filter = (&(objectclass=group)(mail=%s)) leaf_result_attribute = mail special_result_attribute = member
The search base of users, aliases and groups need to match the search base of the Active Directory server. After the configuration files have been changed Postfix need to be restarted:
$ sudo service postfix restart
The above configuration requires the package postfix-ldap to be installed
Instead of executing virtual_mailbox_maps
and virtual_alias_maps
against /etc/postfix/virtual, a mysql lookup will be defined inside of main.cf
.
alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases virtual_mailbox_maps = mysql:/etc/postfix/mysql-users.cf virtual_transport = lmtp:127.0.0.1:2003
This lookup is defined as pictured below:
# Replace with the user name and password to log into the MySQL server.
user = root password = kopano hosts = 127.0.0.1 dbname = kopano query = select value from objectproperty where objectid=(select objectid from objectproperty where value='%s' limit 1) and propname='loginname';
This configuration only resolves the primary mail address of an user. Aliases should be kept in the /etc/aliases file or an extra aliases MySQL table.
The above configuration requires the package postfix-mysql to be installed