WHM - Block server from receiving e-mails from particular domains
Spam is an annoying issue and even with the best automatic systems in place, sometimes messages can slip through the filtering. Automatic systems can take time to react when new addresses or techniques are used by the spammers and so it may be necessary to block domains at server level, to protect all customers.
WHM does allow you to fairly easily create and manage your own block list which you can add domains to. Of course you should use this with caution. Any domains added to the list will be blocked from sending messages to any domain hosted on your server.
- First, create a Exim blacklist. To do this, log into WHM and type in 'Terminal' in the left-hand search box and then click on the 'Terminal' application
- In the command line type: nano /etc/eximblacklist
- Press 'Enter' on your keyboard
- If you have created a list in the past, the list of domains will be displayed. If this is the first time, you will see an empty terminal window
- Now type in the domains that you want to block from being able to send messages to your server, one domain per line
- Once you have added all of the domains, press 'CTRL' + 'O' on your keyboard
- Next you need to add some information to your Exim configuration. In WHM search for 'Exim' and then load the 'Exim Configuration Manager' module and then click on the 'Advanced Editor' tab
- Scroll down around a third of the page until you see the big blue 'Add additional configuration setting' button. Click on this and two boxes will appear
- In the in the first box (with a little drop-down arrow beside it) type in 'domainlist eximblacklist'
- In the second box type 'lsearch;/etc/exim_blacklist'
- Now scroll down further until you reach the 'ROUTERS CONFIGURATION' section
- In the 'Section: PREROUTERS' box type in:
# Inserted to block domains access
# Local from blacklist: /etc/eximblacklist
reject_domains:
driver = redirect
# RBL Blacklist incoming hosts
domains = +eximblacklist
allow_fail
data = :fail: Connection rejected: $domain is manually blacklisted. - Now scroll to the bottom of the page and click on the blue 'Save' button. Your configuration will be saved and the Exim server will restart
You are done. Monitor the success of your changes over the next few days and add to the list as necessary.