[Exim] Re: Limiting sended mail per domain daily

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Burnie
Dátum:  
Címzett: exim-users
Tárgy: [Exim] Re: Limiting sended mail per domain daily
"Vahric MUHTARYAN" <vahric@???> spilled some coffee onto
the keyboard, and the result happened to be:

> Does anybody make a limiting for sending mail per domain ?! Anyway
> to configure Exim for this ?! or I have to write a script ?!


I guess this could be done in several ways. There's almost nothing
you can't do in Exim...

This is highly untested, and requires mysql support.
I use something similar to defer mail from hosts who recently
sent virus. :-)

You could also add 'hosts' or 'sender_domains' to the acl statements
to include or exclude hosts/domains from the check.

------
# sql macros for sender_domain limits - limit: num>100 (per 24h)
MYSQL_SENDER_DOMAIN_DEFER = SELECT COUNT(*) as num FROM sender_domain \
                     WHERE domain='${quote_mysql:$sender_domain}' AND \
                     DATE_ADD(updated,INTERVAL 1 DAY)>NOW() AND num>100
MYSQL_SENDER_DOMAIN_UPDATE = INSERT INTO sender_domain \
                     (sender,domain,updated) VALUES \
                     ('${quote_mysql:$sender_address}', \
                      '${quote_mysql:$sender_domain}',NOW())
MYSQL_SENDER_DOMAIN_DELETE = DELETE FROM sender_domain \
                     WHERE DATE_ADD(updated,INTERVAL 1 DAY)<NOW()


-------
# possibly in acl_smtp_rcpt, after accepting mail to postmaster/abuse

# query DB for sender_domain limit
defer message = Temporarily deferred due to domain sending limit
      condition = ${lookup mysql{MYSQL_SENDER_DOMAIN_DEFER}{Yes}{No}}


# statements to update sender_domain DB (generates empty messages)
warn  log_message = ${lookup mysql{MYSQL_SENDER_DOMAIN_UPDATE}{}}
      message     = ${lookup mysql{MYSQL_SENDER_DOMAIN_DELETE}{}}


-------

Note that this is untested. I just hacked together something from
my current acls...

You must also define a db/table and connect to the db, but I'll
leave that as an exercise

--
Bernt  'Burnie'  Pettersen  ///  DoD#2345  NAF
<E-mail:burnie@???>     ///  <URL:http://burnie.sh/>
     -  If today is the first day of the rest of your life,
                 what the hell was yesterday?   -