E-Mail Rate Limiting with exim and the exim.pl

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » Email » Spam
Top Level » Email » Exim

E-Mail Rate Limiting with exim and the exim.plLast Modified: May 26, 2020, 7:08 pm
Spam is an ongoing issue, and any email account that has it's password compromised can end up sending massive amounts of spam through your server.  The following tips will help you limit the damage done should this happen.

1) Update to the latest /etc/exim.pl file.  At the moment this guide was written, version 14 was the most current version.  It supports smtp-time blocking, so if a limit is reached, the smtp-auth send will return an invalid password error, even if a valid password is provided.  Use the following code to grab the latest exim.pl:

wget -O /etc/exim.pl http://files.directadmin.com/services/exim.pl
/etc/init.d/exim restart

2) Ensure you have a per-User limit setup.  This will be a daily limit for the maximum number of total sends all accounts and scripts under this User can send from the server, combined.  A typical value might be 200, eg:

echo 200 > /etc/virtual/limit

3) With the newer versions of the exim.pl, they also support a per-Email limit, meaning you can setup a daily limit on each of the email accounts, so that if any one account sends spam, it won't end up using the full per-User limit, blocking the rest of the accounts. It would instead only cap that one sending User, and leave all other accounts to be able to send emails.   A typical global default per-Email limit here might be 50, eg:

echo 50 > /etc/virtual/user_limit

4) Versions of DirectAdmin 1.42.0 and newer can setup the ability to control the per-Email limit.  To give Users the ability to specify a value other than the global default (50).  To enable this feature, type:

/usr/local/directadmin/directadmin set user_can_set_email_limit 1
service directadmin restart

and can be controlled at User Level -> E-Mail Accounts.
Note that the default will not allow the User to specify a per-Email limit higher than the global limit in /etc/virtual/user_limit.
If you want to allow Users to set a higher per-Email limit than the global default, set the following in the directadmin.conf, and restart directadmin:

/usr/local/directadmin/directadmin set max_per_email_send_limit 100
service directadmin restart

which, for example, will allow Users to set a maximum of 100 as the per-Email limit.  The per-User limit (/etc/virtual/limit) is still enforced, regardless of what the per-Email limits are set to.

As of DA 1.45.0, if a per-Email limit is reached, DA will notify that email account of their limit being reached:

5) It's also recommended to disable popb4smtp with exim to force all sends using smtp-auth.  It's enabled by default, as many client rely on it, and would complain without it.

6) Admins can modify the daily sent limit for a User by viewing that User's settings.  By default, a Reseller cannot, but this can be enabled with reseller_can_set_email_limit=1
Related Helpfiles
How to limit the number of emails sent by each user (prevent spammer)
My server is sending spam. What do I do?
SPAM fighting tools in DirectAdmin

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST