This article is going to cover the configuration of custom RBL lookups in SpamAssassin
To add a custom RBL into SpamAssassin, we recommend creating a custom configuration file in the /etc/mail/spamassassin/ directory. You will want to make a custom.cf file. The file name can be anything you wish to use.
Once the custom file is created, open the file and add a block for each RBL you wish to add, as per this example:
header CUSTOM_LOOKUP eval:check_rbl_txt('dnsrbl','dnsrbl.org.') describe CUSTOM_LOOKUP Entries listed in dnsrbl.org RBL score CUSTOM_LOOKUP 2.0
CUSTOM_LOOKUP can be whatever you want, it's role is to be the definer for the rule, the names will just need to be consistent. For the eval/evaluation, you can use either the check_rbl or check_rbl_txt functions to perform a lookup.
Both these functions require a minimum of two arguments. The first argument can effectively be whatever you want but keep it unique. The second argument is the important one here, and that's the DNS zone that actually provides the RBL functionality. This must end in a '.' Add in as many of these blocks as you like and give them an appropriate weighting for the scoring. Each matching blacklist an incoming email's sender is found on will then add the corresponding score to the message.
Once saved, restart the Spamd service. On startup, the service will detect any *.cf file found in /etc/mail/spamassassin/. You will also want to run the following command before restarting the service to ensure there are no errors:
If there are no errors from the above command, restart the service with the command below.
Making a custom configuration file