X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fexec.c;h=c51465b810064162517a4e3f53bae9107a7a5b19;hp=e90f83c94ad4aa46169f6c827ee741ca9c5d9575;hb=e5e5d99350fa54e22f07b90fbc3102df51565ad9;hpb=6e8d9b2fa6018a1ed1ec8ab3b6551110449a997c diff --git a/src/exec.c b/src/exec.c index e90f83c9..c51465b8 100644 --- a/src/exec.c +++ b/src/exec.c @@ -39,6 +39,10 @@ #include #include +#ifdef HAVE_SYS_CAPABILITY_H +# include +#endif + #define PL_NORMAL 0x01 #define PL_NOTIF_ACTION 0x02 @@ -806,6 +810,22 @@ static int exec_init (void) /* {{{ */ sigaction (SIGCHLD, &sa, NULL); +#ifdef HAVE_SYS_CAPABILITY_H + if ((check_capability (CAP_SETUID) != 0) || + (check_capability (CAP_SETGID) != 0)) + { + if (getuid () == 0) + WARNING ("exec plugin: Running collectd as root, but the CAP_SETUID " + "or CAP_SETGID capabilities are missing. The plugin's read function " + "will probably fail. Is your init system dropping capabilities ?"); + else + WARNING ("exec plugin: collectd doesn't have the CAP_SETUID or " + "CAP_SETGID capabilities. If you don't want to run collectd as root, " + "try running \"setcap 'cap_setuid=ep cap_setgid=ep'\" on the " + "collectd binary."); + } +#endif + return (0); } /* int exec_init }}} */