Re: [exim] interface and greylistning

2022-11-21 Thread Jasen Betts via Exim-users
On 2022-11-21, Laura Williamson via Exim-users  wrote:
> Have a bit of an issue. When sending out emails out exim select an 
> interface like this
>
> interface = ${lookup sqlite {SQLITE_Q_USERINTERFACE select ip from 
> interface where active='Y' order by random() limit 1}{$value}}
> helo_data = ${lookup 
> dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}
>
> Which works perfectly fine, however, if the server we send to has 
> greylisting it will try again but every time it will select a new 
> interface IP and therefore might get greylisted again (as the IP now is 
> different), is there a way around this?

don't use random, use somethign repeatable instead eg:

   ${listextract{${eval:1+(${base62d:${substr_14_2:$message_exim_id}}%5)}}{\
10.0.0.1:10.0.0.2:10.0.0.3:10.0.0.4:10.0.0.5}{$value}{10.0.0.1}}

Here the feactional-seconds part of $message_exim_id is used as a
repeatable pseudo-random number. the range is (0..499)

you can possibly use the sha1 function to get repeatable pseudo-random
values by salting the ip-address with the exim-id of the message.

 interface = ${lookup sqlite {SQLITE_Q_USERINTERFACE select ip from \
 interface where active='Y' \
 order by sha1(ip || '${quote_sqlite:$message_exim_id}' ) \
 limit 1}{$value}}

-- 
  Jasen.

-- 
## 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/


Re: [exim] interface and greylistning

2022-11-21 Thread Andy Bennett via Exim-users

Hi,

Have a bit of an issue. When sending out emails out exim select 
an interface like this


interface = ${lookup sqlite {SQLITE_Q_USERINTERFACE select ip 
from interface where active='Y' order by random() limit 
1}{$value}}
helo_data = ${lookup 
dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}


Which works perfectly fine, however, if the server we send to 
has greylisting it will try again but every time it will select 
a new interface IP and therefore might get greylisted again (as 
the IP now is different), is there a way around this?


Depending on what goals you were trying to achieve with the 
multiple-interfaces, one option might be to swap the "random()" for 
something based on a consistent hash of message properties.


That way you could still get load balanced over the interfaces but a given 
message would always select the same interface and you wouldn't have to 
store any extra state.





Best wishes,
@ndy

--
andy...@ashurst.eu.org
http://www.ashurst.eu.org/
0x7EBA75FF

--
## 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/


Re: [exim] interface and greylistning

2022-11-21 Thread Evgeniy Berdnikov via Exim-users
On Mon, Nov 21, 2022 at 08:14:41AM +, Laura Williamson via Exim-users wrote:
> interface = ${lookup sqlite {SQLITE_Q_USERINTERFACE select ip from interface
> where active='Y' order by random() limit 1}{$value}}
> helo_data = ${lookup
> dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}
> 
> Which works perfectly fine, however, if the server we send to has
> greylisting it will try again but every time it will select a new interface
> IP and therefore might get greylisted again (as the IP now is different), is
> there a way around this?

 The counter-question is "Why do you do it?" Probably you want to use
 IP-address randomization as a tool to overcome connectivity problems.
 I don't know other reasons to use rotary IP pools (but they may exist).

 However, if connection was successful and host replies with 4xx status code,
 there is no connectivity problem. Hence IP rotation should be stopped or
 suspended for some reasonable time (~ 30m-2h).
-- 
 Eugene Berdnikov

-- 
## 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/


Re: [exim] interface and greylistning

2022-11-21 Thread Jeremy Harris via Exim-users

On 21/11/2022 08:14, Laura Williamson via Exim-users wrote:

Have a bit of an issue. When sending out emails out exim select an interface 
like this

interface = ${lookup sqlite {SQLITE_Q_USERINTERFACE select ip from interface 
where active='Y' order by random() limit 1}{$value}}
helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}

Which works perfectly fine, however, if the server we send to has greylisting 
it will try again but every time it will select a new interface IP and 
therefore might get greylisted again (as the IP now is different), is there a 
way around this?


Nothing built-in.

You'd have to craft something involving remembering what interface you last
tried, and preferring it after a defer.  That probably requires using an
event to write a DB entry on defer.

Or set up a static mapping from destination (host or domain) to
interface.

Or, stop trying to be clever with these multiple interfaces.
--
Cheers,
  Jeremy


--
## 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/