Install Linux Malware Detect (LMD) v1.5 on Linux

Linux Malware Detect (LMD) is a malware scanner for Linux distribution, Which is released under the GNU GPLv2 license. LMD v1.5 has been released after 2 Years & 7 months with huge bug fixs, changes & added new features on September 19, 2015.
That is especially designed to find the threats in shared hosted environments because in shared environment thousand plus users are sharing the resources. Each and every user will upload different things and script, etc.., It uses threat data from network edge intrusion detection systems to extract malware that is actively being used in attacks and generates signatures for detection.

In addition, threat data is also derived from user submissions with the LMD checkout feature and from malware community resources. The signatures that LMD uses are MD5 file hashes and HEX pattern matches, they are also easily exported to any number of detection tools such as ClamAV.

1) Install Linux Malware Detect (LMD)

There is no .rpm, .dep or PPA is available to install LMD on your system, Also its not included in any of the distro official repository. The only option is left for us to install manual method from source. Here I’m going to show you about LMD installation.
# Downloading LMD archive file #
# wget http://www.rfxn.com/downloads/maldetect-current.tar.gz

# Extracting LMD archive file #
# tar -zxvf maldetect-current.tar.gz

# Navigate to extracted directory #
# cd maldetect-1.5

# Install LMD #
# ./install.sh

2) Configure LMD

The configuration of LMD is handled through /usr/local/maldetect/conf.maldet and all options are well commented for ease of configuration. By default LMD has the auto-qurantine of files disabled and you need to enable it. Also make below changes to make it easier and more efficient to use LMD.
# Open conf.maldet file #
# nano /usr/local/maldetect/conf.maldet

# To get email alert #
email_alert=1

# Add your meail id to get email alert #
magesh@2daygeek.com

# To move malware to quarantine & alert #
quarantine_hits=1

# Clean injected malware #
quarantine_clean=1

# To suspend/disable your wish #
quarantine_suspend_user=0

# To set minimum user id that can be suspended #
quarantine_suspend_user_minuid=500

3) Scan The system

To scan the system using LMD, use maldet followed by directory which you want to scan.
# maldet --scan-all /opt
Linux Malware Detect v1.5
            (C) 2002-2015, R-fx Networks 
            (C) 2015, Ryan MacDonald 
This program may be freely redistributed under the terms of the GNU GPL v2

maldet(4465): {scan} signatures loaded: 10822 (8908 MD5 / 1914 HEX / 0 USER)
maldet(4465): {scan} building file list for /opt, this might take awhile...
maldet(4465): {scan} setting nice scheduler priorities for all operations: cpunice 19 , ionice 6
maldet(4465): {scan} file list completed in 0s, found 1 files...
maldet(4465): {scan} scan of /opt (1 files) in progress...
maldet(4465): {scan} 1/1 files scanned: 0 hits 0 cleaned
maldet(4465): {scan} scan completed on /opt: files 1, malware hits 0, cleaned hits 0, time 1s
maldet(4465): {scan} scan report saved, to view run: maldet --report 151218-2043.4465
The above command will scan entire support.2daygeek.comm directory. It may take time depending upon no of files in that directory.

4) Printing Scan Report

To view scan report, use maldet command followed by SCAN ID which you got from previous output. Output stored under /usr/local/maldetect/sess/ directory.
# maldet --report 151218-2043.4465

HOST:      2daygeek
SCAN ID:   151218-2043.4465
STARTED:   Dec 18 2015 20:43:23 +0530
COMPLETED: Dec 18 2015 20:43:24 +0530
ELAPSED:   1s [find: 0s]

PATH:          /opt
TOTAL FILES:   1
TOTAL HITS:    0
TOTAL CLEANED: 0

===============================================
Linux Malware Detect v1.5 < proj@rfxn.com >

5) Removing injected files

In my causes no injection file is there. If you got output with malware injection on your system, use the below commands to remove it.
# To quarantine the infected files #
# maldet -q SCANID

# To clean infected files #
# maldet -n SCANID

6) LMD & signatures Update to latest

Use below both command to update your LMD version & virus signatures to latest.
# Update the installed version from rfxn.com #
# maldet -d

# Update malware detection signatures from rfxn.com #
# maldet -u

7) Live Monitoring

If you want to actively monitor specific directories for malware infection, you can run maldet as a daemon like below. This can be clubbed with inotify-tools, so you have to install the package to run live monitor.
# apt-get install inotify-tools

# maldet -m /home/daygeek
Linux Malware Detect v1.5
            (C) 2002-2015, R-fx Networks 
            (C) 2015, Ryan MacDonald 
This program may be freely redistributed under the terms of the GNU GPL v2

maldet(5814): {mon} set inotify max_user_watches to 49152
maldet(5814): {mon} added /home/daygeek to inotify monitoring array
maldet(5814): {mon} starting inotify process on 1 paths, this might take awhile...
maldet(5814): {mon} inotify startup successful (pid: 5912)
maldet(5814): {mon} inotify monitoring log: /usr/local/maldetect/logs/inotify_log
Use the tail command with above log location to view live monitor.

8) Automatic Scan

While installing LMD, it will drop the auto scan file to /etc/cron.daily/maldet which will perform a daily update of signatures and keep the session, temp and quarantine data upto 14 days. Also run a daily scan of recent file system changes.