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

Proposal: decompose --privileged into individual --security-opt options #47663

Open
neersighted opened this issue Apr 2, 2024 · 4 comments
Open
Labels
area/security kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny status/0-triage

Comments

@neersighted
Copy link
Member

neersighted commented Apr 2, 2024

Description

These two pull requests have (re-)surfaced recently, and are motivated by the the want to make --privileged less blunt/all-encompassing, in order to enable new use-cases that only require some of its features.

Today there is a lot that only --privileged can do, and the semantics of combining it with existing --security-opt are unclear, even to maintainers. A partially correct/semi-out-of-date list is here:

To try and solve this in a way that lets us move forward and doesn't incur more technical debt, blow up the combinatorial matrix in a way that is hard to understand, or introduce even more confusion for users, I'd like to propose eliminating --privileged entirely.

Instead, --privileged could be clientside sugar that decomposes into a (new) set of --security-opt flags that poke all the holes in the container we create today, but in a composable fashion. This would also enable us to solve the 'how to combine' problem above, by empowering the user to express exactly the semantics they desire; we can make --privileged and --security-opt an error, and print a suggested command line that specifies each option granularity instead (or alternatively, lists all the knobs but doesn't enumerate those left at default values).

While this isn't quite a full entitlements system (#32801), I think it does help with other use-cases, like moby/swarmkit#3072 as well (allowing for something more granular would solve most of the objections the SwarmKit maintainers have historically had), and would align nicely with recent work in SwarmKit:

@thaJeztah
Copy link
Member

I need to refresh my memory on this one; I seem to recall I proposed or discussed this as an option at some point, but there were some reasons why setting these options client-side (or all individually) to be more declarative had some issues.

But maybe I'm conflating with my suggestion to --cap-add ALL do something similar (lookup all capabilities and set them all, instead of ALL to be in the container's config).

@thaJeztah
Copy link
Member

For reference; some prior discussion on those parts (problem at least was that if we wanted "defaults" to be set by the client, we would need some way to learn about those defaults); some prior discussions (but I think there may have been other locations)

@neersighted
Copy link
Member Author

The list of things have been relatively stable enough that I think I'm okay with older clients defaulting to an older list of security-opts; that being said if we don't like that, we can add some sort of _ping endpoint equivalent for the client to discover the default set...

@tianon
Copy link
Member

tianon commented Apr 15, 2024

(added #42275 (comment) to the list in the OP)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny status/0-triage
Projects
None yet
Development

No branches or pull requests

3 participants