SpamExperts advanced filtering with DirectAdmin

By | October 9, 2016

SpamExperts got a couple of example configurations in their knowledgebase for using SpamExperts as a smarthost (outgoing email filtering) and to accept only mail from the SpamExperts servers to avoid bypassing the SpamExperts filters (incoming email filtering).

The knowledgebase articles are:

For outgoing filtering using a smarthost:
https://my.spamexperts.com/kb/40/MTA-examples-to-set-use-a-smarthost.html

For incoming filtering:
https://my.spamexperts.com/kb/31/Accept-email-only-from-the-Hosted-Cloud-filter-nodes.html

We improved these examples on the following parts:

  • The “Extra: Limiting Outgoing for certain domains” example can be used if you want to route only specific domains through the outgoing filter. This example configuration requires a list of domains in the exim.conf file, which means you get a custom exim.conf per server which is not easy to manage (especially if you use Puppet for example). We rewrote this part to use an external file with a list of domains.
  • The example configuration is meant if you want to route ALL email through the smarthost, since we only want specific domainnames to use the outgoing filter, the “no_more” must be removed. In our situation all domainnames in the file /etc/virtual/spamexperts_outgoing_domains will use the smarthost, all other domains must be handled the normal way (and thus will not use the outgoing filter, probably because the customer does not pay for that).
  • The incoming filter configuration is already prepared to use a domainlist but the knowledgebase article isn’t very clear how to set this up.
  • These configurations can be added to your global exim.conf and used for all servers. If you do not use SpamExperts for a specific server just leave the 2 files empty.

This configuration is suitable for DirectAdmin SpamBlocker configuration version 4.4.5.

First create the necessary files:

In edit14, below line:

add:

Make edit30 look like:

Below “begin routers” make edit48 look like this, do not forget to replace SMARTHOST with the correct value (see https://my.spamexperts.com/kb/40/MTA-examples-to-set-use-a-smarthost.html for your correct value):

Below “begin transports” add (again, replace SMARTHOST with the correct value):

Now restart Exim and add the domainnames in the correct files, one domainname per line. Make sure to test your configuration well before setting this in production.

Leave a Reply

Your email address will not be published. Required fields are marked *