Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the workflow on how we set the right permissions for perf-plugin #16558

Merged
merged 8 commits into from Dec 11, 2023
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 6 additions & 9 deletions contrib/debian/netdata-plugin-perf.postinst
Expand Up @@ -7,16 +7,13 @@ case "$1" in
chown root:netdata /usr/libexec/netdata/plugins.d/perf.plugin
chmod 0750 /usr/libexec/netdata/plugins.d/perf.plugin

if capsh --supports=cap_perfmon 2>/dev/null; then
setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin
ret="$?"
if setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin; then
tkatsoulas marked this conversation as resolved.
Show resolved Hide resolved
echo "Set cap_perfmon capabilties for perf.plugin"
else
setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin
ret="$?"
fi

if [ "${ret}" -ne 0 ]; then
chmod -f 4750 /usr/libexec/netdata/plugins.d/perf.plugin
if ! setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin; then
echo "Failed to set capabilties for perf.plugin, setting setuid"
chmod -f 4750 /usr/libexec/netdata/plugins.d/perf.plugin
fi
fi
;;
esac
Expand Down