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 3 ■ MONITORING AND UPDATING■ Note Setting dont_blame_nrpe to 1 is a security hole. The arguments passed to NRPE aren’t thoroughlychecked/sanitized, so it is possible for an attacker to run arbitrary evil commands via the check_nrpe command.It’s up to you how you assess risk in your own setup and with the specific command that you’re using. You shouldcertainly at least understand what the command you’re passing in to check_nrpe will do with the options youprovide. In the previous example, check_nrpe!check_disk will just run the check_disk command without anyarguments on the monitored machine, with whatever disk is hard-coded in that command to be checked.check_nrpe!check_disk!/ will pass the third argument (here /) to check_disk, and check_disk will operate onthat argument. If your check_disk command involved, say, an echo line, and the argument was, instead of a diskmount point, some malicious code, then the malicious code could be echoed and thus run.Restart Nagios, and you should be able to start seeing information from your monitored machine.■ Note Instead of editing /etc/nagios/nrpe.cfg on the monitored machine, you can instead edit/etc/nagios/nrpe-local.cfg. NRPE will check both files (/etc/nagios/nrpe.cfg and /etc/nagios/nrpe-local.cfg), but if there is a conflict, /etc/nagios/nrpe-local.cfg will win. This has the advantageof keeping your local changes separate from the package files, so if the package is updated, there’s no risk ofyour changes being overwritten. Similarly, you can keep files in /etc/nagios/nrpe.d/.Possible commands are at /usr/lib/nagios/plugins on the client—or you can create your own in/etc/nagios/nrpe-local.cfg. Try these commands, added to /etc/nagios/nrpe-local.cfg:command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p $ARG1$command[check_smtp]=/usr/lib/nagios/plugins/check_smtp -w 1 -c 2The first one means that I can check whichever local disk I want, rather than being restricted to / aswith the default check_disk command; the second checks that SMTP is OK. Use them by adding thissection to conf.d/services-nagios2.cfg:define service {usehostgroup_nameservice_descriptioncheck_command}generic-servicedisk-localDISK-LOCAL2check_nrpe!check_disk!/local75Download at WoweBook.Com

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

Saved successfully!

Ooh no, something went wrong!