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

rootless: disable unsupported security stuff #1834

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libcontainer/specconv/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,13 @@ func ToRootless(spec *specs.Spec) {
spec.Mounts = mounts

// Remove cgroup settings.
// NOTE: cgroups is supported when the permission is properly configured: https://github.com/opencontainers/runc/pull/1540
// The caller can set cgroups configuration after calling ToRootless().
spec.Linux.Resources = nil
spec.Linux.CgroupsPath = ""

// Disable unsupported security stuff
spec.Process.User.AdditionalGids = nil
spec.Process.ApparmorProfile = ""
spec.Process.SelinuxLabel = ""
Copy link
Member

Choose a reason for hiding this comment

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

We can't just disable this stuff like that -- if a user has specified them in the configuration then we have to either fail or try to do what they've asked. If we just ignore it (which is what this change does) then we could lead users into thinking their container has security properties it doesn't.

Also spec.Process.User.AdditionalGids = nil will break containers that are using newgidmap to allow for setgroups and the mapping of multiple users (unless I'm mistaken). The same with CgroupsPath -- if a privileged process has set up cgroups for us then we can use them.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm closing but AdditionalGids is not supported either way at the moment even when newgidmap is used

https://github.com/opencontainers/runc/blob/3a079311a7e9afeab4b722616cefd2f9b4129104/libcontainer/init_linux.go#L286-#L294

Copy link
Member

Choose a reason for hiding this comment

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

I think we forgot to fix / remove that check when we added newgidmap support -- in principle it should work now that you can have setgroups=allow in a rootless container.

}