Installing Linux Malware Detect (LMD) on CentOS

Malware is known as malicious software. It can be any script, app or anything which is harmful for our system and data in any kinds.

Linux Malware detect (LMD) is a malware scanner for linux released under the gnu GPLv2 license, that is intended around the threats faced in hosted environments. It uses threat data from network edge intrusion detection systems to extract malware that's actively getting used in attacks and generates signatures for detection.

The threat landscape in shared hosted environments is unique from that of the standard AV products detection suite in that they are detecting primarily OS level trojans, rootkits and traditional file-infecting viruses but missing the ever increasing variety of malware on the user account level which serves as an attack platform.

Step 1: Download and Install LMD

First login to your server using SSH clients (Eg: Putty) and download the latest LMD source code using following commands.

# cd /opt
# wget

Now extract the downloaded archive in current directory

# tar xfz maldetect-current.tar.gz

After extracting the archive, execute script provided in source, which will install LMD in your system.

# cd maldetect-1.4.2
# sh

Step 2: Configure LMD

LMD creates an configuration file /usr/local/maldetect/conf.maldet, where we can define the working of LMD and what action to take.

# vim /usr/local/maldetect/conf.maldet
# The default email alert toggle
# [0 = disabled, 1 = enabled]
# The subject line for email alerts
email_subj="MLD Scan Report from $(hostname)"
# The destination addresses for email alerts
# [ values are comma (,) spaced ]
# Ignore e-mail alerts for reports in which all hits have been cleaned.
# This is ideal on very busy servers where cleaned hits can drown out
# other more actionable reports.
# The default quarantine action for malware hits
# [0 = alert only, 1 = move to quarantine & alert]
# Try to clean string based malware injections
# [NOTE: quar_hits=1 required]
# [0 = disabled, 1 = clean]
# The default suspend action for users wih hits
# Cpanel suspend or set shell /bin/false on non-Cpanel
# [NOTE: quar_hits=1 required]
# [0 = disabled, 1 = suspend account]
# minimum userid that can be suspended

Step 3: Start Scanning Manually

At this stage you have successfully installed and configured LMD on your system. Lets run your first scan manually by executing following command.

# maldet --scan-all /var/www/html

The above command will scan all the files and directories under /var/www/html. It may take a long time to complete depending on your number of files. After completion of above command it will show you a command to see report like below

# maldet --report 060214-1946.24560
malware detect scan report for
SCAN ID: 060214-1946.24560
TIME: May  28 19:46:12 +0530
PATH: /var/www/html/
Linux Malware Detect v1.4.2 < >

In my case the TOTAL HITS is 0, So LMD doesn't detect any malware on system. But If it detects any malware on your system, Use one of following command to quarantine malwares

# maldet --quarantine SCANID
# maldet --clean SCANID

SCANID can be found in report generated above.

Step 4: Setup Regular Scanning

During installation of LMD it already creates and crontab file to be execute on daily basis

# vi /etc/cron.daily/maldet

But if your system has large number of files and directories change scanning to weekly basis rather than daily.


Popular posts from this blog

Reduce TIME_WAIT Socket Connections