Configure Postfix for DNS Blackhole Lists such as dsbl.org / spamhaus.org database

by on October 16, 2007 · 4 comments· last updated at October 16, 2007

Q. How do I configure my Postfix mail server to scan incoming mail for spam using DNS Blackhole List such as:
a) The Spamhaus
b) Open Relay Database etc

A. To discard spam or garbage email you can use 3rd party services such as Spamhaus. These are realtime database of IP addresses of verified spam sources and spam operations (including spammers, spam gangs and spam support services), maintained by the Spamhaus or other project team and supplied as a free service to help email administrators better manage incoming email streams.

Postfix MTA DNS Blackhole Lists Configuration

Under Postfix mail server you need to define DNSRBLs in main.cf file using the smtpd_recipient_restrictions configuration directive. Open main.cf file:
# vi /etc/postfix/main.cf
Locate smtpd_recipient_restrictions line and setup reject_rbl_client as follows:

smtpd_recipient_restrictions =
....
.....
   reject_rbl_client list.dsbl.org,
   reject_rbl_client sbl-xbl.spamhaus.org,
   reject_rbl_client cbl.abuseat.org,
   reject_rbl_client dul.dnsbl.sorbs.net,
....
   permit

Here is my complete configuration:

smtpd_recipient_restrictions =
   reject_invalid_hostname,
   reject_non_fqdn_hostname,
   reject_non_fqdn_sender,
   reject_non_fqdn_recipient,
   reject_unknown_sender_domain,
   reject_unknown_recipient_domain,
   reject_unauth_destination,
   permit_mynetworks,
   reject_rbl_client list.dsbl.org,
   reject_rbl_client sbl-xbl.spamhaus.org,
   reject_rbl_client cbl.abuseat.org,
   reject_rbl_client dul.dnsbl.sorbs.net,
   permit

Save and close the file. Restart / reload postfix mail server:
# /etc/init.d/postfix restart



You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:

{ 4 comments… read them below or add one }

1 raj October 23, 2007 at 3:37 pm

plz. can any one tell me how to configure pop3 and smtp base mail server step by step i am new to it.

Reply

2 Tomas March 6, 2008 at 10:08 am

A little late, but in case you haven’t switched
to exchange already:

http://www.workaround.org

Really nice mailserver setup.

A little late I know, but in case others find this post and wondering the same.

Reply

3 Rico March 8, 2009 at 7:01 am

This needs to be in smtpd_client_restrictions, not in smtpd_recipient_restrictions

Reply

4 BOK May 10, 2009 at 1:56 pm

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: