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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 6 ■ SECURING YOUR SYSTEMSparticularly heavy email day), you won’t get another one. Another option is to integrate it into Nagios(see Chapter 3 for a discussion of Nagios).6-15. Using cron-apt to Keep UpdatedIf you’re using Debian or Ubuntu, cron-apt is a really useful tool that checks for package updates andwill e-mail you to let you know about them. Install the package with sudo apt-get install cron-apt, andthen edit your /etc/crontab to include this line:0 4 * * * root test -x /usr/sbin/cron-apt && /usr/sbin/cron-aptThis will run cron-apt every night at 4 a.m.To configure it, edit the file /etc/cron-apt/config. Most of this you should be able to leave as is.These are important lines to check and change:MAILTO="admin@example.com"MAILON="upgrade"Possible MAILON values are always, upgrade (when a package is upgraded), error (when there’s anerror in the run), changes (when the output changes as the result of an action), and output (wheneveroutput is generated). If it’s left empty, mail will never be sent. upgrade is probably the most useful valueand avoids clogging up your inbox.By default, cron-apt will download only the upgraded packages (you then have to install them whenyou get the email notifying you about them). The actions are controlled by the files in /etc/cronapt/action.d.The files in this directory will be used as options to apt-get when cron-apt runs. Two areprovided by default. The first is 0-update, which runs the following:apt-get update -o quiet=2-o will set an option string (there isn’t one given here). The second is 3-download, which runs thefollowing:apt-get upgrade -d -y -o APT::Get::Show-Upgraded=true-d sets this to just download (not install), and -y assumes “yes” to any questions asked. Note that ifsomething really undesirable, such as removing an essential file, is set to happen, apt-get will abort evenif -y is set. -o APT::Get::Show-Upgraded=true sets the APT::Get::Show-Upgraded option, thus giving aprinted-out list of all packages to be upgraded, which is what shows up in your e-mail.154Download at WoweBook.Com

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

Saved successfully!

Ooh no, something went wrong!