[exim] Re: Routing based on *recipient* IP address

Top Page
Delete this message
Reply to this message
Author: Kirill Miazine
Date:  
To: exim-users
Subject: [exim] Re: Routing based on *recipient* IP address
• Gandalf Corvotempesta via Exim-users [2023-10-26 11:08]:
> Hi guys
>
> TL;DR: how can i route, to a specific smarthost, all email based on
> the *recipient* mx IP address ?


Maybe you could solve the task at a lower level, e.g. use operating
system's networking facilities e.g. to redirect connections to port 25
on those specific IP addresses to the smarthost, or better have some VPN
between GCP and AWS and route packets via the AWS instance (which would
have to make sure to use NAT on packets coming from GCP).

Could that work?

> Long version:
>
> I have a mail server hosted on Google Cloud that can't reach some
> "restricted" countries, like Cuba, Iran, Syria and so on.
>
> A customer of us, has a department located in Iran and is unable to
> communicate to them, so i've started an AWS instance (that is able to
> reach the remote iran server) and i would like to route, from my GCE
> instance all email that should be routed to an iran IP address (i have
> a list, downloaded from ipdeny.com), to my AWS instance.
>
> I can check for the remote MX in the transport, but:
> 1. i'm getting a list of multiple hosts
> 2. i need to convert one (or more) of them to IP addresses
> 3. i need to check if at least one of these IP is inside a file
> (automatically updated from ipdeny.com)
>
> I don't know how to start.
> Any help, or any better solution ? Checking the recipient TLD would be
> much easier but not all recipients ends in ".in"
>
> Currently, as workaround, i've set the AWS as fallback_host, because
> when an email is routed to Iran, goes in timeout and then routed to
> the fallback_host, but this is no good because is routing throuhg AWS
> all emails that are triggering a timeout but I need to route *only*
> emails to some ip addresses
>


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/