Day: August 9, 2020

Linux is an open source widely spread community. There are millions of Linux users and intruders as well, their job is to make malicious activities on different servers to leak information or change the things as it works. It is really important to stop malicious activities and SPAM attacks on cPanel Hosting Server. There are a number of steps but you must enable/disable some Tweaks on cPanel server.

Setting in “Exim Configuration Manager” can help you with that,

1. Login to WHM control panel by using root login details

2. Go to Main ‘Service Configuration

Then click on Exim Configuration Manager

3. Enable RBL filtering by Basic Editor RBLs switch to “On” and if you like you may additional RBL from manage option.

4. Please turn ON Sender Verification Callouts

5. Please turn ON Sender Verification

5. Please turn ON Reject SPF failures

6. Then save the entire configuration this will stop most of the spams on the server.

Now let’s make some changes in Tweak Setting,

1. Login to WHM control panel by using root user

2. Goto Main Server Configuration Tweak Settings

3. Set “Initial default/catch-all forwarder destination = Fail”

4. Max hourly emails per domain = 200

5. Please turn ON Count mailman deliveries towards a domain’s Max hourly emails

6. The maximum percentage of failed or deferred messages a domain may send per hour = 60%

7. Then save the entire configuration this will stop most of the spams on the server.

To print a list of the messages in the queue, enter:

# exim -bp

To remove a message from the queue, enter:

# exim -Mrm {message-id}

To remove all messages from the queue, enter:

# exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
suggested following clean command:
# exim -bp | exiqgrep -i | xargs exim -Mrm

Task: Delete Mail Linux Exim Server

To delete email for a particular user use shell pipes. By default the exim mail queue is located at /var/spool/exim/input directory. To delete email for a particular user called vivek@nixcraft.co.in, enter:
# exiqgrep -ir email@domain.com | xargs exim -Mrm
# exiqgrep -ir vivek@nixcraft.co.in | xargs exim -Mrm

Sometimes there can be so many frozen mails in the  Exim mail queue.

To know the number of frozen mails in the mail queue, you can use the following command

exim -bpr | grep frozen | wc -l 

In order to remove all frozen mails from the Exim mail  queue, use the following command

exim -bpr | grep frozen | awk {‘print $3’} | xargs exim -Mrm 

You can also use the command given below to delete all frozen mails

exiqgrep -z -i | xargs exim -Mrm

If you want to only delete frozen messages older than a day, you can try the following

exiqgrep -zi -o 86400

where you can change the value 86400 depending on the time frame you want to keep (1 day = 86400 seconds).