Mail - Reject Spam with access.db


2003-01-17

I - Enable access_db

Sendmail has an access.db feature that can be used to block spam. It is enabled by default on most systems. If you’re not sure if its enabled check your sendmail.mc file and make sure the following line exists:

FEATURE(`access_db')dnl

II - Editing the access_db

You can edit the database by editing the file /etc/mail/access or /etc/mail/access.db. Although you can put email addresses here it is probably not a good idea because spammers make them up. It is more effective to block domains and IP addresses of open relays. You may even want to block an entire ISP’s netblock but that should only be used as a last resort.Example /etc/mail/access file:

localhost.localdomain           RELAY
localhost                       RELAY
127.0.0.1                       RELAY
139.182.132                     RELAY #relays for netblock
139.182.133                     RELAY
139.182.134                     RELAY
spammer@aol.com			REJECT #rejects mail from specific address
azoogle.com			REJECT #rejects mail from azoogle.com
com.br                          REJECT #rejects mail from Brazil
net.br				REJECT
209.249.26.112			REJECT #rejects ip address
209.249.26			REJECT #rejects netblock

When finished type the following command:

# makemap hash access < /etc/mail/access

This will update the access.db. Now restart sendmail.

# killall -HUP sendmail