Debian – Minimal setting of Exim from Debian 8.0 “Jessie” to work out-of-the-box for receiving mail

debianemailemail-serverexim

I am looking for a simple advice what should be essentially (minimally) done to make a default Debian 8 Jessie's exim4-daemon-heavy installation to actually receive any mail.

Speaking of essential actions after the installation of the package I mean set up MX records and make initial configuration via dpkg-reconfigure exim4-config:

  1. Type: internet site
  2. System mail name: example.org
  3. IP to listen for incoming SMTP: empty
  4. Other destinations: empty
  5. Domains to relay: empty
  6. Machines to relay: empty
  7. DNS-queries minimal: No
  8. Delivery method: Maildir format
  9. Split config: Yes

This obviously generates such /etc/exim4/update-exim4.conf.conf file:

dc_eximconfig_configtype='internet'
dc_other_hostnames=''
dc_local_interfaces=''
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='maildir_home'

The last action is to set /etc/mailname to example.org.

All of the aforementioned is sufficient to make Exim send emails, but if someone trying to send you one, you will get this annoying relay not permitted error:

H=example.net [192.0.2.1] F=<someone@example.net> rejected RCPT <me@example.org>: relay not permitted

This behavior is pretty typical and last time I set up Exim (Debian 7 Wheezy's) I spent a lot of time setting this and that and finally it worked. I don't want to rsync old config, I just want to know what setting enables Exim to receive email.

Exim version for those interested:

me@jessie:~$ exim -bV
Exim version 4.84 #2 built 17-Feb-2015 17:45:46
Copyright (c) University of Cambridge, 1995 - 2014
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2014
Berkeley DB: Berkeley DB 5.3.28: (September  9, 2013)
Support for: crypteq iconv() IPv6 PAM Perl Expand_dlfunc GnuTLS move_frozen_messages Content_Scanning DKIM Old_Demime PRDR OCSP
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch ldap ldapdn ldapm mysql nis nis0 passwd pgsql sqlite
Authenticators: cram_md5 cyrus_sasl dovecot plaintext spa
Routers: accept dnslookup ipliteral iplookup manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
Configuration file is /var/lib/exim4/config.autogenerated

Best Answer

Well, I've performed a thorough diff and found these settings, which make Exim receive email:

  1. /etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs:

    comment out or remove this block (lines 64-66):

    .ifdef MAIN_LOCAL_INTERFACES
    local_interfaces = MAIN_LOCAL_INTERFACES
    .endif
    

    and place this instead (note the dot between the address and the port, this is not a typo):

    local_interfaces = 0.0.0.0.25
    
  2. /etc/exim4/conf.d/main/02_exim4-config_options:

    comment out or remove this block (lines 90-92):

    .ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME
    primary_hostname = MAIN_HARDCODE_PRIMARY_HOSTNAME
    .endif
    

    and place this instead (of course with you real hostname):

    primary_hostname = example.org
    

I'm not sure which setting resolves the issue, maybe both. Strangely enough, when I tried to revert the behavior, and discarded my edits, Exim didn't stopped receive mails. Probably it learned something useful from these configs (variables have been set).