cPanel: Running a ClamAV and Maldet scan Print

  • 135

You may be familiar with ClamAV and Maldet (aka Linux Malware Detect). They're widely known as two excellent choices for identifying malware. What you may not realize, however, is that they can be used together. The benefit of doing this is a faster, more effective malware scan meaning you're more likely to identify potential threats.

This tutorial is based around cPanel systems and will require changes on other platforms.

Installing ClamAV via WHM

1) Login to WHM (Web Host Manager) as the root user
2) Navigate to: Home » cPanel » Manage Plugins
3) Tick the Install and keep updated box
4) Click on Save

Installing ClamAV via SSH

This command tells the system that we want ClamAV to be listed as installed by the local RPM system:

/scripts/update_local_rpm_versions --edit target_settings.clamav installed

This command is the one responsible for installing the ClamAV RPM on your server:


/scripts/check_cpanel_rpms --fix --targets=clamav

Installing Maldet

1) Login to SSH as the root user
2) Execute the below commands:

cd /usr/local/src/
wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
tar -xzf maldetect-current.tar.gz
cd maldetect-1.6.4
sh ./install.sh

Linking the two together

If you were to run a Linux Malware Detect scan now, it would run with no problem, however; it would not include ClamAV's definitions, therefore slowing down the scan completion time and threat detection ratio. To solve this, we must create two symbolic links, as follows:

ln -s /usr/local/cpanel/3rdparty/bin/clamscan /usr/local/bin/clamscan
ln -s /usr/local/cpanel/3rdparty/bin/freshclam /usr/local/bin/freshclam

Updating the applications

Let's ensure both applications are up-to-date now:

maldet -d
maldet -u
/usr/local/cpanel/3rdparty/bin/freshclam

Running a malware scan

Now, when you run a Maldet scan, you'll have the best of both worlds (think of it as ClamAV and Linux Malware Detect teaming up). Say you wanted to run a malware scan of /home, you could do so with:

maldet -a /home/?

The above command will scan all files and directories within the /home directory, which is where the content for cPanel accounts is stored.

Below is a sample output of what you should see:

root@server [~]# maldet -a /home/?
Linux Malware Detect v1.6.4
            (C) 2002-2019, R-fx Networks <proj@rfxn.com>
            (C) 2019, Ryan MacDonald <ryan@rfxn.com>

This program may be freely redistributed under the terms of the GNU GPL v2

maldet(4626): {scan} signatures loaded: 15552 (12740 MD5 | 2035 HEX | 777 YARA | 0 USER)
maldet(4626): {scan} building file list for /home/digitools4u/?, this might take awhile...
maldet(4626): {scan} setting nice scheduler priorities for all operations: cpunice 19 , ionice 6
maldet(4626): {scan} file list completed in 0s, found 15555 files...
maldet(4626): {scan} found clamav binary at /usr/local/cpanel/3rdparty/bin/clamdscan, using clamav scanner engine...
maldet(4626): {scan} scan of /home/digitools4u/? (15555 files) in progress...
maldet(4626): {scan} processing scan results for hits: 4 hits 0 cleaned
maldet(4626): {scan} scan completed on /home/user/?: files 15555, malware hits 4, cleaned hits 0, time 113s
maldet(4626): {scan} scan report saved, to view run: maldet --report 190823-1904.4626
maldet(4626): {scan} quarantine is disabled! set quarantine_hits=1 in conf.maldet or to quarantine results run: maldet -q 190823-1904.4626
root@server [~]#


Was this answer helpful?

« Back

We're trusted by amazing customers in 136 countries - come & join us!
Matthew Beausoleil February 4, 2024
Everything is working as expected

I was looking for a simple syncthing server and didn't need anything fancy. I found Ethernet servers on server hunter and chose them because of their low price and good reviews. I had access to my server within a few minutes. It was easy for me to change the ubuntu to Centos and everything is working as expected.

Sameed Sohani January 21, 2024
Great service overall thus far

Three reasons I decided to try out the service: I heard and subsequently saw that the prices were great, it is very hard to beat those unmanaged special offer prices. I heard that the service was reliable, so far so good. It's only been a week, but I hope that it will continue to be reliable as I use it more. I heard that the support is excellent, and I have to agree. Great service overall thus far.

ジエント January 12, 2024
The networks are top of the line

Great upload and download speeds, apt-get updating is a breeze. The only mishaps was on my end, ssh had some weird buffer lag (sometimes unresponsiveness) that has to do with my connection with my isp. Just make sure your connection stable and everything should work just fine. The networks are top of the line.

Atul Sharma January 3, 2024
Nothing but a joyful experience

Been with them for a week and the transition from old hosting to ethernetserver has been nothing but a joyful experience. Setting up new vps, networking is like a breeze. All set up by george and nothing to worry about really.


Ethernet Servers Ltd
124 City Road
London
EC1V 2NX
United Kingdom


Registered Limited Company: #09114946

Telephone:
+44 330 043 1258

Email:
sales@ethernetservers.com

Copyright © 2014 - 2024 - Ethernet Servers Ltd - All Rights Reserved.

Proudly serving customers in 136 countries since September 2013!