diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2023-02-16 17:14:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-16 17:14:56 +0200 |
commit | 91b3c4296fb2ec1f0546624cd327e8cc61e58034 (patch) | |
tree | 24f9ac6c38ba5dc298c7cc0d81a063dcf51daa47 | |
parent | 5c7bd2c6488cd19fa4a0eb435221223ea5e7de81 (diff) |
fix setting go.d.plugin capabilities (#14525)
-rwxr-xr-x | netdata-installer.sh | 9 | ||||
-rw-r--r-- | packaging/docker/Dockerfile | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh index 384af100a4..8a83025b8f 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -1434,9 +1434,6 @@ install_go() { run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin" fi run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin" - if command -v setcap 1>/dev/null 2>&1; then - run setcap "cap_net_admin+epi cap_net_raw=eip" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin" - fi rm -rf "${tmp}" [ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::" @@ -1444,6 +1441,12 @@ install_go() { install_go +if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin" ]; then + if command -v setcap 1>/dev/null 2>&1; then + run setcap "cap_net_admin+epi cap_net_raw=eip" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin" + fi +fi + should_install_ebpf() { if [ "${NETDATA_DISABLE_EBPF:=0}" -eq 1 ]; then run_failed "eBPF has been explicitly disabled, it will not be available in this install." diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index ce5a0b9326..3d27c2ba0b 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -106,6 +106,9 @@ RUN chown -R root:root \ if [ -f /usr/libexec/netdata/plugins.d/freeipmi.plugin ]; then \ chmod 4755 /usr/libexec/netdata/plugins.d/freeipmi.plugin; \ fi && \ + if [ -f /usr/libexec/netdata/plugins.d/go.d.plugin ] && command -v setcap 1>/dev/null 2>&1; then \ + setcap "cap_net_raw=eip" /usr/libexec/netdata/plugins.d/go.d.plugin 2>/dev/null; \ + fi && \ # Group write permissions due to: https://github.com/netdata/netdata/pull/6543 find /var/lib/netdata /var/cache/netdata -type d -exec chmod 0770 {} \; && \ find /var/lib/netdata /var/cache/netdata -type f -exec chmod 0660 {} \; && \ |