user units: implicitly enable PrivateUsers= when sandboxing options are set
authorLuca Boccassi <bluca@debian.org>
Tue, 1 Nov 2022 23:34:15 +0000 (23:34 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 13 Apr 2023 20:33:48 +0000 (21:33 +0100)
commit6ef721cbc7dadee4ae878ecf0076d87e57233908
treed8593fb6923cba2c6bcc51027d8d5d7238557311
parentce963a747fa53d4bd9d7e51d2230bf48fafd0d59
user units: implicitly enable PrivateUsers= when sandboxing options are set

Enabling these options when not running as root requires a user
namespace, so implicitly enable PrivateUsers=.
This has a side effect as it changes which users are visible to the unit.
However until now these options did not work at all for user units, and
in practice just a handful of user units in Fedora, Debian and Ubuntu
mistakenly used them (and they have been all fixed since).

This fixes the long-standing confusing issue that the user and system
units take the same options but the behaviour is wildly (and sometimes
silently) different depending on which is which, with user units
requiring manually specifiying PrivateUsers= in order for sandboxing
options to actually work and not be silently ignored.
man/system-or-user-ns.xml
src/core/execute.c
src/test/test-execute.c
test/units/testsuite-43.sh