06 Jan 2021

Blocking Accounts From Sending Emails – CPanel/WHM

Is it possible to block certain domains/accounts on my server for sending emails?

It’s possible to block certain domains from sending emails from server. There is an option in Exim configuration on your cPanel server to block domains from sending emails. This can be done by adding those domains into “/etc/blockeddomains” this configuration file.

Here I’m going to explain the steps to block accounts from sending emails. You must have a server with root access to do so.

The steps are explained below:

1. SSH to server as root.
2. Check the file “/etc/blockeddomains” is existing on the server. If it’s not there create one.
3. Add domains in “/etc/blockeddomains” to cut the email sending privilege.

You can use the following commands:

# echo "thedomain.com" > /etc/blockeddomains

Or, open “/etc/blockeddomains” with your favorite text editor and add/append the domain into it.

# vi /etc/blockeddomains
thedomain.com

4. Set correct ownership to “/etc/blockeddomains.”

# chown root.mail /etc/blockeddomains

5. Set correct permission.

# chmod 640 /etc/blockeddomains

6. Then log into the WHM panel and go to “EXIM Configuration Manager.”

WHM –> Service Configuration –> EXIM Configuration Manager –> Advanced Editor
Search for “Add additional configuration setting.” This can be located one by forth of the way of scroll down

Add the following entry:

domainlist blocked_domains = lsearch;/etc/blockeddomains

 

7. Search for “ROUTERSTART” and add the following entry:

reject_domains:

driver = redirect
domains = +blocked_domains
allow_fail
data = :fail: Connection rejected: SPAM source $domain is manually blacklisted.

This should be look like:

Yeah, that’s it!! Next time if you want to block another domain from sending emails, just add that domain into “/etc/blockeddomains” this file,

That’s it!!

27 Mar 2018

Adding a DNS Zone in cPanel/WHM Server

cPanel/WHM is very efficient when it comes to DNS management. You can setup a DNS zone with just a few clicks. When a website is created in WHM, a DNS zone is also created in WHM. Additionally, you can create DNS zones in WHM without adding a website.

This tutorial will briefly walk you through adding a DNS zone in WHM.

Step 1: Logging in to WHM

Being able to manage DNS zones requires access to WHM. Simply go to http://YourHostname:2087 and enter your login information. If this is your first time logging in, you can get started with the One-Click cPanel guide.

Step 2: Adding a DNS zone

On the left-hand navigation menu, find “DNS Functions” and click “Add a DNS Zone”.

cpanel_1a.png

Under “Domain Information”, enter an IP address and a domain name. The IP address entered here will be used for the A records and other default records. In this example, 1.2.3.4 is the IP address, and example.com is the domain name. Click the blue button labelled “Add Zone” to add the DNS zone.

The zone will now be created. Pay close attention to the output. Upon success, it will read similar to the following:

Results of adding zone example.com

Zone created successfully for IP 1.2.3.4.
Zone is owned by system.

You can now view and edit the DNS zone by clicking “Edit DNS Zone” (from the left-hand navigation menu), choosing a zone, and clicking “Edit”. A default zone will look like this:

cpanel_2a.png

You can add new entries by entering record information under “Add New Entries Below this Line”. Click “Save” to add them.

Step 3: Removing a DNS zone

You can remove a DNS zone by clicking “Delete a DNS Zone” (from the left-hand navigation menu), choosing one or more zones, and clicking “Delete”.

cpanel_3a.png


Testing zones on your DNS server

The Linux dig command is a tool for performing DNS lookups. You can test zones that were added to your DNS server by specifying the IP address of your DNS server when performing a lookup.

dig @1.2.3.4 www.example.com

...
;; ANSWER SECTION:
www.example.com.        14400   IN      CNAME   example.com.
example.com.            14400   IN      A       1.2.3.4
...

Using this DNS server on the internet

For a DNS zone hosted on your cPanel/WHM server to become publicly available on the internet, the owner of the domain must set the nameservers of the domain to point at your cPanel/WHM server. The nameservers are set at the registrar (where the domain was purchased). Each registrar has their own interface for managing domains and nameservers.

If you are planning to use this server to host DNS for your own domain name, you will also need to specify glue records at your registrar. Glue records solve the problem of a looping condition during DNS lookups. For example, if you own example.com, and your cPanel/WHM server is ns1.example.com, you would need to setup glue records. Again, each registrar has their own interface for managing these records.

©2021 Tranzmedia Netvision Limited. All Rights Reserved.
Top