chiark / gitweb /
bus: when connecting to a container's kdbus instance, enter namespace first
authorLennart Poettering <lennart@poettering.net>
Fri, 13 Dec 2013 21:02:47 +0000 (22:02 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 14 Dec 2013 04:10:25 +0000 (05:10 +0100)
commitbc9fd78c7bfc39881e19457e476393635f8b0442
tree3c4dc6461460a2b4094516eb35424d36f52f455a
parent3fa5dd6de798e17d93531bc900b8e2dc587c38f3
bus: when connecting to a container's kdbus instance, enter namespace first

Previously we'd open the connection in the originating namespace, which
meant most peers of the bus would not be able to make sense of the
PID/UID/... identity of us since we didn't exist in the namespace they
run in. However they require this identity for privilege decisions,
hence disallowing access to anything from the host.

Instead, when connecting to a container, create a temporary subprocess,
make it join the container's namespace and then connect from there to
the kdbus instance. This is similar to how we do it for socket
conections already.

THis also unifies the namespacing code used by machinectl and the bus
APIs.
src/core/load-fragment.c
src/libsystemd-bus/bus-container.c
src/libsystemd-bus/bus-container.h
src/libsystemd-bus/sd-bus.c
src/machine/machinectl.c
src/shared/util.c
src/shared/util.h