containerd/docs
Akihiro Suda b2f254fff0
cri: make read-only mounts recursively read-only
Prior to this commit, `readOnly` volumes were not recursively read-only and
could result in compromise of data;
e.g., even if `/mnt` was mounted as read-only, its submounts such as
`/mnt/usbstorage` were not read-only.

This commit utilizes runc's "rro" bind mount option to make read-only bind
mounts literally read-only. The "rro" bind mount options is implemented by
calling `mount_setattr(2)` with `MOUNT_ATTR_RDONLY` and `AT_RECURSIVE`.

The "rro" bind mount options requires kernel >= 5.12, with runc >= 1.1 or
a compatible runtime such as crun >= 1.4.

When the "rro" bind mount options is not available, containerd falls back
to the legacy non-recursive read-only mounts by default.

The behavior is configurable via `/etc/containerd/config.toml`:
```toml
version = 2
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
  # treat_ro_mounts_as_rro ("Enabled"|"IfPossible"|"Disabled")
  # treats read-only mounts as recursive read-only mounts.
  # An empty string means "IfPossible".
  # "Enabled" requires Linux kernel v5.12 or later.
  # This configuration does not apply to non-volume mounts such as "/sys/fs/cgroup".
  treat_ro_mounts_as_rro = ""
```

Replaces:
- kubernetes/enhancements issue 3857
- kubernetes/enhancements PR 3858

Note: this change does not affect non-CRI clients such as ctr, nerdctl, and Docker/Moby.
RRO mounts have been supported since nerdctl v0.14 (containerd/nerdctl PR 511)
and Docker v25 (moby/moby PR 45278).

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-02-01 09:39:36 +09:00
..
cri cri: make read-only mounts recursively read-only 2024-02-01 09:39:36 +09:00
historical Fix broken links 2023-12-09 13:09:39 -08:00
man Clean plugin indent in containerd-config.toml.5.md 2024-01-23 07:02:07 +00:00
snapshotters Add blockfile snapshotter to snapshotters doc 2023-05-17 14:25:27 -07:00
user-namespaces Merge pull request #9117 from kinvolk/rata/userns-chown-opt-in 2023-09-28 02:34:41 +09:00
.editorconfig docs: remove website leftovers 2018-12-20 10:01:51 +01:00
client-opts.md doc: fix package import path in sample code 2024-01-26 11:41:30 +05:30
containerd-nri-integration.png docs: add NRI-related documentation. 2022-11-28 21:51:56 +02:00
content-flow.md Update documentation for containerd v2.0 packages 2023-11-16 00:40:21 +00:00
garbage-collection.md Update documentation for containerd v2.0 packages 2023-11-16 00:40:21 +00:00
getting-started.md doc: fix package import path in sample code 2024-01-26 11:41:30 +05:30
hosts.md docs: fix typo 2024-01-31 21:37:48 +08:00
image-verification.md Add image verifier transfer service plugin system based on a binary directory 2023-09-07 18:45:02 -04:00
managed-opt.md docs: migrate config v1 to v2 2022-04-05 16:41:54 +09:00
namespaces.md Update documentation for containerd v2.0 packages 2023-11-16 00:40:21 +00:00
NRI.md delete checkout branch in doc 2023-08-04 22:46:33 +03:30
ops.md Update documentation for containerd v2.0 packages 2023-11-16 00:40:21 +00:00
PLUGINS.md doc: fix package import path in sample code 2024-01-26 11:41:30 +05:30
remote-snapshotter.md doc: fix package import path in sample code 2024-01-26 11:41:30 +05:30
rootless.md Update external repo links that changed default branch to main 2023-04-21 20:26:48 +00:00
RUNC.md BUILDING.md: remove some bits about building runc 2021-08-10 09:31:02 +02:00
stream_processors.md docs: migrate config v1 to v2 2022-04-05 16:41:54 +09:00
tracing.md docs: fix a typo in tracing documentation 2023-01-04 10:27:36 +08:00
transfer.md docs: Update transfer service docs to reflect completed implementations for 1.7 2023-09-26 12:31:19 -04:00