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

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

To configure Postfix to use DNS Blackhole Lists (DNSBLs) such as dsbl.org and spamhaus.org to block spam, you will need to follow these steps:

  1. Install the postfix-policyd-spf-perl package. The postfix-policyd-spf-perl package provides a policy daemon for Postfix that can check incoming mail against DNSBLs. To install the package on a Debian-based system, you can use the apt-get command like this:
refer‮l:ot ‬autturi.com
apt-get install postfix-policyd-spf-perl

On a CentOS-based system, you can use the yum command like this:

yum install postfix-policyd-spf-perl
  1. Edit the /etc/postfix/main.cf file and add the following lines to enable the policy daemon:
policy-spf_time_limit = 3600s
smtpd_recipient_restrictions =
    reject_unauth_destination
    reject_unauth_pipelining
    reject_invalid_hostname
    check_policy_service unix:private/policyd-spf

These lines will enable the policy daemon and configure it to check incoming mail against DNSBLs.

  1. Edit the /etc/postfix/policyd-spf.conf file and configure the DNSBLs that you want to use. For example, to use the dsbl.org and spamhaus.org DNSBLs, you can add the following lines to the file:
reject_rhsbl_client dsbl.org
reject_rhsbl_client spamhaus.org

These lines will configure the policy daemon to reject mail from IP addresses that are listed in the dsbl.org and spamhaus.org DNSBLs.

  1. Restart the Postfix service. After you have made the above changes, you will need to restart the Postfix service to apply the changes. To restart the service on a Debian-based system, you can use the systemctl command like this:
systemctl restart postfix

On a CentOS-based system, you can use the service command like this:

service postfix restart

This will restart the Postfix service and apply the changes.

Created Time:2017-10-28 14:02:23  Author:lautturi