Install and configure LMD and Clam AntiVirus on CentOS 7

LMD and Clam Antivirus

Introduction

Linux Malware Detect is a malware detector and scanner for GNU/Linux, designed particularly for shared hosting environments. It is released under the GNU GPLv2 license, and it supports installation on cPanel WHM and GNU/Linux environments concurrently with other detection softwares like ClamAV.
This one is an open source antivirus solution to detect trojans, malware, viruses and other malicious software that supports multiple platforms, including Windows, MacOS, and GNU/Linux.
This tutorials explains how to install LMD and Clam Antivirus on a CentOS 7 server.

Getting started – EPEL repository and Mailx

First of all, install the EPEL repository and mailx. The last one is a mail processing system, based on Berkeley Mail 8.1, and provides enhanced features for interactive use, such as caching and disconnected operation for IMAP, message threading, scoring, and filtering. It is also usable as a mail batch language, both for sending and receiving mail.
First, install EPEL:

# yum install epel-release

and then Mailx:

# yum install mailx

In this scenario, Mailx will be used by LMD for sending scan reports to your email address.

Install LMD

The package is not available in CentOS or EPEL, so a manual installation is required.
Download LMD and extract it:

# wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
# tar -xzvf maldetect-current.tar.gz

As root, run the installer script install.sh present in extracted directory:

# cd maldetect-x.x
# ./install.sh

Next, make a link to the maldet command in /bin:

# ln -s /usr/local/maldetect/maldet /bin/maldet
# hash -r

Configure LMD

LMD has been installed into /usr/local/maldet/. In that directory, there is a configuration file – we’re going to modify it:

# $EDITOR /usr/local/maldetect/conf.maldet

Enable email alerts by changing the value to 1 on line 16.

email_alert="1"

Then, search for the email address line, and modify it as follow:

email_addr="[email protected]"
ClamAV clamscan binary will be used as default scan engine; that's because it provides a high-performance scan on large file sets.  To allow this, search and edit following line:
scan_clamscan="1"

Next, it’s possible to enable quarantining to move malware to the quarantine during the scan process. To do this, change the following line:

quarantine_hits="1"

Next, enable clean based malware injections by changing:

quarantine_clean="1"

That’s all for LMD configuration.

Install ClamAV

Now that LMD is correctly installed and configured, let’s install Clam AntiVirus to get the best scanning results. ClamAV is available in the EPEL repository.
So, using yum:

#yum install clamav clamav-devel

After ClamAV has been installed, update the ClamAV virus databases with freshclam:

# freshclam

Testing LMD and ClamAV

Now it’s possible to test LMD with a manual scan. To accomplish this task, execute maldet. With this command, scan /var/www/html/.
In the web root directory, download some sample malware with wget:

# cd /var/www/html
# wget http://www.eicar.org/download/eicar.com.txt
# wget http://www.eicar.org/download/eicar_com.zip
# wget http://www.eicar.org/download/eicarcom2.zip

Next, it’s possible to scan the web root directory, as previously said, with maldet:

# maldet -a /var/www/html

During this process, it’s possible to see that LMD is using the ClamAV scanner engine to perform the scan: it will find three malware hits.
Check the report with the following command:

# maldet --report SCANID

SCANID is a numerical value found in the Maldet output.

Next, verify that there is an email containing the report:

# tail -f /var/mail/root

If everything was well configured, that email should contain all the required information.

It’s also possible to acquire a list of all reports:

# maldet -e list

Or “filter” files to scan. For instance, to scan files modified in the last 10 days:

# maldet -r /var/www/html 10

For more information, just call the help with:

# maldet --help

that contains all options recognized by LMD.

