-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
capabilities: always set ambient and inheritable
change capabilities handling to reflect what docker does. Bounding: set to caplist Inheritable: set to caplist Effective: if uid != 0 then clear; else set to caplist Permitted: if uid != 0 then clear; else set to caplist Ambient: clear Signed-off-by: Giuseppe Scrivano <[email protected]>
- Loading branch information
Showing
4 changed files
with
8 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
703381b
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.
Setting inheritable capabilities like that looks like a bug to me. The kernel doesn't launch any process, PID=1 or anything, with any Inheritable capabilities. However, with this behavior, containerized distributions leak inheritable capabilities all over the place. I stumbled onto this strangeness, when I first tried to run my libcap regression tests in a container under Fedora.
GitHub's actions container rightly doesn't do this. ChromeOS's Linux in a box container doesn't do this. What motivates the choice here?
703381b
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.
the only reason I've added the inheritable capabilities to the default set is because Docker does it, so that users moving from Docker to Podman won't notice any difference.
I agree with you though and it is probably time to revisit that decision.
@rhatdan what do you think? Should we revert in part this change and do not add inheritable capabilities by default?
703381b
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.
Sounds good to me 👍
703381b
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 always like increasing security, but if it breaks anything we need a way for users to be able to turn it back on. Should there be an entry in containers.conf?
703381b
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.
The rest of the Linux application space uses user space code to raise Inheritable capabilities. They have no purpose beyond file capability handshakes and/or Ambient inheritance. Neither of which is part of the way a container launches it's first user space code. Raising Inheritable capabilities can be done by any process with the corresponding Permitted bit(s).
703381b
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.
do we need to tweak also the capabilities we use for
exec
? We are currently setting inheritable, permitted, ambient to the bounding set (if privileged), or to the effective set (if not privileged)703381b
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.
Wherever you are setting the Ambient vector, then you will have to set the Inheritable flag too for it to actually work. However, the code above explicitly sets the Ambient vector to empty.
Raising Inheritable flag capabilities like this just ruins the POSIX.1e model separation in meaning of Permitted and Inheritable file capabilities. It also shifts the expectations of in-container privilege Inheritance back in the direction of this old kernel issue from 2000.