Some spammers may wish to use your server as a relay, using SMTP Authentication with forged From: headers. You can block them by doing the following steps:
- open up /usr/local/atmail/mailserver/configure
- find this line:
accept authenticated = *
- above this line, add:
deny condition = ${if match{$sender_address}{$authenticated_id}{0}{1}}
log_message = Email blocked - Possible Spam
- save changes, and restart Exim:
% killall -HUP exim
When compiled with Exim, the libspf libraries can sometimes cause issues. Sometimes it is best to use the SPFQuery binaries for SPF support.
To use SPFQuery with Exim, just go through the following steps:
- download Mail::SPF from http://search.cpan.org/CPAN/authors/id/J/JM/JMEHNLE/mail-spf/Mail-SPF-v2.006.tar.gz
- untar, install:
% tar xvfz Mail-SPF-v2.006.tar.gz
% cd Mail-SPF-v2.006
% perl Makefile.PL && make && make install
- open the /usr/local/atmail/mailserver/configure file (or where your Exim configuration file is located).
- find this line:
accept local_parts = postmaster
domains = +local_domains
- below this, add:
# SPF Acl clause
warn set acl_m1 = --ip-address=$sender_host_address --mfrom=$sender_address --helo=$sender_helo_name
set acl_m1 = ${run{/usr/bin/spfquery $acl_m1}{$value}{fail}}
deny message = SPF check fail. $sender_host_address is not allowed to send mail from $sender_address_domain.
condition = ${if eq {$runrc}{1}{1}{0}}
- restart exim:
% killall -HUP exim
- you can also add this line to check for soft failures:
warn message = SPF check soft fail. Your host is not set as an allowed sender for $sender_address_domain. condition = ${if eq {$runrc}{2}{1}{0}}