diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2022-12-22 14:31:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-22 14:31:05 +0200 |
commit | 023b358b1d690661aee5081169ff0d123541a59d (patch) | |
tree | 591799281b6b5505af442610eb206ab28395b5fe | |
parent | 3212bd341ca4f0f5f3393eb35afe532b10639d4e (diff) |
feat(packaging): add netdata to www-data group on Proxmox (#14168)
-rw-r--r-- | contrib/debian/netdata.postinst | 5 | ||||
-rwxr-xr-x | netdata-installer.sh | 5 | ||||
-rwxr-xr-x | packaging/makeself/install-or-update.sh | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/contrib/debian/netdata.postinst b/contrib/debian/netdata.postinst index 2436e569a4..5cce2c3d19 100644 --- a/contrib/debian/netdata.postinst +++ b/contrib/debian/netdata.postinst @@ -30,6 +30,11 @@ case "$1" in usermod -a -G $item netdata fi done + # Netdata must be able to read /etc/pve/qemu-server/* and /etc/pve/lxc/* + # for reading VMs/containers names, CPU and memory limits on Proxmox. + if [ -d "/etc/pve" ] && getent group "www-data" > /dev/null 2>&1; then + usermod -a -G www-data netdata + fi if ! dpkg-statoverride --list /var/lib/netdata > /dev/null 2>&1; then dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata diff --git a/netdata-installer.sh b/netdata-installer.sh index 94745a2951..282be94888 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -1089,6 +1089,11 @@ if [ "$(id -u)" -eq 0 ]; then # shellcheck disable=SC2086 portable_add_user_to_group ${g} netdata && NETDATA_ADDED_TO_GROUPS="${NETDATA_ADDED_TO_GROUPS} ${g}" done + # Netdata must be able to read /etc/pve/qemu-server/* and /etc/pve/lxc/* + # for reading VMs/containers names, CPU and memory limits on Proxmox. + if [ -d "/etc/pve" ]; then + portable_add_user_to_group "www-data" netdata && NETDATA_ADDED_TO_GROUPS="${NETDATA_ADDED_TO_GROUPS} www-data" + fi else run_failed "The installer does not run as root. Nothing to do for user and groups" fi diff --git a/packaging/makeself/install-or-update.sh b/packaging/makeself/install-or-update.sh index 99cc189e6f..6dfa586968 100755 --- a/packaging/makeself/install-or-update.sh +++ b/packaging/makeself/install-or-update.sh @@ -121,6 +121,11 @@ if portable_add_group netdata; then run_failed "Failed to add netdata user to secondary groups" fi done + # Netdata must be able to read /etc/pve/qemu-server/* and /etc/pve/lxc/* + # for reading VMs/containers names, CPU and memory limits on Proxmox. + if [ -d "/etc/pve" ]; then + portable_add_user_to_group "www-data" netdata && NETDATA_ADDED_TO_GROUPS="${NETDATA_ADDED_TO_GROUPS} www-data" + fi NETDATA_USER="netdata" NETDATA_GROUP="netdata" else |