8000 [WIP] Security Config for services by ehazlett · Pull Request #1944 · moby/swarmkit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[WIP] Security Config for services #1944

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

Closed
wants to merge 2 commits into from

Conversation

ehazlett
Copy link
Contributor
@ehazlett ehazlett commented Feb 10, 2017

The security config provides a way to add security settings
that may or may not be host specific. This is stored as part
of the ContainerSpec and is applied as necessary.

This is needed for things like userns and credentialspec.

For more details see moby/moby#30894

The security config provides a way to add security settings
that may or may not be host specific.  This is stored as part
of the ContainerSpec and is applied as necessary.

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
api/specs.proto Outdated

message SecurityConfig {
string userns = 30;
string credential_spec = 31 [(gogoproto.customname) = "CredentialSpec"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why 30 and 31?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically because...

dog

In all seriousness, I saw that registry_auth was high so I put this one to start at 30. Completely arbitrary and I defer to you for what it should be :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a separate message and the fields can start from 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Member

Choose a reason for hiding this comment

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

registry_auth was a bit of an exception ...

We added it knowing in advance that we'd deprecate it (in favor of using secrets to store registry auth) soooo we picked a high number we'd be unlikely to need in the future. Sorry you had to witness that :) We were trying to hide it under the rug.

api/specs.proto Outdated
string userns = 30;
string credential_spec = 31 [(gogoproto.customname) = "CredentialSpec"];
}
SecurityConfig security_config = 40;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why 40?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see above :D 👼

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think our general practice has been to avoid gaps between field numbers.

@@ -46,93 +46,93 @@ var _ = math.Inf
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package

