Blocking all mails originating from a domain in your cPanel server !

Basically, there are times when a particular domain in your server is involved in spamming or excessive mail delivery and you just want to block that domain alone from sending mails.  With the current setup with cPanel, it is not straightforward to establish this.

We will see how to do this step-by-step.

First, login to your WHM and navigate to, Home »Service Configuration »Exim Configuration Manager » Advanced editor

Find the portion “ROUTERS CONFIGURATION” and right under the section – PREROUTERS, give the following piece of code :

reject_domains:

driver = redirect
# RBL Blacklist incoming hosts
domains = +exim_blacklist
allow_fail
data = :fail: Connection rejected: Sorry dude :/

Once this is done, save the configuration.

Next, SSH to your server and open the file /etc/exim.conf for editing.

Open it and right after the first line (usually it is something like)  “#!!# cPanel Exim 4 Config”,  give in the following and save the file :

domainlist exim_blacklist = lsearch;/etc/eximblacklist

Save the file and restart exim.

Now, all you need to do is enter the concerned domain(s) in the file ‘/etc/eximblacklist‘ ( one domain – each line )

Now, when you test to see if you can send a mail from the domain, the following can be seen in logs :

DATE H=localhost (xxxxx]:44411 sender verify fail for <test1@domain.com>: Connection rejected: Sorry dude :/

This is it, do you still face any issue ? Post a comment below with the error / issue you get !

 

Clicking on email accounts from cPanel throwing an error ?

When you click on email accounts from cPanel, do you face this error ?

A fatal error or timeout occurred while processing this directive.

Undefined subroutine &Cpanel::ExpVar::expand_and_detaint called at cpanel.pl line 963.main::real_cpexectag(“<?cp StatsBar::stat( [p class=\”caution\” style=\”margin:20px 0\””…) called at cpanel.pl line 4293main::dotag_finished_headers(0) called at cpanel.pl line 4110 main::cpanel_parseblock(“<cpanel setvar=\”headerimg=../images/mailmenu.gif\”>\x{a}<cpanel se”…) called at cpanel.pl line 4024 main::y(GLOB(0x47fb938)) called at cpanel.pl line 5393 main::run_standard_mode() called at cpanel.pl line 828

This is due to a bug in x3 theme in cPanel. Reverting the theme to paper_lantern should fix this error ! I was not able to find any other fix after hours of searching !

Hope it helps !

 

 

404 Not found error along with the original 404 error_document !

When trying to access a non-existent page / file in a domain,  do you get an additional 404 Not Found error which should actually be redirected to an ErrorDocument ?

For Eg, when I try to access a non-existent file within my account
I get the following :

Not Found :The requested URL /~joelta/noactualfile was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

How do I remove the above error log for the error document ?  ( the one in red font )

Use the following lines in the .htaccess file of the domain :

=============

ErrorDocument 400 default
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 410 default
ErrorDocument 500 default

=============

This should do the trick !

 

Issue with cPanel upgrade – giflib, libxslt, libxslt-devel dependency errors !

When trying to upgrade cPanel to a latest version, do you find this error ?

You could try using --skip-broken to work around the problem You could try running: package-cleanup --problems The program package-cleanup is found in the yum-utils package.
The system failed to execute yum with the arguments â-y -c /etc/yum.conf install giflib libxslt libxslt-devel zshâ/usr/bin/yumâEPERMâ
E Sysup: Needed system RPMs were not installed: giflib, libxslt, libxslt-devel, zsh

The issue is, the package manager is searching for an incorrect version of the libgcrypt-devel package.

Fix this error by giving the following :

# rpm --rebuilddb
# yum clean all
# yum install libxslt libxslt-devel zsh

Once this is complete, re-run the upgrade. Even after this, you get an issue with dependency of the package – libgcrypt, remove it using yum and run # /scripts/upcp.

cPanel update will look after the dependencies and install libgcrypt too.

 

cPanel scripts returning a Perl error !

There might be many situations in which you need to run some default cPanel scripts in the server. Recently i found an issue when running the script :

# /usr/local/cpanel/scripts/check_cpanel_rpms --fix

The error returned was something like :

# /usr/local/cpanel/scripts/check_cpanel_rpms --fix
/usr/local/cpanel/3rdparty/bin/perl: symbol lookup error: /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/YAML/Syck/Syck.so: undefined symbol: Perl_Gthr_key_ptr

After a lot of digging, I came to understand that this issue was due to the presence of  two Perl binaries, one provided by the default RPM and one from some other source.

You might need to remove the one not provided by RPMs and unset the Perl variable ‘PERL5LIB’, you can use this command to do it :

# unset PERL5LIB

Once this is done,  you should be able to run the scripts without any issues.

To fix Perl related issues, or if you need to re-install Perl, refer to this post HERE