Exim4 and base mail method

In this howto I will try to explain how to configure the MTA Exim4 and FusionDirectory to work together on Debian 7.1 (Wheezy).

  1. First, you must install and configure FusionDirectory as described in the documentation. Installation on Debian based systems
  2. Second, install and configure DSA plugin, to maintain the security of access to the credentials in LDAP. Installation and configuration DSA plugin
  3. Third, install the full version of the demon Exim4. In systems based on Debian, the package is called exim4-daemon-heavy. So just do the following:
     aptitude install exim4-daemon-heavy 
  4. Fourthly, you need to configure the Exim4, than we actually are going to do.


Configure Exim4


In OS Debian MTA Exim4 configured in several ways. The first and simplest is to do

dpkg-reconfigure exim4-config

and answer questions.

The second way, to make own changes to the file

update-exim4.conf.conf

and run

update-exim4.conf



The third option is to make your version of the file exim4.conf. In this case, the service exim4 should be using it as the main configuration file.
It is our choice, and that is how we will proceed accordingly.
To be sure, we run the command

dpkg-reconfigure exim4-config

We choose a no configuration at this time. We confirm that we want to keep the mail system is unconfigured. We choose to MTA configuration is not divided into several small files.

Create a file exim4.conf.

touch exim4.conf

Open a new file in your favorite editor (eg, vi, vim, nano, emacs) and add the following content. For example,

nano exim4.conf


Now let's create some variables that will be useful to us in the configuration file.

# Query that returns domains if they have
    CHECK_VIRTUAL_DOMAINS = \
      ${lookup ldap{user="cn=exim4,ou=dsa,dc=example,dc=com" pass=yourpass \
         ldap:///dc=example,dc=com?dc?sub?(&(objectClass=domain)(dc=$domain))}{$value}fail}

# Query that returns aliases for the mailing address, if they have
    CHECK_VIRTUAL_ALIASES = \
      ${lookup ldap{user="cn=exim4,ou=dsa,dc=example,dc=com" pass=yourpass \
         ldap:///dc=example,dc=com?mail?sub?(&(objectClass=inetOrgPerson)(gosaMailAlternateAddress=$local_part@$domain))}{$value}fail}

# Query that tests the existence of the user
    CHECK_VIRTUAL_USER = \
      ${lookup ldap{user="cn=exim4,ou=dsa,dc=example,dc=com" pass=yourpass \
         ldap:///dc=example,dc=com?mail?sub?(&(objectClass=inetOrgPerson)(mail=$local_part@$domain))}{$value}fail}
  
# Query that returns the ID of the user group in the system
    GET_VIRTUAL_GROUP = \
      ${lookup ldap{user="cn=exim4,ou=dsa,dc=example,dc=com" pass=yourpass \
         ldap:///dc=${domain},dc=example,dc=com?gosaUnitTag?sub?(&(objectClass=inetOrgPerson)(mail=$local_part@$domain))}{$value}fail}

# Query that returns the user ID on the system
    GET_VIRTUAL_USER = \
      ${lookup ldap{user="cn=exim4,ou=dsa,dc=example,dc=com" pass=yourpass \
         ldap:///dc=${domain},dc=example,dc=com?uid?one?(&(objectClass=inetOrgPerson)(mail=$local_part@$domain))}{$value}fail}


####################################################################
#                    Basic parameters
####################################################################
# Info for connecting to the LDAP
    ldap_default_servers = ldap.example.com::389
    ldap_require_cert = never
    ldap_version = 3

Next, specify the parameters for the mail server. Such as the mail server name, local domains, relay servers, anti-spam and etc.
Very important is to set up routes for mail. Here useful to us previously created variables.
For example, the following:

#####################################################################
#                      Routers parameters
#####################################################################
#      Sequence of instructions routes is important here.
#     Address is passed in order to routers until some will not work.
#####################################################################
    begin routers
  
    dnslookup:
        driver = dnslookup
        debug_print = "R: Check address using dnslookup for $local_part@$domain"
        domains = ! +local_domains
        transport = remote_smtp
        ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
        no_more
  
    system_aliases:
        driver = redirect
        debug_print = "R: Check address using system_aliases for $local_part@$domain"
        allow_fail
        allow_defer
        data = ${lookup{$local_part}lsearch{/etc/aliases}}
        user = vmail
        group = mail
        file_transport = address_file
        pipe_transport = address_pipe

    virtual_aliases
        driver = redirect
        debug_print = "R: Check address using virtual_aliases for $local_part@$domain"
        allow_fail
        allow_defer
        hide data = CHECK_VIRTUAL_ALIASES
        user = vmail
        group = mail
  
    virtual_user:
        driver = accept
        debug_print = "R: Check address using virtual_user for $local_part@$domain"
        transport = dovecot_delivery
        domains = +local_domains
        hide condition = CHECK_VIRTUAL_USER
        no_more

Further adjustments you need to make according to the documentation of the mail server Exim.

If you have questions or comments to the article, I ask you to contact jakal66 at gmail dot com.

en/documentation_howto/exim4_base_mail_method.txt · Last modified: 2017/10/31 10:32 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0