type BasicScalar struct {
Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,json=field1,proto3" json:"Field1,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

These changes look unrelated. Perhaps you are using a different version of protoc. CI is using https://github.com/google/protobuf/releases/download/v3.0.2/protoc-3.0.2-linux-x86_64.zip

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah crap yes -- i'll remove that and grab the 3.0.2

api/specs.proto Outdated 8000
@@ -258,6 +258,12 @@ message ContainerSpec {
// task will exit and a new task will be rescheduled elsewhere. A container
// is considered unhealthy after `Retries` number of consecutive failures.
HealthConfig healthcheck = 16;

message SecurityConfig {
string userns = 30;
Copy link
Contributor

Choose a reason for hiding this comment

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

userns and credential_spec seem somewhat specific to moby/moby#23389 - wondering if we should have different types of SecurityConfig, and this could be one type?

Are there other different security config types do you think go into the SecurityConfig? @diogomonica can security profiles go here, for instance? (not sure if there are windows specific capabilities that should translate to instead).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya I should have brought that comment here. In the Engine PR I mention that I would like to also add --capabilities and a few others to this as well as anything else that other think makes sense.

@aluzzardi
Copy link
Member

Thanks for chipping in, @ehazlett :)

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

message SecurityConfig {
string userns = 1;
string credential_spec = 2 [(gogoproto.customname) = "CredentialSpec"];
Copy link
Member

Choose a reason for hiding this comment

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

nit: customname is not required, I believe that's how it's going to get generated anyway.

We use custom names for stuff like DNSConfig (otherwise it would get generated as DnsConfig)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah right -- i was thinking i had credentialspec where it would make Credentialspec -- i'll update thx

Copy link
Contributor

Choose a reason for hiding this comment

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

What will this field contain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should contain a string that is something like file:///... or registry:// I believe (https://github.com/docker/docker/blob/c0a1d2e0d88ff3cae6802dfbd128c7739e8c2bcc/daemon/start_windows.go#L135). @johnstep can you confirm?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this windows specific? How does this relate to security profiles?

Copy link
Contributor Author
@ehazlett ehazlett Feb 10, 2017

Choose a reason for hiding this comment

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

Yes it's windows specific. I believe it specifies a path to a "credential blob" (moby/moby#23389). This PR was supposed to be about security configuration and not specific to security profiles (although full disclosure I'm not sure what exactly security profiles mean as related to docker). Since they are authentication related and point to what seems like an authentication blob I thought it would be classified as "security".

Based upon the latest comment moby/moby#30894 (comment) this whole thing might be moot anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe that particular objection was to the docker service create CLI flags. (cc @diogomonica)

AFAIK the current plan is for low level capabilities to go into the spec and the API. Possibly in a versioned object (or typed objects, like "custom" for the low level capabilities), and for the something else (like the CLI) to translate from high level grants to groups low level capabilities. This is the current tentative plan for security profiles, because it's likely we won't get the first iteration of high level profiles right.

Even if the CLI is not the correct place to put the mapping, and the API needs to accept the higher level API instead, having a version of the profile that contains the low level capabilities in case someone wanted to specify a custom profile could be useful.

But to reiterate @stevvooe's question - I wasn't sure how the other security-related options would relate to security profiles in this object model (should profiles be a separate object in a security configuration for instance, etc.)

Copy link
Contributor

C 9E88 hoose a reason for hiding this comment

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

Correct.

SecurityProfile being distinct from SecurityConfig makes sense in my head.

@aluzzardi
Copy link
Member

This is @cyli and @diogomonica's area

@ehazlett
Copy link
Contributor Author

I'm closing this in favor of "security profiles". I will with the security team to get that started.

@ehazlett ehazlett closed this Feb 14, 2017
@cyli
Copy link
Contributor
cyli commented Feb 15, 2017

@diogomonica @ehazlett Seems like the security profiles are a separate concern/object from these particular options (user namespace , credential specs), which seem like they can move forward if we are happy with this config object?

I think we just needed another version/typed object representing security profiles, the first version of which contains a full list of capabilities.

Another question I had was whether we also wanted to support app armor and seccomp profiles too? If so, those should probably be specified here in the config object as well.

@diogomonica
Copy link
Contributor
  • app armor and seccomp are definitely part of security profiles, no?
  • I'm not sure if adding an OS-spoecific "credential specs" is the right thing to do here, since it will only work on windows.
  • Same for user namespace. Specific for linux. ideally this would all go into the security profile that would be generic enough to contain all of these?

@cyli
Copy link
Contributor
cyli commented Feb 15, 2017

@diogomonica I see... then maybe something like (I may be way overusing oneof here, and this may be overly redundant):

message SecurityProfile {
	oneof arch_profile {
		WindowsSecurityProfile windows = 1;
		LinuxSecurityProfile linux = 2;
	}
}

message WindowsSecurityProfile {
       string credential_spec = 1;
       // ?????
}

message LinuxSecurityProfile {
       string userns = 1;
       oneof profile_version {
            LinuxRawSecurityProfile raw = 2;
       }
}

message LinuxRawSecurityProfile {
       repeated string capabilities = 1;
       string app_armor = 2;
       string seccomp = 3;
}

@diogomonica
Copy link
Contributor

@cyli yeah, we might not have a one-off. Same container might run in different arch's w/ different profiles.

In general that sort of what I'm thinking about. The current work from @justincormack would get folded into LinuxRawSecurityProfile as much as possible, and then we would have to do the hard work of splitting high-level grands to the low-level perms.

/cc @dsampath

@cyli
Copy link
Contributor
cyli commented Feb 15, 2017

@ehazlett Would you like to continue that work here, or alternately if you prefer I can submit a new PR with just a proposed object model for security profiles?

@ehazlett
Copy link
Contributor Author
ehazlett commented Feb 15, 2017 via email

@diogomonica
Copy link
Contributor

@cyli I'm all for unblocking this particular feature (cred specs), but I'm slightly concerned we don't know exactly how this fits in the larger picture.

Anyway, maybe the discussion on a new PR brings some more clarity on whether we're missing something, or this is a good path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0