From: Zbigniew Jędrzejewski-Szmek Date: Tue, 23 Apr 2019 08:28:38 +0000 (+0200) Subject: man: describe interaction with ProtectHome=/InaccessiblePaths= in BindMount= X-Git-Tag: v243~650 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db8d154dc4bffd736cf6526b3c04f36f8eb5a5e0;p=platform%2Fupstream%2Fsystemd.git man: describe interaction with ProtectHome=/InaccessiblePaths= in BindMount= https://github.com/systemd/systemd/issues/7153#issuecomment-485252308 Apparently this is still confusing for people. Longer-term, I think we should just make BindMount= automatically "upgrade" (or "downgrade", depending on how you look at this), any InaccessiblePath= mountpoints to "tmpfs". I don't see much point in forcing users to remember this interaction. But let's at least document the status quo, we can always update the docs if the code changes. --- diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index df1e1e8..b69691b 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -180,6 +180,13 @@ is used. In this case the source path refers to a path on the host file system, while the destination path refers to a path below the root directory of the unit. + Note that the destination directory must exist or systemd must be able to create it. Thus, it + is not possible to use those options for mount points nested underneath paths specified in + InaccessiblePaths=, or under /home/ and other protected + directories if ProtectHome=yes is + specified. TemporaryFileSystem= with :ro or + ProtectHome=tmpfs should be used instead. + @@ -822,23 +829,25 @@ CapabilityBoundingSet=~CAP_B CAP_C ProtectHome= Takes a boolean argument or the special values read-only or - tmpfs. If true, the directories /home, /root and - /run/user are made inaccessible and empty for processes invoked by this unit. If set to - read-only, the three directories are made read-only instead. If set to tmpfs, - temporary file systems are mounted on the three directories in read-only mode. The value tmpfs - is useful to hide home directories not relevant to the processes invoked by the unit, while necessary directories - are still visible by combining with BindPaths= or BindReadOnlyPaths=. + tmpfs. If true, the directories /home, + /root, and /run/user are made inaccessible and empty for + processes invoked by this unit. If set to read-only, the three directories are + made read-only instead. If set to tmpfs, temporary file systems are mounted on the + three directories in read-only mode. The value tmpfs is useful to hide home + directories not relevant to the processes invoked by the unit, while still allowing necessary + directories to be made visible when listed in BindPaths= or + BindReadOnlyPaths=. Setting this to yes is mostly equivalent to set the three directories in InaccessiblePaths=. Similarly, read-only is mostly equivalent to ReadOnlyPaths=, and tmpfs is mostly equivalent to - TemporaryFileSystem=. + TemporaryFileSystem= with :ro. - It is recommended to enable this setting for all long-running services (in particular network-facing - ones), to ensure they cannot get access to private user data, unless the services actually require access to - the user's private data. This setting is implied if DynamicUser= is set. This setting cannot - ensure protection in all cases. In general it has the same limitations as ReadOnlyPaths=, - see below. + It is recommended to enable this setting for all long-running services (in particular + network-facing ones), to ensure they cannot get access to private user data, unless the services + actually require access to the user's private data. This setting is implied if + DynamicUser= is set. This setting cannot ensure protection in all cases. In + general it has the same limitations as ReadOnlyPaths=, see below. @@ -1053,7 +1062,7 @@ StateDirectory=aaa/bbb ccc This is useful to hide files or directories not relevant to the processes invoked by the unit, while necessary files or directories can be still accessed by combining with BindPaths= or - BindReadOnlyPaths=. See the example below. + BindReadOnlyPaths=: Example: if a unit has the following, TemporaryFileSystem=/var:ro