I started a doc concerning advanced nrpe tips a while back - this one is definitely getting added before it hits the nagios library.
BanditBBS wrote: The other security on this is, a 'hacker' would have to know the command definition name to even execute it, si I could call it check_jhsgjhfgfghasdfhgadf. Good luck guessing that

Thats if you can get past the allowed_from directive also.
Even if they knew the command, compromised your network, and mitm'ed the connection, they would still have the ssl issue to get around. You do use ssl right?
One other security hole I thought about - could you pass relative paths through it? For example:
Code: Select all
command[check_whatever]=/usr/opt/nagios/libexec/$ARG1$ $ARG2$ $ARG3$
$ARG1$ = "../../../../bin/bash"
$ARG2$ = "<nasty shell code here>"
I would assume you could pass relative paths like the command above. The best way to implement this, may be to pass the command to a wrapper script that can attempt to do some sanity checking/scrubbing of the input before passing it to the shell. But then again, that would be pita, and would nearly reproduce what nrpe already does. If you trust your network, it is probably not a big deal, though it would be an abdication of my responsibility to at least not mention it.