This article describes host intrusion detection as a Linux security measure.
The purpose of host intrusion detection is to detect the presence of rootkits and malware.
This article deals with the following tools (*).
(*) For the version, use the latest version at the time of writing this article.
chkrootkit chkrootkit is a tool for detecting the existence of rootkits. The standard CentOS repository does not include the chkrootkit package like Ubuntu does.
In addition, chkrootkit uses the following command. It is meaningless after it has already been tampered with, so it should be taken into consideration when introducing it. Also, since chkrootkit does not have a function to automatically deal with rootkit even if it is detected, it is necessary to take action manually after detection.
The following command is used by the chkrootkit script.
--Installation of required packages
# yum groups install -y "Development Tools"
# yum install -y wget glibc-static
# wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz
# tar xzvf chkrootkit.tar.gz
# cd chkrootkit-0.53
# make sense
--Create symbolic link
# cd ../; mv chkrootkit-0.53/ /usr/local/
# ln -s /usr/local/chkrootkit-0.53/ /usr/local/chkrootkit
# cd /usr/local/chkrootkit
--Rootkit detection (executed for the specified directory)
# ./chkrootkit -r <directory>
You can check it regularly by setting it with cron. The following will be done daily at 3 o'clock and you will be notified by email.
0 3 * * * (cd /usr/local/chkrootkit; ./chkrootkit 2>&1 | mail -s "chkrootkit output" root)
rkhunter rkhunter is also a tool for detecting the existence of rootkits. Like chkrootkit, it is not included in the CentOS standard repository, so change rkhunter to sourceforge.net. Download from files / rkhunter / 1.4.6 /). Alternatively, you can install it from the EPEL repository.
# wget https://sourceforge.net/projects/rkhunter/files/rkhunter/1.4.6/rkhunter-1.4.6.tar.gz
# tar xzvf rkhunter-1.4.6.tar.gz
# cd rkhunter-1.4.6
# ./installer.sh --install
If you are installing from the EPEL repository, you can install it by following the steps below.
# yum install -y epel-release
# yum install rkhunter
The operation settings of rkhunter are set in
/etc/rkhunter.conf, and the default database directory is
/ var / lib / rkhunter / db. Rootkit discovery will log to the
# rkhunter --update
--Update the status of the command executable file
# rkhunter --propupd
--Rootkit detection (
--check executes rootkit detection,
-skip-keypress does not enter Enter,
--report-warnings-only displays only a warning about the command result )
# rkhunter --check --skip-keypress --report-warnings-only
maldetect（Linux Malware Detect） maldetect (Linux Malware Detect) is a free malware detection tool released under the license of ** GNU GPLv2 **. See R-FX NETWORKS for the official blog.
The features of maldetect are as follows.
--Automatic update of signature (*) for malware detection --ClamAV is adopted as open source antivirus software for the detection engine --Create a database of file system information to be detected and compare it with the inspected information to detect tampering.
(*) Byte sequence common to specific malware samples
# wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
# tar xzvf maldetect-current.tar.gz
# cd maldetect-1.6.4/
The cronjob installed by maldetect will be deployed to
/etc/cron.daily/maldet. It is set to scan and update signatures on a regular basis.
If you do not specify any operation settings for maldetect, it will be installed in
# maldet --update
--Malware scan execution (execution targeting the specified directory)
# maldet --scan-all <directory>
When you build and operate a server, you are responsible for managing the system.
Systems management is a collection of knowledge. You can improve security by using OSS etc. without spending too much money.