13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 6 ■ SECURING YOUR SYSTEMS■ Note It does have a tendency to generate false positives, such as dot files installed in unusual places or serversrunning on nonstandard ports. Line 03 in the following setup means that false positives will occur only once,however, rather than repeatedly showing up.What you want, though, is to have this run automatically on a daily basis. If you’ve installed theDebian/Ubuntu package, this includes the file /etc/cron.daily/chkrootkit that will do this for you,which looks like this:#!/bin/sh -eCHKROOTKIT=/usr/sbin/chkrootkitCF=/etc/chkrootkit.confLOG_DIR=/var/cache/chkrootkitif [ ! -x $CHKROOTKIT ]; thenexit 0fiif [ -f $CF ]; then. $CFfiif [ "$RUN_DAILY" = "true" ]; thenif [ "$DIFF_MODE" = "true" ]; then$CHKROOTKIT $RUN_DAILY_OPTS > $LOG_DIR/log.new 2>&1if [ ! -f $LOG_DIR/log.old ] \|| ! diff -q $LOG_DIR/log.old $LOG_DIR/log.new > /dev/null 2>&1; thencat $LOG_DIR/log.newfimv $LOG_DIR/log.new $LOG_DIR/log.oldelse$CHKROOTKIT $RUN_DAILY_OPTSfifiTo set chkrootkit options, you can set environment variables in /etc/chkrootkit.conf. This is agood default setup:01 RUN_DAILY="true"02 RUN_DAILY_OPTS="-q -n"03 DIFF_MODE="true"Line 01 sets daily running (unsurprisingly!). -q runs quietly, and -n skips NFS-mounted directories.Line 03 means that output will be generated only if it differs from the previous day’s output. In otherwords, you will be warned only once! This means that if you have regular false positives, you won’talways receive an e-mail; however, it also means that if you miss the first warning (maybe in a153Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!