Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lxd: Introduce identity mapped privileged containers #8759

Open
brauner opened this issue May 8, 2021 · 2 comments
Open

lxd: Introduce identity mapped privileged containers #8759

brauner opened this issue May 8, 2021 · 2 comments
Labels
Feature New feature, not a bug
Milestone

Comments

@brauner
Copy link
Contributor

brauner commented May 8, 2021

Some time ago I proposed the concept of a "semi-privileged" or "capability-isolated" container something I've mentioned on the kernel list as a potential use-case for identity mappings and why v3 fscaps that are valid in an ancestor userns need to be supported. I pitched this idea to Lennart who duly implemented this as part of his adoption of my idmapped mount kernel work (cf. systemd/systemd@33eac55 .

The advantage of this is that you get a privileged container wrt to {fs,e,s}{uid,gid} while being capability isolated from the host. This is a rather useful concept as it provides users with purely id-based privileges while isolating capability-based privileges (Which are nowadays more hurtful.). I would propose we adopt this in LXD making use of a new config option.

If this sounds like something that is useful to support we need to settle on the semantics. There are a few ways to go:

  • security.privileged gets converted from a boolean to a string and takes an additional value e.g. "capability-isolated" or something nicer.
    "false" and "true" would obviously still be recognized as usual. This should work and we could probably simply advance our "security.privileged" based codepaths to also handle "capability-isolated", i.e. treat "capability-isolated" like an unprivileged container.
    To create such a capability-isolated container we would still require that the project or the daemon is not run in unprivileged-only mode.
  • Introduce a new subkey security.privileged.idmap (or a better name). If we do that we need kinda imply that it can be used as an extension to security.privileged which is not completely true.
  • Introduce a new subkey security.capability_isolated (or a better name). This key we could either combine or not combine with security.privileged.
  • Can the concept and don't use it (/me frowns :)).
@stgraber
Copy link
Contributor

stgraber commented May 8, 2021

Ok, so just to get this right, it's:

  • Using a user namespace but with the full host uid/gid map written as subuid/subgid
  • This causes normal userns resource ownership to still work with all capabilities tied to the userns
  • Filesystem just works because there's no shift needed

And all we'd really need to do here is set lxd.idmap to the full user/group range?

If so, I think that's fine and can be useful to some as a slightly safer privileged container. security.privileged taking an extra value is fine with me.

@stgraber stgraber added the Feature New feature, not a bug label May 8, 2021
@stgraber stgraber added this to the soon milestone May 8, 2021
@brauner
Copy link
Contributor Author

brauner commented May 9, 2021

Ok, so just to get this right, it's:

  • Using a user namespace but with the full host uid/gid map written as subuid/subgid
  • This causes normal userns resource ownership to still work with all capabilities tied to the userns
  • Filesystem just works because there's no shift needed

And all we'd really need to do here is set lxd.idmap to the full user/group range?

Yep!

If so, I think that's fine and can be useful to some as a slightly safer privileged container. security.privileged taking an extra value is fine with me.

Cool!

@tomponline tomponline modified the milestones: soon, later Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature, not a bug
Projects
None yet
Development

No branches or pull requests

3 participants