Customer was running heartbeat -environment container --strict.perms=false --path.config /mnt/secrets in Azure Container Instances (ACI) service for months without issues, but recently it stopped working due to:
2022-09-15T12:34:25.257Z INFO instance/beat.go:686 Home path: [/usr/share/heartbeat] Config path: [/mnt/secrets] Data path: [/usr/share/heartbeat/data] Logs path: [/usr/share/heartbeat/logs] Hostfs Path: [/]
2022-09-15T12:34:25.257Z ERROR instance/beat.go:1015 Exiting: Failed to create Beat meta file: open /usr/share/heartbeat/data/meta.json.new: permission denied
Exiting: Failed to create Beat meta file: open /usr/share/heartbeat/data/meta.json.new: permission denied
Customer has not introduced any changes on their side.
We have reproduced the scenario and noticed heartbeat user does not have root group membership like in our original image:
Azure container service:
bash-4.2$ id -a
uid=1000(heartbeat) gid=1000(heartbeat) groups=1000(heartbeat)
Docker engine:
bash-4.2$ id -a
uid=1000(heartbeat) gid=1000(heartbeat) groups=1000(heartbeat),0(root) <--- HERE
That's despite heartbeat being member of this group as per /etc/group file (checked in a container running in Azure):
Lack of root group membership explains permission denied error, as /usr/share/heartbeat/data folder has the following permissions:
bash-4.2$ cd /usr/share/heartbeat/
bash-4.2$ ls -al
total 103364
drwxr-xr-x 1 root root 4096 May 19 2021 .
drwxr-xr-x 1 root root 4096 May 19 2021 ..
-rw-r--r-- 1 root root 41 May 19 2021 .build_hash.txt
drwxrwx--- 1 root root 4096 May 19 2021 .cache
drwxrwx--- 1 root root 4096 May 19 2021 .config
drwxrwx--- 1 heartbeat root 4096 May 19 2021 .node
drwxrwx--- 1 root root 4096 May 19 2021 .npm
-rw-r--r-- 1 root root 13675 May 19 2021 LICENSE.txt
-rw-r--r-- 1 root root 8576604 May 19 2021 NOTICE.txt
-rw-r--r-- 1 root root 848 May 19 2021 README.md
drwxrwxr-x 1 root root 4096 Sep 30 07:49 data <--- HERE
-rw-r--r-- 1 root root 249789 May 19 2021 fields.yml
-rwxr-xr-x 1 root root 96862864 May 19 2021 heartbeat
-rw-r--r-- 1 root root 69375 May 19 2021 heartbeat.reference.yml
-rw-r--r-- 1 root root 833 May 19 2021 heartbeat.yml
drwxr-xr-x 2 root root 4096 May 19 2021 kibana
drwxrwxr-x 2 root root 4096 May 19 2021 logs
drwxr-xr-x 2 root root 4096 May 19 2021 monitors.d
drwxrwx--- 2 root root 4096 May 19 2021 suites
bash-4.2$
We rely on our non-root user belonging to root group to access required directories and it seems ACI is now enforcing a primary group for the default user, stripping root. Has this changed on the container runtime recently?
For confirmed bugs, please report:
Customer was running heartbeat -environment container --strict.perms=false --path.config /mnt/secrets in Azure Container Instances (ACI) service for months without issues, but recently it stopped working due to:
The Azure CLI command customer was using:
Customer has not introduced any changes on their side.
We have reproduced the scenario and noticed heartbeat user does not have root group membership like in our original image:
That's despite heartbeat being member of this group as per /etc/group file (checked in a container running in Azure):
Lack of root group membership explains permission denied error, as /usr/share/heartbeat/data folder has the following permissions:
We rely on our non-root user belonging to root group to access required directories and it seems ACI is now enforcing a primary group for the default user, stripping root. Has this changed on the container runtime recently?