Configuring WHM/cPanel tweak settings from SSH

You can also configure/alter tweak settings for WHM/cPanel from SSH terminal.

Follow the steps:

  1. Login to SSH via Putty or any terminal with root privileges.
  2. Run following command:
    • nano /var/cpanel/cpanel.config
  3. Make changes accordingly and save the file, after making changes run below command:
  4. /usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings

Installing mod_evasive for apache in cPanel server

What is mod_evasive ?

Mod_evasive helps apache to protect the server from DDOS attacks and bruteforce attacks, if you are getting too many attacks you should consider installing it on cPanel/WHM based servers. Follow the below steps to install/configure it:

  • Login to your server
  • Execute following commands:
  • # cd /usr/local/src/
  • # wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz
  • # tar -xvzf mod_evasive_1.10.1.tar.gz
  • # cd mod_evasive
  • # /usr/local/apache/bin/apxs -cia mod_evasive20.c

Now create new file by executing and add the below code into it:

  • # nano /usr/local/apache/conf/mod_evasive.conf

LoadModule evasive20_module modules/mod_evasive20.so
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 10
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
</IfModule>

Now include the above file inside /usr/local/apache/conf/includes/pre_main_global.conf

Include “/usr/local/apache/conf/mod_evasive.conf”

  • Rebuild apache configuration files:
  • # /scripts/rebuildhttpdconf
  • Restart Apache:
  • # service httpd restart

And you’re done!

Let me know if you have any issue while installing/configuring mod_evasive.

Installing ClamAV antivirus tool on your server

In this post i will describe how to install ClamAV an antivirus tool on your linux OS server.

What is ClamAV:

ClamAV is an antivirus tools, which allows you to scan each file on you server, it provides fast scanning of all files including emails, attachments and uploaded files.

It provides the facility to scan those files that are being uploaded, a real time scanning can be achieved with it. It does scan for malicious scripts and for trojans.

You must have this tool installed on the server specially if you are web hosting provider.

Installation:

  • Login to your server through terminal or ssh with root privileges
  • Run the following commands:

# cd
# wget http://downloads.sourceforge.net/clamav/clamav-0.97.2.tar.gz
# tar -xvzf clamav-0.97.2.tar.gz
# cd clamav-0.97.2 #groupadd clamav
# useradd clamav -g clamav -c “Clam AntiVirus” -s /nonexistent .
# /configure
# make
# make install
# cd ..

  • And you are done, now can run your first scan by this command:

# clamscan -r
OR
# clamscan –remove Read More

DMCA Notice UDP Outgoing flood resolution

In this post i will discuss about the DMCA notice that i have received some times ago. In that notice they have mentioned my server is being used to DDos to some other server via UDP ports. In other words my server was being used to launch DDos Attack on other server via UDP. i had search on google but did not able to find any proper solution to this problem and my bandwidth usage suddenly increased to 2TB+ in a day that was my monthly bandwidth usage before the notification. So i started searching to solve the issue and after 1 month i got a solution that is to check the each account for malicious scripts.

cPanel does not record outgoing traffic on UDP ports for the accounts, the only way to check the outbound traffic is bandmin that is available within cPanel.

You can see all traffic whether it is inbound or outbound from bandmin, to do so go to your browser and type : http://yourdomain.com/bandwidth at this point you will be asked to provide username and password for bandmin that can be changed from cPanel/WHM. Just find the option Bandmin Password Under Service Configuration in you WHM panel’s left side. Change the password and then use it to login to your bandmin stats from http://www.yourdomain.com/bandwidth Read More

Apache2 high RAM usage resolution

In this post i will describe how to decrease memory usage of apache2, i tried to search on google and found many solution to that problem but nothing worked for me. So i discovered a way to decrease the memory usage of apache2.

Apache

Apache

Here is the solution:

  • Login to your server via putty / shell terminal with root access.
  • Execute following command:
# cd /etc/apache2
# nano apache2.conf
  • A text editor will appear with apache2 configuration file find the below line in it:
KeepAlive On
  • Replace this line with:
KeepAlive Off Read More