-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix fifo usage with userns and not root users #912
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
Conversation
7461a1a to
01f1d93
Compare
libcontainer/factory_linux.go
Outdated
| } | ||
| fifoName := filepath.Join(containerRoot, execFifoFilename) | ||
| oldMask := syscall.Umask(0000) | ||
| if err := syscall.Mkfifo(fifoName, 0666); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this mean that any user can start a container created by root? This doesn't make sense to me IMO -- what's the usecase? With the rootless container setup, my hope was that each user's containers could only be controlled by them (with root being a special case) -- this means that any user will be able to start any other users' containers. Why is this necessary? That's why I liked the signal setup, because it retained that access control.
Sure, at the moment the only access control is "starting a container if it's been set up already". But I can imagine cases where people might not want an unprivileged user to start a container before they've run all of their hooks.
My plan with the rootless container setup is for everything to be per-user, rather than a global free-for-all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change this to 0622 so that only root can read and unblock the container's process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we chowning the FIFO, surely we can just make it 0600? Why do other users need to be able to write to the FIFO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the uid at that point basically 0,0 ?
Meaning that, in a userns context, the user at the time of writing to the fifo would be matched against "other".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because we chown the FIFO when creating the container (it's the next line after this). If we didn't chown it, then we wouldn't have any guarantee that the UID would be mapped (and thus nobody in the container could read from the socket).
Signed-off-by: Michael Crosby <[email protected]>
01f1d93 to
5ce88a9
Compare
|
@crosbymichael Yeah, will review it shortly. |
1 similar comment
|
@crosbymichael I still had some open concerns about the permissions:
|
Signed-off-by: Michael Crosby [email protected]