-
Notifications
You must be signed in to change notification settings - Fork 623
Privilege Profile support #2075
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
c6b9d7a
to
d546688
Compare
Further notes: In #1964 we were trying to group options by OS. I initially agreed but I feel like it might be overkill. It's relatively safe to assume that those options apply only to supported platforms. After all, it's not just because you're running linux that SELinux or AppArmor options are going to work: you actually need host level support. |
@diogomonica @cyli In the original PR, we were encapsulating those options into a "raw" object (which I assume paved the road to entitlements). Could you shed some light? |
For seccomp and apparmor, I assume the profiles are available locally. Maybe at some point we might want to inject them (and I am not sure how feasible that is - I don't think we can just inject new stuff). Anyway, that's not happening now for sure. Do we need to mark them as "local"? Or are we good with this interpretation? |
Codecov Report
@@ Coverage Diff @@
## master #2075 +/- ##
==========================================
- Coverage 57.25% 57.16% -0.09%
==========================================
Files 117 117
Lines 20124 20124
==========================================
- Hits 11521 11503 -18
- Misses 7273 7292 +19
+ Partials 1330 1329 -1 Continue to review full report at Codecov.
|
d546688
to
fcb86f8
Compare
For seccomp, we take the profile directly from the client. |
@cpuguy83 say again? Where is it stored? |
How #1722 relates to this PR? Also, I guess
8000
|
@aluzzardi example: |
@aluzzardi - Yes the original plan was for the privilege profile to contain a full list of the raw capabilities to be passed to the service, and the entitlements would be a UI feature that generated that list. I think I may be behind on what we're currently planning on doing though - AFAIK for plugins, will the the spec object just be the raw object from docker? If so, I think that includes the docker object |
How about making this more strongly typed by making it a
Sounds like another situation where we might appreciate having a |
@PatrickLang do you have feedback on this?
I think the question is whether we should persist with the current approach of requiring operator to distribute a file or registry setting on all hosts in the swarm where a service is to be run, or whether we should do something smarter to that on |
@n4ss @docker/security-team |
@friism I don't think users like deploying extra files to hosts. The fewer the better - ie just install the Docker engine and your plugins, join the swarm and done. Pushing these through swarm also makes it easier if I want to redeploy a service with a different Active Directory service account. That way I don't need to update things stored on the hosts before deploying the service. |
fcb86f8
to
b199dfe
Compare
Few changes:
Questions:
|
Personally I think a string is fine. If we're referencing a local file, a file path seems like the right way to do that, and I don't expect we'd need to add more meta-information. If it turns out we do, we already have the oneof, so it's easy to add a new way to reference the file.
I don't understand |
I think normally this would be a registry reference? |
@diogomonica Another question for you ... (and for you @dhiltgen ?) This is what I have for SELinux: message SELinuxContext {
string user = 1;
string role = 2;
string type = 3;
string level = 4;
} I see there's also a |
b199dfe
to
13543fb
Compare
Updated with the implementation |
agent/exec/dockerapi/container.go
Outdated
hc.SecurityOpt = append(hc.SecurityOpt, "credentialspec=file://"+credentials.GetFile()) | ||
case *api.Privileges_CredentialSpec_Registry: | ||
hc.SecurityOpt = append(hc.SecurityOpt, "credentialspec=registry://"+credentials.GetRegistry()) | ||
} |
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.
Error out if the CredentialSpec
type is unrecognized?
agent/exec/dockerapi/container.go
Outdated
selinux := privileges.SELinuxContext | ||
if selinux != nil { | ||
if selinux.User != "" { | ||
hc.SecurityOpt = append(hc.SecurityOpt, "label=user:%s"+selinux.User) |
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.
Is the %s in here intentional? It looks like a mistake.
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.
Same comment for the other 3 selinux fields
|
The |
504f23e
to
dfbc682
Compare
Updated with |
Thanks @cpuguy83 Updated, should be good to go - PTAL |
LGTM is there a easy way to test this? |
on it |
0d6833c
to
b2d9985
Compare
I've decided to remove the code from here, protos only. The one and only implementation is moby/moby#32339 Can we agree on the protos and move on? I would need an LGTM from someone from security (ping @docker/security-team @n4ss @diogomonica) and an overall datatype LGTM (ping @aaronlehmann @cpuguy83) Once this PR is merged we'll shift the focus on the implementation details in moby/moby#32339 |
LGTM |
1 similar comment
LGTM |
I tested credential-spec: moby/moby#32339 (comment) |
Thanks @friism @cpuguy83 @aaronlehmann! Merging by EOD - @diogomonica @n4ss @cyli Any chance of getting a quick review by then? @dhiltgen verified that the SELinuxContext (at least the |
@aluzzardi will this allow us to pass client-sided full seccomp.json files to be used? |
@aluzzardi sorry for the late review, LGTM @diogomonica it will require an additional field in |
b2d9985
to
fbede6d
Compare
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
fbede6d
to
cac0545
Compare
@diogomonica seccomp and apparmor were dropped from this PR. SELinux and CredentialSpec only |
Thanks everyone! |
@aluzzardi is there a reason why it's SELinux only on linux? Or is it just a part.1 PR? |
Replaces #2070
Related to #1964 #1944
Trying to resurrect the past attempts at this. The main requirements are selinux and credential spec which are blockers - seccomp and apparmor are nice to have.
I mapped what we have in docker's
--security-opt
in here. Since we need a couple of those options I figured I could port everything that's in there (that's why I left capabilities out for the time being).file://path
orregistry://key
). Do we want to continue in the same direction or do we want to just embed the blob?--security-opt="label:user:USER"
). Here I tried to make that strongly typed/cc @cyli @ehazlett @johnstep @aaronlehmann @dhiltgen @diogomonica @tiborvass