There you go! That’s one great way to protect from web server infections on a GNU/Linux system.

  • I was without work for half a year when my early Co-worker at last recommended me to get started with freelancing from home… It was only just after I received $5000 in my 1st month when I seriously believed I am able to do this for a living! At the moment I am joyful than ever… I work-at-home as well as I am my own boss now like I always wanted… I see so many unsatisfied people around me, working the same old boring job that’s sucking the everyday life out of them day by day… Whenever I notice any person similar to that I say START FREELANCING MAN! This is where I started >>>> http://urll­.­in/hYQX4

  • Chief of Bing!, is helping visitors to get started in “Work at home” method, that Internet marketers have been doing more than a year now. This year alone, I generated approximately $36k up till now with nothing but my desktop as well as some free time, despite that i have a full-time nine to 5 job. Even everyone newbie in this, actually make $50/per h easily and the income can go much higher with time… This is how i started >> http://adultadda­.­net/2Y2

  • M­a­n­y p­e­o­ple w­a­nt t­o ha­v­e a high in­com­e at their, bu­t t­he­y don’t have much idea ho­w t­o exactly d­o th­at o­n th­e Int­ernet. Th­ere ar­e a many w­ays t­o ea­rn large am­ount of mo­ney, b­ut wh­enev­er p­eopl­e t­ry th­at the­y g­et tr­app­ed in a s­cam, Therefore I am sh­aring wi­th yo­u a g­enuine an­d gu­arante­ed w­ay f­or fre­e to ea­rn hug­e am­ount of mon­ey a­t ho­me.I am making atleast $10000 on a monthly basis since a whole year.Its an online job and also very simple to do, Even a little child can do this job and make online money. If you want a happy and wealthy life then you need to copy and paste this internet website in web browser and then follow instructions to get started today and make Thousands Online……….. http://ipt­.­pw/ZJg4Gu

  • M­a­n­y p­e­o­ple wish t­o ha­v­e a passive earnings at h­o­me, bu­t t­he­y don’t have much idea ho­w t­o exactly d­o th­at o­n th­e Int­ernet. Th­ere ar­e a a number of w­ays t­o ea­rn great am­ount of mo­ney, b­ut wh­enev­er p­eopl­e t­ry th­at the­y g­et tr­app­ed in a fraud, So Now I am sh­aring wi­th yo­u a g­enuine an­d gu­arante­ed w­ay f­or fre­e to ea­rn hug­e am­ount of mon­ey a­t ho­me.I am earning atleast $10000 each month since a whole year.Its a web-based job and also really easy to do, Even a little boy or girl can do this job and make online money. If you want a happy and rich life then you need to copy and paste this site in web browser and then follow instructions to get started right now and make Thousands On the internet……….. http://b1z­.­org/38I

  • I have been on a number of systems but nothing worked well for me in a proper manner. Lastly in 2012 I came across a system that is crazy. It is quite simple and easy to setup and I began advertising it within few mins.This program works and is ideal for everyone regardless of age,educational background or occupational skills.You can get immediate results even if you feel like you have sup-par computer skills.I have earned $1000 in my first 7-day period after which I am earning $10000 or even more a month.Thank you for creating this amazing system that is perfect for the average person >>>> http://deliciousurl­.­com//2z

  • In case you seeking real online home-based venture but are tired with web-based fraudsters then this is actually what you were seeking for. I started out working on this work couple of years back and I am earning 7 thousand dollars or higher per mnth effortlessly. Make money like me… Explore site >>>>>>>>>>> http://v15­.­uk/hNAUC

  • Earning profits on the internet can be as unproblematic (or just as stressful) just as earning money off the net. While a great number of Internet business pros promise to possess a key model which will make immediate bucks, the simple truth is, there is absolutely no opportunity you will be able to emerge as wealthy suddenly by clicking on a button or even finding quite a few handbook. Getting cash via internet usually requires working hard and also determination. For everybody who is prepare to input time as well as effort involved, there are various methods to bringing in additional income source using the web.I am making 10 thousand bucks or even just many more each and every month from this gig.Here is the shortcut to earn a living even though the others are long term making money online ideas >>>>> OUOURL.COM/4rg8

  • Have you consistently received huge profits without reselling any-thing or even just left out engaging in any of the referral marketing sort of job without having to invest something. I want to tell you about a job at which just about all resources are going to be presented to you and additionally it is a simple and also so easy task. No need to set up your very own websites etc., almost all will be provided to you cost-free. People should certainly take a look at a website so you will get paid for that. It is actually as easy as that. I am creating huge amounts of funds in a home office out of this task exactly like 20000 dollars once per month and sometimes more and if you too wish to make money like this so therefore follow these specific relatively simple directions by looking at this internet website >>>>> URL4.UK/p3Fof