ABHIONLINUX
Site useful for linux administration and web hosting

2021/03/03

Block emails from a specific tld (.ru or .cyou) on cPanel exim server

Recently we have noticed lot of spam emails from .ru or .cyou domain. In this article, I would like to discuss about how to block such emails from a specific TLD


First step is to copy the file /etc/cpanel_exim_system_filter to /usr/local/cpanel/etc/exim/sysfilter/options/

cp -pr /etc/cpanel_exim_system_filter /usr/local/cpanel/etc/exim/sysfilter/options/

Next step is to add the following rules to /usr/local/cpanel/etc/exim/sysfilter/options/cpanel_exim_system_filter

#For blocking all incoming and outgoing russian emails
if first_delivery
and ("$h_to:, $h_cc:" contains ".ru")
or ("$h_from:" contains ".ru")
then
seen finish
endif


Now we have created a rule to block all the emails from .ru domains and we need to add this rule to our exim configuration. 

You can add it from your WHM => Exim Configuration Manager => Advanced editor

system_filter  /usr/local/cpanel/etc/exim/sysfilter/options/cpanel_exim_system_filter



 We are all set. All the emails from .ru domains will be rejected by the server now.

 

2017/09/20

Custom php.ini in EA4 cPanel servers

Here, I will discuss on how to enable custom php.ini on your cpanel servers running EA4.

Normally what we do is to find the php.ini file and copy it to your home directory and change the values in php.ini which was copied in home directory and it should work. In the case of EA4, this wont be working. We have to follow the steps given below.

Find whether local.ini file is present in the configuration directory.

/opt/cpanel/ea-php/root/etc/php.d/


[root@server public_html]# ls -ld /opt/cpanel/ea-php*/root/etc/php.d/local.ini
-rw-r--r-- 1 root root 30 Sep 20 02:16 /opt/cpanel/ea-php55/root/etc/php.d/local.ini

-rw-r--r-- 1 root root 30 Sep 20 02:16 /opt/cpanel/ea-php56/root/etc/php.d/local.ini

Copy server php.ini to your home directory  and modify the parameters that are needed.

[root@server public_html]# cp /opt/cpanel/ea-php56/root/etc/php.ini /home/abs/public_html
[root@server public_html]# chown abs.abs /home/abs/public_html/php.ini

There are certain situations where local.ini file doesn't exists on php configuration folder. In that case, we would need to follow the steps given below to generate local.ini


[root@server public_html]# echo 'user_ini.filename = "php.ini"' > /opt/cpanel/ea-php56/root/etc/php.d/local.ini
[root@server public_html]# /scripts/restartsrv_httpd 

Now custom php.ini should be working fine on your cPanel EA4 servers.

Notes :
* Ensure that you dont use suphp_configpath in .htaccess
* Loaded configuration file in phpinfo page wont be changed to custom one but the changed in cutom php.ini should be reflected in phpinfo page.