Rootkit Hunter (rkhunter) is a Unix-based tool that scans for rootkits, backdoors and possible local exploits. Rootkits are self-hiding toolkits secretly installed by a malicious intruder to allow that user to gain access to the server. Rootkit Hunter offers protection by comparing SHA-1 hashes of important files with known good ones in a online database as well as:
MD5 hash compare
Look for default files used by rootkits
Wrong file permissions for binaries
Look for suspected strings in LKM and KLD modules
Look for hidden files
Optional scan within plaintext and binary files
If this is the first installation of RHEL and CentOS RPMForge Repository:
RHEL/CentOS 7:
# yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
RHEL/CentOS 6 64 bit:
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
RHEL/CentOS 6 32 bit:
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
# rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.i686.rpm
yum install rkhunter
# /usr/local/bin/rkhunter –update
# /usr/local/bin/rkhunter –propupd
# rkhunter -c
grep Warning /var/log/rkhunter/rkhunter.log
Check the version
# rkhunter –versioncheck
Rootkit Hunter version 1.4.2
Checking rkhunter version…
This version : 1.4.2
Latest version: 1.4.2
Manual Scan
# rkhunter -c
rkhunter -c -l /var/log/rkhunter.log
Create the run-file in the following location (RHEL based distributions only):
#nano -w /etc/cron.daily/rkhunter.sh
Install into shell script
#!/bin/sh
(
/usr/bin/rkhunter –versioncheck
/usr/bin/rkhunter –update
/usr/bin/rkhunter –cronjob –report-warnings-only
) | /bin/mail -s ‘rkhunter Daily Scan Report (ServerNameHere)’ your@email.here
Set Execute Permissions
Set execute permission on the file you have just created:
# chmod 755 /etc/cron.daily/rkhunter.sh
he cron utility will run once daily, and if a threat is detected, the rkhunter command itself will email our user to alert them. If no problems were found, no email will be received.
Rootkit Hunter configuration
The configuration file for rkhunter can be found at:
# /etc/rkhunter.conf
SSHD Root Logon
The parameter ALLOW_SSH_ROOT_USER tells rkhunter whether or not the root user is allowed to ssh into the system. This is unset by default in the rkhunter.conf file. Rkhunter will complain about this on every run. If you have disabled root login, you should set this parameter to “no”.
ALLOW_SSH_ROOT_USER=no
If you need root login over SSH, you should change this parameter to “yes” so that rkhunter can check this and will mark this setting as valid:
ALLOW_SSH_ROOT_USER=yes
Security practices recommend disabling root login.
Update rkhunter
To check the currently installed version enter the following:
# rkhunter –versioncheck
Run the updater by issuing the following command:
# rkhunter –update
With our database files refreshed, we need to tell rkhunter to check the current values and store them as known-good values:
# rkhunter –propupd
Recent Comments