linux:rkhunter
Table of Contents
Rootkit Hunter
- As the name implies, its a tool to detect rootkits.
- I will describe installation and configuration for arch and ubuntu
Links
Arch
- I used rkhunter 1.3.8-1
Installation
- You need two packages: unhide and rkhunter itself both available in the AUR.
- download pkgbuild (I use slurpy you also can download the pkgbuild manual) an install it.
slurpy -d rkhunter cd rkhunter makepkg pacman -U rkhunter-1.3.8-1-any.pkg.tar.xz cd .. slurpy -d unhide cd unhide makepkg pacman -U unhide-20100819-1-x86_64.pkg.tar.xz
Configuration
- There are a lot of comments which describe the use of these many options.
- My Config “/etc/rkhunter.conf”:
- Heimdal is detected as “adore” rootkit therefore this line.
- First line whitelist the file and the second checks for changes.
RTKT_FILE_WHITELIST="/usr/sbin/kfd" USER_FILEPROP_FILES_DIRS="/etc/rkhunter.conf /usr/sbin/kfd"
Using
- First you have to create checksums so rkhunter checks for changes in files. This you have to do after every change to the files which are checked.
rkhunter --propupd
- Then you could run first check this will take some time.
sudo /usr/bin/rkhunter -c
- To do this daily a cron is needed
- Here a script adapted from ubuntu auto created cron
#!/bin/sh # übernahme von Ubuntu RKHUNTER=/usr/bin/rkhunter REPORT_EMAIL=root if [ -z "$NICE" ]; then NICE=0 fi OUTFILE=`mktemp` || exit 1 /usr/bin/nice -n $NICE $RKHUNTER --cronjob --report-warnings-only \ --createlogfile /var/log/rkhunter.log $RK_OPT > $OUTFILE if [ -s "$OUTFILE" ]; then ( echo "Subject: [rkhunter] $(hostname -f) - Daily report" echo "To: $REPORT_EMAIL" echo "" cat $OUTFILE ) | /usr/sbin/sendmail $REPORT_EMAIL fi rm -f $OUTFILE
- This sends the Warnings to local root User and should be placed in “/etc/cron.daily/”.
Ubuntu
- I used rkhunter 1.3.6-3ubuntu1
Installation
apt-get install rkhunter unhide
Configuration
- My Config “/etc/rkhunter.conf”:
- For using with (e.g. a Xen based) host without Modules you have to add “os_specific” to the DISABLE_TESTS Variable.
Using
- First you have to create checksums so rkhunter checks for changes in files. This you have to do after every change to the files which are checked.
rkhunter --propupd
- Then you could run first check this will take some time.
sudo /usr/bin/rkhunter -c --pkgmgr dpkg
- The cron is autocreated in ubuntu and send info to the user root.
- It is placed in “cron.daily”.
Last
- To list all available tests
rkhunter --list tests
linux/rkhunter.txt · Last modified: 23.03.2013 17:42 by eanderalx