Chkrootkit-Portsentry-Howto
|
Chkrootkit-Portsentry-Howto Version 1.0 This document describes how to install chkrootkit and portsentry. It should work (maybe with slight changes concerning paths etc.) on all *nix operating systems. Chkrootkit "is a tool to locally check for signs of a rootkit" (from http://www.chkrootkit.org). "The Sentry
tools provide host-level security services for the Unix platform. PortSentry,
Logcheck/LogSentry, and HostSentry protect against portscans, automate log file
auditing, and detect suspicious login activity on a continuous basis" (from
http://sourceforge.net/projects/sentrytools/). This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web. This document comes without warranty of any kind!
1 Get the Sources We need the following software: chkrootkit, portsentry and logcheck. We will install the software from the /tmp directory. cd /tmp
2 Install Chkrootkit mv chkrootkit.tar.gz /usr/local/ You will now find the chkrootkit program under /usr/local/chkrootkit. Run it by typing cd /usr/local/chkrootkit/ && ./chkrootkit Your output will look something like this:
If a worm, rootkit, etc. is found this is indicated by the string INFECTED (in capital letters). If you want to get the output of chkrootkit once a day per email at 3 am you can put the following line in root's cron file (the location depends on your distribution; under Debian it is under /var/spool/cron/crontabs/root; you might also find it under /var/spool/cron/tabs/root or something similar): 0 3 * * * (cd /usr/local/chkrootkit; ./chkrootkit 2>&1 | mail -s "chkrootkit output" me@myself.tld) Then run chmod 600 /var/spool/cron/crontabs/root
3 Install Portsentry cd /tmp Portsentry will be installed to /usr/local/psionic/portsentry/. Edit /usr/local/psionic/portsentry/portsentry.conf and specify the ports you want portsentry to protect:
It should be ports that are not in use on the system. E.g., if you use IMAP (port 143 TCP) on the server you should remove 143 from the list above. The rest of portsentry.conf is well commented, but normally the default values should work. Now we need to create an init script for portsentry (/etc/init.d/portsentry). We will run portsentry in advanced stealth mode as it is the most powerful way to detect portscans:
chmod 755 /etc/init.d/portsentry In order to start portsentry at boot time do the following: ln -s /etc/init.d/portsentry
/etc/rc2.d/S20portsentry Now we start portsentry: /etc/init.d/portsentry start Please note: If you run portsentry chkrootkit might complain about an infected bindshell: Checking `bindshell'...
INFECTED (PORTS: 31337) This is normal and nothing to worry about.
4 Install Logcheck cd /tmp Now change the variable SYSADMIN in logcheck.sh. SYSADMIN is the person that will receive logcheck's output per email (this can be an email address or a user on the system where you install logcheck on):
This will install logcheck under /usr/local/etc. Now we have to create a cron job in order to run logcheck periodically. Edit root's cron file (e.g. /var/spool/cron/crontabs/root, see section 2 "Install Chkrootkit") and enter the following line: 0 3 * * * /usr/local/etc/logcheck.sh Then run chmod 600 /var/spool/cron/crontabs/root
This will invoke
logcheck once a day at
3 am. It will now inform you about unusual system events, security violations,
system attacks, etc. If your system is exposed directly to the internet you
will notice that there are lots of malicious activities in the internet, and
you will get a feeling why security is very important.
Links Chkrootkit: http://www.chkrootkit.org/ Portsentry: http://sourceforge.net/projects/sentrytools/
Original location of this document: http://www.falkotimme.com/howtos/chkrootkit_portsentry/
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com







Recent comments
14 hours 6 min ago
15 hours 34 min ago
19 hours 9 min ago
22 hours 2 min ago
1 day 1 hour ago
1 day 1 hour ago
1 day 1 hour ago
1 day 2 hours ago
1 day 4 hours ago
1 day 4 hours ago