check_dhcp permissions issue even when run as root
Maxwell Carey
mcarey at ucar.edu
Thu Jun 6 19:03:52 CEST 2013
On 06/05/2013 10:01 AM, Maxwell Carey wrote:
> When I run check_dhcp as the nagios user, I get the following error:
>
> $ /usr/local/nagios/libexec/check_dhcp
> Error: Could not bind socket to interface eth0. Check your privileges...
>
> Even when I run the plugin as the root user, I get the same error, so I
> suspect this is not really a file permissions issue.
As I suspected, this had nothing to do with file permissions. I was
misled by the second part of the error message, when I should have paid
closer attention to the "Could not bind socket to interface eth0" part.
Our Nagios host doesn't have an interface named eth0. Doh! When I add
the -i <interface> flag, I can run the plugin successfully from the
command line as root and as nagios.
But as it turns out, I diagnosed the initial issue incorrectly. Nagios
was actually running check_dhcp with the correct interface name, but
still spitting out an error about permissions. The cause? I recently
upgraded Nagios by installing the new version in a new directory and
copying over the config files from the old version (I did not do an
in-place upgrade). When I turned on debugging I could see that all of
the plugins being used were from the old install, where apparently SUID
was not set correctly on check_dhcp. When I copied over the config
files, I didn't update resource.cfg, which contains the definition of
$USER1$ and was still pointing to the old directory. Problem solved (and
some good lessons learned to boot).
--Max Carey
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list