Simple SPAM Prevention with Exim Aliases

Configuring Exim

You could probably just edit the system_aliases router, but I prefer to add a new one, because it reminds me that the system is in place. Add this to your exim configuration, ideally somewhere below the system_aliases router: simple_anti_spam_alias: driver = redirect allow_fail data = ${lookup{$local_part}wildlsearch{/etc/aliases.simplespam}} file_transport = address_file pipe_transport = address_pipe You may wish to re-start Exim to be 100% sure all is well, but it is not necessary.

Creating aliases.simplespam

Create a file called: /etc/aliases.simplespam Use vi or somesuch and edit the file. A very basic file looks like this: # Simple anti-spam aliases # ------------------------ # We do not wish to get mail from these any more. # Just drop the mail. xyz-testing: :blackhole: # In some cases we may wish to let them know. xyz-nothere: :fail: Gone away, too much spam? # Otherwise all is good. ^xyz.*: xyz The above should be fairly self explaining! Once you are done, re-start exim if it is running as a service.


Just to be sure all is working as expected, here is the exim output of trying to deliver to each of the addresses above: mailhost ~ # exim -bt xyz-testing mail to is discarded mailhost ~ # exim -bt xyz-nothere is undeliverable: Gone away, too much spam? mailhost ~ # exim -bt xyz-thiswillwork <-- <-- router = localuser, transport = local_delivery mailhost ~ # exim -bt xyz-aswillthis <-- <-- router = localuser, transport = local_delivery