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

we should run img within userns with subuid/subgid (especially for apt) #49

Closed
AkihiroSuda opened this issue Feb 27, 2018 · 4 comments
Closed

Comments

@AkihiroSuda
Copy link
Collaborator

AkihiroSuda commented Feb 27, 2018

This branch allows containers to use subuid/subgid (i.e. apt update works): https://github.com/jessfraz/img/compare/master...AkihiroSuda:allow-subuidgid.20180227?expand=1

However, img itself cannot "commit" the cache due to EPERM, as img
itself does not have access to files owned by its subusers (_apt).

  solving failed: failed to commit rt3w4yqk2tkibexmj15dtavb8: open /tmp/img/runc/naive/snapshots/snapshots/5/var/lib/apt/lists/partial: permission denied

So I suggest running img itself in userns with newuidmap/newgidmap.
(probably via reexec for better UX)

If we can run img itself in userns, we can also:

  • remove "mountless" code, which is not highly likely to be merged to upstream containerd/buildkit, and allow using Ubuntu-patched overlayfs again.
  • create netns (with SUID lxc-user-net or slirp) for better isolation, especially for
    prohibiting containers from accessing "abstract" sockets on the host.
@jessfraz
Copy link
Collaborator

jessfraz commented Feb 27, 2018

Yeah totally, sorry I just did the mountless temporarily so people didn’t have to unshare and do the whole song and dance to try it :)

I Will do a patch to do an unshare in the constructor or reexec

@jessfraz
Copy link
Collaborator

All my decisions are bad hahaha

I’ll ping you on PRs from here out, and remove the mountless :)

@jessfraz
Copy link
Collaborator

jessfraz commented Mar 1, 2018

I keep hitting this opencontainers/runc#1658 regardless of userns or non userns and I'm just wondering if this is because of Dockers masked paths or read only paths although I tried removing those and it still didn't work. It's super odd to me

@AkihiroSuda
Copy link
Collaborator Author

Closing, as this proposal was implemented in v0.3.1/v0.3.2. (thanks!)

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

No branches or pull requests

2 participants