Re: [exim] lowest numbered MX record points to local host

Top Page
Delete this message
Reply to this message
Author: Sebastian Nielsen
Date:  
To: Bambero
CC: Exim Users
Subject: Re: [exim] lowest numbered MX record points to local host
Easiest is to use local_domains but have a verification step for the
shared hosting, so your interface where user add their domain, will
verify that the MX is pointed to your server Before allowing the
domain to be added to local_domains.

Eg, in the web interface where user add their domain, add something
like (assuming dnslookup() is a function that takes a domain and
record type and returns the first record):

if (dnslookup($user_domain, "MX") ne "yoursmtp.yourdomain.com") {
print "To add this domain you first need to set up your MX to Point to
us. We cannot add your domain without you first reconfiguring the MX,
for obvious security reasons".
}

2018-02-14 9:59 GMT+01:00 Bambero via Exim-users <exim-users@???>:
> So what shoud I do to fix that? I can't use local_domains, becouse it's
> shared hosting, and users can add domains by hand.
> If someone will add domain 'gmail.com' exim will treat it as local domain.
>
> The only way is to check MX.
>
> Regards,
> Bambero
>
> On Wed, Feb 14, 2018 at 9:29 AM, Bambero <bambero@???> wrote:
>
>> So what shoud I do to fix that? I can't use local_domains, becouse it's
>> shared hosting, and users can add domains by hand.
>> If someone will add domain 'gmail.com' exim will treat it as local domain.
>>
>> The only way is to check MX.
>>
>> Regards,
>> Bambero
>>
>> On Wed, Feb 14, 2018 at 8:04 AM, Sebastian Nielsen <
>> nielsen.sebastian@???> wrote:
>>
>>> Because exim4 by default disallows delivery to local host to prevent mail
>>> loops.
>>>
>>> When remote delivery fails, delivery will be attempted to a local user.
>>> Thats why it doesn't fail with a valid user.
>>>
>>> The ! +local_domains skips this router for local users, so remote
>>> delivery isn't even attempted for local users.
>>>
>>>
>>> Den 14 feb. 2018 02:48 skrev "Bambero via Exim-users" <
>>> exim-users@???>:
>>>
>>> Hi,
>>>
>>> I have two routers:
>>>
>>> dnslookup:
>>> driver = dnslookup
>>> # domains = ! +local_domains # check mx for all domains
>>> transport = remote_smtp
>>> ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
>>> self = pass
>>> no_more
>>>
>>> localuser:
>>> driver = accept
>>> condition = ${lookup sqlite {...}{yes}{no}}
>>> transport = local_delivery
>>> cannot_route_message = Unknown user
>>>
>>> Everything works fine, but if there is no user in my database i got error:
>>> "lowest numbered MX record points to local host"
>>>
>>> Instead of:
>>> "Unknown user"
>>>
>>> But when i change first router to defaults:
>>>
>>> dnslookup:
>>> driver = dnslookup
>>> domains = ! +local_domains
>>> transport = remote_smtp
>>> ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
>>> no_more
>>>
>>> The error is correct:
>>> "Unknown user"
>>>
>>> Can anyone explain, why?
>>>
>>> Regards,
>>> Bambero
>>> --
>>> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
>>> ## Exim details at http://www.exim.org/
>>> ## Please use the Wiki with this list - http://wiki.exim.org/
>>>
>>>
>>>
>>
> --
> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/