Re: [exim] Ratelimit

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Ian Porter
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: Re: [exim] Ratelimit
Hi Darren

Thanks very much

I have just noticed that the
/var/spool/exim4/db/ratelimit.db
has not been created ? and also when I do remove those files to
recreate that directory it does not get created. I am guessing that I
may be missing something ? or do I not need that.

Thanks
Ian

On Mon, Dec 12, 2011 at 4:20 PM, Darran Coy <dcoy@???> wrote:
> Hi Ian,
>
>
>
> We’ve been runnin ratelimiting for a few years here.  We’re current;y 4.72.
>
>
>
> Here's all our ratelimiting bits from out config file.  If it helps...
>
>
>
> hostlist        not_rate_limited = "    1.2.3.4"
>
> .
>
> .
>
> .
>
>
>
> #Ratelimit connections to try to eliminate more spam and phishing.
>
> # Darran January 2009
>
> smtp_ratelimit_hosts = *
>
> smtp_ratelimit_mail = 2,0.5s,1.05,4m
>
> smtp_ratelimit_rcpt = 4,0.5s,1.05,4m
>
>
>
> begin acl
>
> .
>
> .
>
> .
>
>
>
> acl_check_rcpt:
>
>
>
>   # Accept if the source is local SMTP (i.e. not over TCP/IP). We do this by
>
>   # testing for an empty sending host field.
>
>
>
>   accept  hosts = :
>
>
>
>         ##########################################################
>
>         #       New ratelimit stuff Added by Darran 1st March 2009
>
>         ##########################################################
>
> # Slow down fast remote senders; note the need to truncate $sender_rate
>
> # at the decimal point.
>
> defer message = Sorry, too much work.  Come back later.
>
>         ratelimit = 45 / 1h / per_rcpt / $sender_address
>
>         hosts = !+relay_from_hosts : !+not_rate_limited
>
>         log_message = Ratelimit: REMOTE Per user sender rate limit
> $sender_rate / $sender_rate_period DEFERRED
>
>
>
> # System-wide remote rate limit
>
> defer message = Sorry, too busy. Try again later.
>
>         ratelimit = 10 / 1s / $primary_hostname
>
>         hosts = !+relay_from_hosts : !+not_rate_limited
>
>         log_message = Ratelimit: REMOTE System rate limit exceeded
> $sender_rate / $sender_rate_period DEFERRED
>
>
>
> # Slow down fast LOCAL senders; note the need to truncate $sender_rate
>
> # at the decimal point.
>
> defer message = Sorry, you are too fast. Wait a bit.
>
>         ratelimit = 200 / 1h / per_rcpt / $sender_address
>
>         hosts = +relay_from_hosts : !+not_rate_limited
>
>         log_message = Ratelimit: LOCAL Per user sender rate limit
> $sender_rate / $sender_rate_period DEFERRED
>
>
>
> # System-wide LOCAL rate limit
>
> defer message = Sorry, busy doing other things. Try again later.
>
>         ratelimit = 20 / 1s / $primary_hostname
>
>         hosts = +relay_from_hosts : !+not_rate_limited
>
>         log_message = Ratelimit: LOCAL System rate limit exceeded
> $sender_rate / $sender_rate_period DEFERRED
>
>
>
>
>
> -----Original Message-----
> From: exim-users-bounces+dcoy=lincoln.ac.uk@???
> [mailto:exim-users-bounces+dcoy=lincoln.ac.uk@exim.org] On Behalf Of Ian
> Porter
> Sent: 12 December 2011 13:56
> To: exim-users@???
> Subject: Re: [exim] Ratelimit
>
>
>
> Hi All,
>
>
>
> Nah, does not seem to matter where I place these ratelimits
> /etc/exim4/conf.d/30_exim4-config_check_rcpt
>
> or
>
> /etc/exim4/exim4.conf.template
>
>
>
> The messages still go through without any problems.  Just to make sure I am
> trying to send a mail from the local host to an remote email address will
> these restrictions apply ? and also log in the /var/log/exim4/mainlog ?
>
>
>
> Regards
>
> Ian
>
> On Sat, Dec 10, 2011 at 12:41 PM, Jan Ingvoldstad <frettled@???>
> wrote:
>
>> 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
>
>>
>
>> --
>
>> ## 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/
>
>
>
>
>
>
>
> --
>
> Regards
>
> Ian Porter
>
>
>
> www: www.codingfriends.com
>
>
>
> --
>
> ## 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/
>
>
>
> The University of Lincoln - a top performer in student satisfaction,
> enjoying an unrivalled ascent through the University league tables, set in a
> dynamic, research rich and vibrant campus in the heart of a great historic
> student-friendly city.
>
>
> The information in this e-mail and any attachments may be confidential. If
> you have received this email in error please notify the sender immediately
> and remove it from your system. Do not disclose the contents to another
> person or take copies.
>
> Email is not secure and may contain viruses. The University of Lincoln makes
> every effort to ensure email is sent without viruses, but cannot guarantee
> this and recommends recipients take appropriate precautions.
>
> The University may monitor email traffic data and content in accordance with
> its policies and English law. Further information can be found at:
> http://www.lincoln.ac.uk/legal.




--
Regards
Ian Porter

www: www.codingfriends.com