Re: [exim] Ratelimit

Top Page
Delete this message
Reply to this message
Author: Jan Ingvoldstad
Date:  
To: exim-users
Subject: Re: [exim] Ratelimit
On Fri, Dec 9, 2011 at 22:39, Ian Porter <ian@???> wrote:
>
> Hi All,
>
> I am trying to use the ratelimit to deny any more than 10 emails per
> second.  I have tried adding this to the
> /etc/exim4/exim4.conf.template and also within the
> /etc/exim4/conf.d/acl/10_exim4_config-deny-ratecheck
>
> acl_deny_rate_check_exceptions:
>    deny ratelimit = 10 / 1s / $primary_hostname
>          log_message = Sorry, too busy, ratelimit
>
>
> But it does not do anything ? any advice ?


Where do you call that ACL from?

The rate limiting examples I have seen, and those I've used for
implementing them myself, are all placed in acl_check_rcpt, which is
where you want to have a check for per-rcpt limits.

Example for authenticated users:

acl_check_rcpt:

  warn ratelimit = 0 / 1h / strict
       logwrite = :main: \
                  Rate: $sender_rate/$sender_rate_period \
                  $message_id \
                  $sender_address ($sender_host_name[$sender_host_address]) \
                   -> $local_part@$domain


# Authenticated users limited to 90 messages per minute
  deny authenticated = *
       ratelimit = 90 / 1m / strict / ${authenticated_id}_minute
       message = Sending rate exceeded, $sender_rate/$sender_rate_period \
                 (max $sender_rate_limit/$sender_rate_period)
       logwrite = :main,reject: \
                  Rate exceeded:  $sender_rate/$sender_rate_period \
                  (max $sender_rate_limit) $message_id \
                  $sender_address ($sender_host_name[$sender_host_address]) \
                   -> $local_part@$domain




Example for a smarthost setup:

# Relayed hosts limited to 180 messages per minute
defer message = Sending rate exceeded, $sender_rate/$sender_rate_period \
                       (max $sender_rate_limit/$sender_rate_period)
      ratelimit = 180 / 1m / ${primary_hostname}_minute
      hosts = +relay_from_hosts
      logwrite = :main: \
                        Rate exceeded for remote system:
$sender_rate/$sender_rate_period \
                (max $sender_rate_limit) $message_id [$sender_host_address] \
                 -> $local_part@$domain


--
Jan