Re: [exim] Ratelimit Tricks

Top Page
Delete this message
Reply to this message
Author: Dean Brooks
Date:  
To: exim-users
Subject: Re: [exim] Ratelimit Tricks
On Fri, Nov 10, 2006 at 12:09:30PM -0500, Eli wrote:
> Marc wrote:
> > But if the ratelimit isn't processed can I read the value into and ACL
> > variable?
>
> Value of what? A rate limit doesn't have a simple "value",


A ratelimit essentially has a single value for a given lookup key.

The date information is essentially used to mathematically calculate
that single value and I can't imagine why someone would want to
extract it, although I guess it could be put into an ${extract:}
format if someone really wanted.

> You can't convert that in to a simple value to put in to a variable.


Yes, you can. I wrote a patch to do exactly that, and it solved the
problem I was having. The format was essentially:

${ratelimit:<key>}

and would return the stored ratelimit value for the given lookup key.

This allowed you to write the following code:

   defer
     message = too many recently failed recipients, please try later
     condition = ${if >{${ratelimit:1h / per_rcpt}}{20}}


   warn
     ! verify = recipient
     ratelimit = 0 / 1h / per_rcpt


The main problem I ran into is that the ratelimiting code puts
whitespace into the key and makes it very difficult to get the lookup
key in the proposed ${ratelimit:<key>} variable and have it match
correctly.

Perhaps I should dust off the lookup code for others who may need it.

--
Dean Brooks
dean@???