mirror of
https://github.com/netdata/netdata.git
synced 2025-04-26 13:54:48 +00:00
fix: use setuid as a fallback for static builds when setcap fails for plugins (#19215)
fix: use setuid as a fallback if setcap fails for plugins
This commit is contained in:
parent
fe744ae2d2
commit
3d1eb72359
1 changed files with 19 additions and 9 deletions
|
@ -207,17 +207,27 @@ for x in ndsudo apps.plugin perf.plugin slabinfo.plugin debugfs.plugin freeipmi.
|
||||||
done
|
done
|
||||||
|
|
||||||
if command -v setcap >/dev/null 2>&1; then
|
if command -v setcap >/dev/null 2>&1; then
|
||||||
run setcap "cap_dac_read_search,cap_sys_ptrace=ep" "usr/libexec/netdata/plugins.d/apps.plugin"
|
if ! run setcap "cap_dac_read_search,cap_sys_ptrace=ep" "usr/libexec/netdata/plugins.d/apps.plugin"; then
|
||||||
run setcap "cap_dac_read_search=ep" "usr/libexec/netdata/plugins.d/slabinfo.plugin"
|
run chmod 4750 "usr/libexec/netdata/plugins.d/apps.plugin"
|
||||||
run setcap "cap_dac_read_search=ep" "usr/libexec/netdata/plugins.d/debugfs.plugin"
|
fi
|
||||||
|
if ! run setcap "cap_dac_read_search=ep" "usr/libexec/netdata/plugins.d/slabinfo.plugin"; then
|
||||||
|
run chmod 4750 "usr/libexec/netdata/plugins.d/slabinfo.plugin"
|
||||||
|
fi
|
||||||
|
if ! run setcap "cap_dac_read_search=ep" "usr/libexec/netdata/plugins.d/debugfs.plugin"; then
|
||||||
|
run chmod 4750 "usr/libexec/netdata/plugins.d/debugfs.plugin"
|
||||||
|
fi
|
||||||
|
if ! run setcap "cap_dac_read_search+epi cap_net_admin+epi cap_net_raw=eip" "usr/libexec/netdata/plugins.d/go.d.plugin"; then
|
||||||
|
run chmod 4750 "usr/libexec/netdata/plugins.d/go.d.plugin"
|
||||||
|
fi
|
||||||
|
|
||||||
if command -v capsh >/dev/null 2>&1 && capsh --supports=cap_perfmon 2>/dev/null ; then
|
perf_caps="cap_sys_admin=ep"
|
||||||
run setcap "cap_perfmon=ep" "usr/libexec/netdata/plugins.d/perf.plugin"
|
if command -v capsh >/dev/null 2>&1 && capsh --supports=cap_perfmon 2>/dev/null; then
|
||||||
else
|
perf_caps="cap_perfmon=ep"
|
||||||
run setcap "cap_sys_admin=ep" "usr/libexec/netdata/plugins.d/perf.plugin"
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
run setcap "cap_dac_read_search+epi cap_net_admin+epi cap_net_raw=eip" "usr/libexec/netdata/plugins.d/go.d.plugin"
|
if ! run setcap "${perf_caps}" "usr/libexec/netdata/plugins.d/perf.plugin"; then
|
||||||
|
run chmod 4750 "usr/libexec/netdata/plugins.d/perf.plugin"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
for x in apps.plugin perf.plugin slabinfo.plugin debugfs.plugin; do
|
for x in apps.plugin perf.plugin slabinfo.plugin debugfs.plugin; do
|
||||||
f="usr/libexec/netdata/plugins.d/${x}"
|
f="usr/libexec/netdata/plugins.d/${x}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue