Page 5 of 5 FirstFirst ... 345
Results 81 to 91 of 91

Thread: [How-To] Linux Malware Detect on Directadmin Powered server

  1. #81
    Join Date
    May 2008
    Posts
    544
    maldet 1.4.2 worked fine on FreeBSD 9.3

    Then I moved to FreeBSD 11. Version 1.5 of maldet have some strange issue:

    root@srv2:/ # maldet -a /home
    sed: 1: "/usr/local/maldetect/ig ...": extra characters at the end of l command
    Linux Malware Detect v1.5
    (C) 2002-2016, R-fx Networks <proj@rfxn.com>
    (C) 2016, Ryan MacDonald <ryan@rfxn.com>
    This program may be freely redistributed under the terms of the GNU GPL v2

    maldet(35281): {scan} signatures loaded: 11294 (9343 MD5 / 1951 HEX / 0 USER)
    maldet(35281): {scan} building file list for "/home", this might take awhile...
    maldet(35281): {scan} setting nice scheduler priorities for all operations: cpunice 19 , ionice 6
    maldet(35281): {scan} scan returned empty file list; check that path exists and contains files in scope of configuration.
    The 1.6 version from github has one error less, but still no-go:

    root@srv2:/ # maldet -a /home
    Linux Malware Detect v1.6
    (C) 2002-2017, R-fx Networks <proj@rfxn.com>
    (C) 2017, Ryan MacDonald <ryan@rfxn.com>
    This program may be freely redistributed under the terms of the GNU GPL v2

    maldet(36829): {scan} signatures loaded: 12077 (9343 MD5 | 1951 HEX | 783 YARA | 0 USER)
    maldet(36829): {scan} building file list for /home, this might take awhile...
    maldet(36829): {scan} setting nice scheduler priorities for all operations: cpunice 19 , ionice 6
    maldet(36829): {scan} scan returned empty file list; check that path exists and contains files in scope of configuration.
    My pending ticket: https://github.com/rfxn/linux-malware-detect/issues/202
    Last edited by wattie; 02-08-2017 at 02:55 PM.

  2. #82
    Join Date
    May 2008
    Posts
    544
    Version v1.6.2 was released on Jul 13 2017.

  3. #83
    Join Date
    Jan 2007
    Posts
    16
    Quote Originally Posted by zEitEr View Post
    Description

    Linux Malware Detect (LMD) is a malware scanner for Linux released under the GNU GPLv2 license, that is designed around the threats faced in shared hosted environments. 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.

    Installation
    Code:
    # cd /usr/local/src
    # wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
    # tar -zxvf maldetect-current.tar.gz
    # cd maldetect-1.4.1
    # ./install.sh
    As soon as installation finishes you'll see something similar to:
    Code:
    Linux Malware Detect v1.4.1
                (C) 2002-2011, R-fx Networks <proj@r-fx.org>
                (C) 2011, Ryan MacDonald <ryan@r-fx.org>
    inotifywait (C) 2007, Rohan McGovern <rohan@mcgovern.id.au>
    This program may be freely redistributed under the terms of the GNU GPL
    
    installation completed to /usr/local/maldetect
    config file: /usr/local/maldetect/conf.maldet
    exec file: /usr/local/maldetect/maldet
    exec link: /usr/local/sbin/maldet
    exec link: /usr/local/sbin/lmd
    cron.daily: /etc/cron.daily/maldet
    
    maldet(19402): {sigup} performing signature update check...
    maldet(19402): {sigup} local signature set is version 2012011929852
    maldet(19402): {sigup} latest signature set already installed
    Running as cron job

    Note, /etc/cron.daily/maldet should be changed for compatibility with Directadmin's structure of homedirs:

    Code:
    #!/bin/bash
    
    # clear quarantine/session/tmp data every 14 days
    /usr/sbin/tmpwatch 336 /usr/local/maldetect/tmp >> /dev/null 2>&1
    /usr/sbin/tmpwatch 336 /usr/local/maldetect/sess >> /dev/null 2>&1
    /usr/sbin/tmpwatch 336 /usr/local/maldetect/quarantine >> /dev/null 2>&1
    /usr/sbin/tmpwatch 336 /usr/local/maldetect/pub/*/ >> /dev/null 2>&1
    
    # check for new release version
    /usr/local/maldetect/maldet -d >> /dev/null 2>&1
    
    # check for new definition set
    /usr/local/maldetect/maldet -u >> /dev/null 2>&1
    
    # if were running inotify monitoring, send daily hit summary
    if [ "$(ps -A --user root -o "comm" | grep inotifywait)" ]; then
            /usr/local/maldetect/maldet --alert-daily >> /dev/null 2>&1
    else
            # scan the last 2 days of file changes
            if [ -d "/home/virtual" ] && [ -d "/usr/lib/opcenter" ]; then
                    # ensim
                    /usr/local/maldetect/maldet -b -r /home/virtual/?/fst/var/www/html 2 >> /dev/null 2>&1
                    /usr/local/maldetect/maldet -b -r /home/virtual/?/fst/home/?/public_html 2 >> /dev/null 2>&1
            elif [ -d "/etc/psa" ] && [ -d "/var/lib/psa" ]; then
                    # psa
                    /usr/local/maldetect/maldet -b -r /var/www/vhosts/?/httpdocs 2 >> /dev/null 2>&1
                    /usr/local/maldetect/maldet -b -r /var/www/vhosts/?/subdomains/?/httpdocs 2 >> /dev/null 2>&1
            elif [ -d "/usr/local/directadmin" ]; then
                    # directadmin
                    /usr/local/maldetect/maldet -b -r /home?/?/domains/?/public_html 2 >> /dev/null 2>&1
            else
                    # cpanel, interworx and other standard home/user/public_html setups
                    /usr/local/maldetect/maldet -b -r /home?/?/public_html 2 >> /dev/null 2>&1
            fi
    
            # scan default apache docroot paths
            if [ -d "/var/www/html" ]; then
                    /usr/local/maldetect/maldet -b -r /var/www/html 2 >> /dev/null 2>&1
            fi
            if [ -d "/usr/local/apache/htdocs" ]; then
                    /usr/local/maldetect/maldet -b -r /usr/local/apache/htdocs 2 >> /dev/null 2>&1
            fi
    fi
    Note, in the file we should find the section:

    Code:
    # scan default apache docroot paths
            if [ -d "/var/www/html" ]; then
                    /usr/local/maldetect/maldet -b -r /var/www/html 2
            fi
            if [ -d "/usr/local/apache/htdocs" ]; then
                    /usr/local/maldetect/maldet -b -r /usr/local/apache/htdocs 2
            fi
    and change it to (so we add >> /dev/null 2>&1 at the end of two lines)

    Code:
    # scan default apache docroot paths
            if [ -d "/var/www/html" ]; then
                    /usr/local/maldetect/maldet -b -r /var/www/html 2 >> /dev/null 2>&1
            fi
            if [ -d "/usr/local/apache/htdocs" ]; then
                    /usr/local/maldetect/maldet -b -r /usr/local/apache/htdocs 2 >> /dev/null 2>&1
             fi
    Manual scanning

    To scan all files in /home/ you should run it as following
    Code:
    # maldet -a /home?/?/domains/?/public_html
    or

    Code:
    # maldet -b -a /home?/?/domains/?/public_html
    in a background.

    Please, consider that some PHP shells might still stay invisible for maldet.

    The maldet website

    http://www.rfxn.com/projects/linux-malware-detect/
    Firstly, thank you. I have installed the latest version of Linux Malware Detect v1.6.2.
    I did the Cron settings as you specified. I did a scan for a user.

    Example maldet -a / home / xxuserxx

    The result was two malicious files. Mail address I received mail information.

    But I did not get into the quarantine even though the option was active so I wanted to get it in the conf file.

    SCAN ID: 171205-2331.31423
    STARTED: Dec 5 2017 23:31:53 +0300
    COMPLETED: Dec 5 2017 23:32:45 +0300
    ELAPSED: 52s [find: 1s]
    PATH: /home/elit
    TOTAL FILES: 10609
    TOTAL HITS: 3
    TOTAL CLEANED: 0
    FILE HIT LIST:

    {HEX}perl.generic.fakeproc.52 : /home/elit/domains/simpledomain.com/public_html/images/error/error.log
    {HEX}php.cmdshell.SimShell.362 : /home/elit/domains/simpledomain.com/public_html/images/command.php
    {HEX}perl.connback.DataCha0s.42 : /home/elit/domains/simpledomain.com/public_html/images/cgishell/dc.pl


    MALDET CONF FILES :
    =============================================== Linux Malware Detect v1.6.2 <

    ##
    # [ QUARANTINE OPTIONS ]
    ##
    # The default quarantine action for malware hits
    # [0 = alert only, 1 = move to quarantine & alert]
    quarantine_hits="1"

    # Try to clean string based malware injections
    # [NOTE: quarantine_hits=1 required]
    # [0 = disabled, 1 = clean]
    quarantine_clean="1"

    # The default suspend action for users wih hits
    # Cpanel suspend or set shell /bin/false on non-Cpanel
    # [NOTE: quarantine_hits=1 required]
    # [0 = disabled, 1 = suspend account]
    quarantine_suspend_user="1"

    # The minimum userid value that can be suspended
    # [ default = 500 ]
    quarantine_suspend_user_minuid="500"

    ##

  4. #84
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,407
    If you changed your settings after started scan then it's expected. You need to update settings before starting a new scan.
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  5. #85
    Join Date
    Jan 2007
    Posts
    16
    Quote Originally Posted by zEitEr View Post
    If you changed your settings after started scan then it's expected. You need to update settings before starting a new scan.
    Thnks zEitEr
    Sequence operation. Start setup, setup and scan.
    But he gave the same result again. How do I stop and restart all of them, including fully hidden scans on the backplane?

    Regards

  6. #86
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,407
    You should update config under /usr/local/maldetect/, i.e. /usr/local/maldetect/conf.maldet, not under /usr/local/src/
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  7. #87
    Join Date
    Jan 2007
    Posts
    16
    Quote Originally Posted by zEitEr View Post
    You should update config under /usr/local/maldetect/, i.e. /usr/local/maldetect/conf.maldet, not under /usr/local/src/

    After the installation, I first updated the file in the following path.

    [root@serverlord ~]# nano /usr/local/maldetect/conf.maldet


    ##
    # [ QUARANTINE OPTIONS ]
    ##
    # The default quarantine action for malware hits
    # [0 = alert only, 1 = move to quarantine & alert]
    quarantine_hits="1"

    # Try to clean string based malware injections
    # [NOTE: quarantine_hits=1 required]
    # [0 = disabled, 1 = clean]
    quarantine_clean="1"

    # The default suspend action for users wih hits
    # Cpanel suspend or set shell /bin/false on non-Cpanel
    # [NOTE: quarantine_hits=1 required]
    # [0 = disabled, 1 = suspend account]
    quarantine_suspend_user="1"

    # The minimum userid value that can be suspended
    # [ default = 500 ]
    quarantine_suspend_user_minuid="500"

  8. #88
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,407
    Update:

    Code:
    quarantine_suspend_user="1"


    should be 0, as it does not work with Directadmin.


    and try again.
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  9. #89
    Join Date
    Jan 2007
    Posts
    16
    Quote Originally Posted by zEitEr View Post
    Update:

    Code:
    quarantine_suspend_user="1"


    should be 0, as it does not work with Directadmin.


    and try again.


    same again zEitEr

    PATH: /home/elit
    TOTAL FILES: 13332
    TOTAL HITS: 3
    TOTAL CLEANED: 0

    we can do this at the command line. Can we restart Yada maldet?

    The example command I am using is: [root@serverlord ~]# maldet -a /home/xxuser
    Last edited by th£ lord; 12-06-2017 at 04:13 AM. Reason: additional question

  10. #90
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,407
    Run this:

    Code:
    maldet --config-option quarantine_hits=1 -b -a /home/xxuser
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  11. #91
    Join Date
    Jan 2007
    Posts
    16
    Quote Originally Posted by zEitEr View Post
    Run this:

    Code:
    maldet --config-option quarantine_hits=1 -b -a /home/xxuser
    yes he took it to the quarantine. When I checked, the file was not in place.

    But when I checked the user manual files, there were still many harmful files. But he did not see them.

    http://prntscr.com/hjzezb
    http://prntscr.com/hjzfc1
    http://prntscr.com/hjzfvp

    the following link also closes the files and prints all users to tct.

    http://prntscr.com/hjzefv

Page 5 of 5 FirstFirst ... 345

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •