torsdag 16 april 2009

Sök efter rootkit

Jag installerade programmet rkhunter direkt från synaptic sen är det bara att köra kommandot:
sudo rkhunter --check

--check -> Gör en hälsoundersökning på datorn :D
--update -> uppdaterar det den ska söka efter, bra att kör nån gång nu och då.
--propupd -> om man precis har kört en uppdatering på systemet så kan man få varningar som inte är berättigade utan de har blivit av den helt legitima uppdateringen, då är det bra att köra kommandot rkhunter --propupd.

citat från man page:
--propupd
"One of the checks rkhunter performs is to compare various current file properties of various commands, against those it has previously stored. This command option causes rkhunter to update its data file of stored values with the current values.

WARNING: It is the users responsibility to ensure that the files on the system are genuine and from a reliable source. rkhunter can only report if a file has changed, but not on what has caused the change. Hence, if a file has changed, and the --propupd command option is used, then rkhunter will assume that the file is genuine."


Konfigurera rkhunter


Man kan också konfa rkhunter lite för att den inte ska ge falska varningar.
Jag fick tex. en varning för filen /dev/shm/pulse-shm-779738014 som är helt ofarlig.

Här kommer en förklaring som jag hittade på engelska som jag tycker var tydlig:

"What is /dev/shm and its practical usage

/dev/shm is nothing but implementation of traditional shared memory concept. It is an efficient means of passing data between programs. One program will create a memory portion, which other processes (if permitted) can access. This will result into speeding up things on Linux.

shm / shmfs is also known as tmpfs, which is a common name for a temporary file storage facility on many Unix-like operating systems. It is intended to appear as a mounted file system, but one which uses virtual memory instead of a persistent storage device.

If you type mount command you will see /dev/shm as a tempfs file system. Therefore, it is a file system, which keeps all files in virtual memory. Everything in tmpfs is temporary in the sense that no files will be created on your hard drive. If you unmount a tmpfs instance, everything stored therein is lost. By default almost all Linux distros configured to use /dev/shm.

Nevertheless, where can I use /dev/shm?

You can use /dev/shm to improve the performance of application software or overall Linux system performance. On heavily loaded system, it can make tons of difference. For example VMware workstation/server can be optimized to improve your Linux host's performance (i.e. improve the performance of your virtual machines)."

källa: http://ubuntuforums.org/showthread.php?p=4908163

konfig filen ligger i /etc/rkhunter.conf och det var den här delen jag ändrade:

# Allow the specified files to be present in the /dev directory,
# and not regarded as suspicious. One file per line (use multiple
# ALLOWDEVFILE lines).
#
#ALLOWDEVFILE=/dev/abc
ALLOWDEVFILE=/dev/shm/pulse-shm-*

det enda som behövde göras var att ta bort brädgården. :)

Man kan också ställa in rkhunter att hittaigen dålda processer men då måste man först installera unhide, finns också i synaptik. Sedan lägger man bara till en brädgård i rkhunter.conf det ska alltså se ut såhär:

# hidden_procs test requires the unhide command which is part of the unhide
# package in Debian.
ENABLE_TESTS="all"
# DISABLE_TESTS="suspscan hidden_procs deleted_files packet_cap_apps"
DISABLE_TESTS="suspscan deleted_files packet_cap_apps"


När man har gjort dessa ändringar så söker altså kommandot sudo rkhunter -c förutom som vanligt även efter dålda processer och den ignorerar filen /dev/shm/pulse-shm-*

Man kan även installera paketet chkrootkit via synaptik och köra den som en extra grej :) Man kör bara helt enkelt kommandot sudo chkrootkit.

1 kommentar:

zaful coupon code sa...

Discounts average $8 off with a Zaful promo code or coupon. 50 Zaful coupons now on RetailMeNot.