Multiple Exim ACLs to Limit outgoing mails per sec/hour/day

Discussion in 'Server Operation' started by mehargags, Feb 15, 2017.

  1. mehargags

    mehargags New Member

    Hi everyone...

    seek some advice: need the ACLs only for not Authenticated SMTP mails that are fired by PHP mail() from the hosted portal.

    In my /etc/exim4/exim4.conf.template

    I would define this only once ??

    Code:
    acl_not_smtp = acl_not_smtp
    correct ?? If I try to define acl_not_smtp_s it throws error "acl_not_smtp" option set for the second time

    Then how do I define Multiple ACLs per hour, per minute, per second like this ??

    Code:
    acl_not_smtp_s:
    deny message = Web site of $authenticated_id user is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
    ratelimit = 5000 / 1d / $authenticated_id
    accept
    
    acl_not_smtp_h:
    deny message = Web site of $authenticated_id user is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
    ratelimit = 20 / 1s / $authenticated_id
    accept
    
    acl_not_smtp:
    deny message = Web site of $authenticated_id user is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
    ratelimit = 200 / 1h / $authenticated_id
    accept
    Am I doing it correctly ?? Please help me for this.

    As to why one should do it - Many OpenVZ based monitors would shut you down on a certain threshold of mails sent per second, Yahoo/Hotmail issue a soft ban on "per hour" (usually, though no fixed pattern) and Google/Gmail would monitor inflow per hour and per day from certain IPs.
    so say I have a per hour limit of 1000 mails, those 1000 mails can be sent in around 15-20 seconds as well triggering a problem.

    Many big ESP's already use Multiple ACLs to delay and control outflow for above reasons. Hope that explains
     
    Last edited: Feb 17, 2017

Share This Page