[PATCH] Use real root with 0701 perms
authorBrian Goff <cpuguy83@gmail.com>
Tue, 6 Oct 2020 19:43:24 +0000 (19:43 +0000)
committerFelix Geyer <fgeyer@debian.org>
Sun, 21 Feb 2021 17:18:35 +0000 (17:18 +0000)
commit44d54d7d6067ec64b6e14b3b631e8a4e7b8a4e35
tree394cfe50f4ce51a093bb26ec9756264bd758ae82
parent9b1938a59a146ddd8f7a3a0f541a0955229c1b02
[PATCH] Use real root with 0701 perms

Various dirs in /var/lib/docker contain data that needs to be mounted
into a container. For this reason, these dirs are set to be owned by the
remapped root user, otherwise there can be permissions issues.
However, this uneccessarily exposes these dirs to an unprivileged user
on the host.

Instead, set the ownership of these dirs to the real root (or rather the
UID/GID of dockerd) with 0701 permissions, which allows the remapped
root to enter the directories but not read/write to them.
The remapped root needs to enter these dirs so the container's rootfs
can be configured... e.g. to mount /etc/resolve.conf.

This prevents an unprivileged user from having read/write access to
these dirs on the host.
The flip side of this is now any user can enter these directories.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit e908cc39018c015084ffbffbc5703ccba5c2fbb7)

Cherry-pick conflict with eb14d936bfc296f0a85bf4dc9e9bb1f4b4a01282:
Kept old `container` variable name.
Signed-off-by: Tibor Vass <tibor@docker.com>
Gbp-Pq: Name cve-2021-21284-3.patch
engine/daemon/container_operations_unix.go
engine/daemon/create.go
engine/daemon/daemon.go
engine/daemon/daemon_unix.go
engine/daemon/graphdriver/aufs/aufs.go
engine/daemon/graphdriver/btrfs/btrfs.go
engine/daemon/graphdriver/overlay/overlay.go
engine/daemon/graphdriver/overlay2/overlay.go
engine/daemon/graphdriver/vfs/driver.go
engine/daemon/graphdriver/zfs/zfs.go
engine/volume/local/local.go