How to Blacklist TLDs, Domains or Email Address Globally

Posted on

In order to block blacklisted domains throughout our server we will be using the SpamBlocker blacklist domains feature built into DirectAdmin. You can also use the SpamBlocker feature to block bad sender hosts or IPs, blacklist senders and whitelist domains, hosts or senders.

The files are located in the /etc/virtual/ folder. The full list of file locations are:

It is important that these files have the same ownership
and permissions as your /etc/virtual/domains file. If you have installed SpamBlocker using custombuild the ownership and permissions will already be set correctly.
These files will only be activated on domains which are enabled in the /etc/virtual/use_rbl_domains file. To make sure you have setup RBL Blocking on your DirectAdmin server, log into your control panel and go to Server Manager > Adminstrator Settings >Email Settings and select the Use RBL Blocking checkbox.
To block blacklisted domains globally on our server will be using the /etc/virtual/blacklist_domains file. To edit this file we will use the following command:
nano /etc/virtual/blacklist_domains
When this file first loads it may be empty, don’t panic. Now we will need to copy and paste the list of domains we want to add to the blacklist. This list is the current Top 10 most abused TLDs as supplied by Spamhaus, you can if you wanted add or remove these TLDs as you need.

You will notice the * in front of the TLD. This means SpamBlocker will block using wildcard domain for example if an email address from .live TLD [email protected] was received it would be blocked with the error message 554 denied. 5.7.1 Domain Blocked due to SPAM.

If you wanted to block a specific domain from the .live TLD, you could use instead of using the wildcard regex *.live.

Now we need to restart the Exim server using the following command:

service exim restart