Skip to content

docs: recommend per-binary AppArmor profile for rootlesskit on Ubuntu 24.04 - #7142

Open
shashankvarma499 wants to merge 1 commit into
moby:masterfrom
shashankvarma499:docs-rootless-apparmor-profile
Open

shashankvarma499 wants to merge 1 commit into
moby:masterfrom
shashankvarma499:docs-rootless-apparmor-profile

Conversation

@shashankvarma499

Copy link
Copy Markdown

What

docs/rootless.md currently recommends disabling the AppArmor unprivileged
user-namespace restriction system-wide (kernel.apparmor_restrict_unprivileged_userns=0)
in two places: the "Ubuntu, 24.04 or later" distribution hint and the
fork/exec /proc/self/exe: permission denied troubleshooting entry.

That sysctl turns the restriction off for every unprivileged binary on the
host, which is exactly the attack surface Ubuntu 24.04 introduced the
restriction to close.

Why

buildkitd is launched via rootlesskit, and it is rootlesskit (not
buildkitd itself) that actually creates the user namespace. A per-binary
AppArmor profile can grant userns to rootlesskit alone, leaving the
restriction in place for everything else. This mirrors what
rootlesskit's own CI
does.

Changes

  • Document a per-binary AppArmor profile as the preferred approach (including
    the note that the profile path and file name must match where rootlesskit
    is actually installed).
  • Keep the system-wide sysctl as an explicit, clearly-noted fallback.

Fixes #7073

Document a per-binary AppArmor profile for rootlesskit as the preferred fix for the Ubuntu 24.04 unprivileged-userns restriction, instead of the system-wide kernel.apparmor_restrict_unprivileged_userns=0 sysctl, which re-opens the attack surface the restriction was introduced to close. Keep the sysctl as a documented fallback.

Fixes moby#7073

Signed-off-by: Shashank Varma <324153016+shashankvarma499@users.noreply.github.com>
Comment thread docs/rootless.md
$ sudo systemctl restart apparmor.service
```

This is the approach [rootlesskit's own CI](https://github.com/rootless-containers/rootlesskit/blob/master/.github/workflows/main.yaml)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem worth mentioning.
(Was this written by an AI?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: rootless.md should recommend a per-binary AppArmor profile over `apparmor_restrict_unprivileged_userns=0

2 participants