namshi / docker-smtp

SMTP docker container
MIT License
548 stars 199 forks source link

ignore_target_hosts #65

Open mtucker502 opened 4 years ago

mtucker502 commented 4 years ago

In a deployment I saw this error:

all relevant MX records point to non-existent hosts

After some research I discovered the ignore_target_hosts configuration option. This was configured in both:

/etc/exim4/conf.d/router/200_exim4-config_primary
/etc/exim4/exim4.conf.template

Since my MX server's A records record resolves to an address in the 10.0.0.0/8 it was being ignored as a viable host. I had to modify both configuration files and reload the service in order to send messages.

Can we add environment variables to allow modifying this configuration option?

mtucker502 commented 4 years ago

I did try to bind mount localmacros with the following:

.ifdef DCconfig_internet
dnslookup:
  debug_print = "R: dnslookup for $local_part@$domain"
  driver = dnslookup
  domains = ! +local_domains
  transport = remote_smtp
  same_domain_copy_routing = yes
  # ignore private rfc1918 and APIPA addresses
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.168.0.0/16 :\
                        172.16.0.0/12 : 169.254.0.0/16 :\
            255.255.255.255
  dnssec_request_domains = *
  no_more

.endif

This does get added to /etc/exim4/exim4.conf.localmacros as expected however it does not override what is set in exim4.conf.template and in the router config.