docs: describe SELinux relabeling without version-specific details

Keep the mechanism and the recommendations, but drop the promises of
exact runtime messages, log levels and probe results, which vary by
container runtime version. Give the ausearch and sesearch checks
instead. The downsides page now says to omit :z and :Z on mergerfs
bind mounts.
This commit is contained in:
Antonio SJ Musumeci 2026-11-29 23:10:54 -05:00
parent 4540af2a75
commit 5139801064
2 changed files with 20 additions and 30 deletions

View file

@ -155,16 +155,14 @@ FUSE filesystems, including mergerfs, do not support per-inode
SELinux labels (see [Red Hat bug
1272868](https://bugzilla.redhat.com/show_bug.cgi?id=1272868) and the
[upstream fuse-devel
thread](https://sourceforge.net/p/fuse/mailman/fuse-devel/thread/CAN9vWDLGA4%3Dg3peKVWkX7gLRiVUUvJAQx9kiXHgqdeX6eh0MYA%40mail.gmail.com/)).
When a container runtime such as Podman or Docker is asked to relabel
a bind mount with the `:z` or `:Z` mount option, it first probes the
source for `security.selinux` xattr support. On a FUSE path that
probe returns `EOPNOTSUPP` and the runtime skips relabeling entirely.
Files inside the mount keep the `fusefs_t` type assigned by the
kernel. No tree walk is performed and no journal noise is produced at
default verbosity. The runtime logs `Labeling not supported on
"<path>"` only at debug level (for example
`podman --log-level=debug`). The flag is therefore a no-op against a
thread](https://sourceforge.net/p/fuse/mailman/fuse-devel/thread/CAN9vWDLGA4%3Dg3peKVWkX7gLRiVUUvJAQx9kiXHgqdeX6eh0MYA%40mail.gmail.com/)),
so `:z` / `:Z` relabeling cannot apply to them. When a container
runtime such as Podman or Docker is asked to relabel a bind mount
with the `:z` or `:Z` mount option, it detects that the mount does
not support labeling and skips relabeling. Files inside the mount
keep the `fusefs_t` type assigned by the kernel. At debug verbosity
the runtime reports that labeling is not supported, with the exact
wording varying by version. The flag is therefore a no-op against a
mergerfs mount; not harmful, but misleading.
Containers can still read and write a mergerfs pool without `:z`
@ -173,8 +171,10 @@ satisfied without any relabel:
* **SELinux:** on Fedora, RHEL / CentOS Stream, and SUSE the shipped
[container-selinux](https://github.com/containers/container-selinux)
policy already permits the `container_t` process type to manage
files of type `fusefs_t`. See `container_selinux(8)`.
policy permits the `container_t` process type to manage files of
type `fusefs_t` on current releases of those distributions. Check
yours with `sesearch -A -s container_t -t fusefs_t -c file`. See
`container_selinux(8)`.
* **DAC:** the in-container UID and GID must still be able to read
and write the files on the underlying branches. With rootless
Podman this is most easily arranged by aligning the container UID
@ -200,17 +200,8 @@ host-side processes touching the mount (rsync, backup tools, web
UIs, cron jobs) see `container_file_t` rather than `fusefs_t` and
may require a small SELinux policy adjustment.
To verify on your own system:
```
podman --log-level=debug run --rm \
-v /path/to/mergerfs:/data:z \
alpine true 2>&1 | grep -iE 'relabel|setfilecon|Labeling'
```
Expected output is a single line of the form
`Labeling not supported on "/path/to/mergerfs"` and nothing in
`ausearch -m AVC,SELINUX_ERR` for the mount.
To check for SELinux denials involving the mount, use
`ausearch -m AVC,SELINUX_ERR`.
## Can mergerfs be used with NFS root squash?

View file

@ -199,13 +199,12 @@ for example, `path-hash` stabilizes identity by path for NFS, but
prevents applications from recognizing hard links by inode equality.
The hard links themselves still work.
On SELinux systems, per-file relabeling is unavailable through the
FUSE mount, so container bind-mount options `:z` and `:Z` do not
perform their usual relabeling. This does not mean containers cannot
use the pool: an appropriate SELinux policy or a mount-wide context
can allow access. A mount-wide context is not a substitute for
distinct per-file labels if the application requires them. See [Does
mergerfs work with SELinux
Container bind-mount options `:z` and `:Z` cannot perform their usual
per-file relabeling on the pool. Omit them on mergerfs bind mounts and
allow container access with an appropriate SELinux policy or a
mount-wide context instead; a mount-wide context is not a substitute
for distinct per-file labels if the application requires them. See
[Does mergerfs work with SELinux
relabeling?](compatibility_and_integration.md#does-mergerfs-work-with-selinux-relabeling).
See [Technical Behavior and