We've been rolling out our new email system and have reached the time where testing has begun on how to block spammers connecting directly to the domain A record (ignoring MX records in the dns zone) so I thought I'd post back.
It's early days yet so it's possible this solution may not be 100% suitable but the following looks like it could work:
AFTER:
Code:
check_recipient:
# Exim 3 had no checking on -bs messages, so for compatibility
# we accept if the source is local SMTP (i.e. not over TCP/IP).
# We do this by testing for an empty sending host field.
accept hosts = :
ADD THIS:
Code:
# no primary mx on this server
deny message = This is not an mx server
log_message = $sender_host_address using us as mx server
!authenticated = *
!hosts = /etc/exim_mx_servers
Then create the file at /etc/exim_mx_servers which is a list of IP's that are allowed to connect directly to deliver email, typically the authorised MX servers which handle the email then pass it onto the inbox.
This basically rejects all connections unless the connection is authenticated (user connecting to send email via smtp) or the system connecting is listed in /etc/exim_mx_servers (your mx boxes). We've got it running on a few boxes in 'warn' status and it's looking good. If anyone can see anything wrong feel free to reply.