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

feature: selinux for cri manager #1092

Merged
merged 1 commit into from
Apr 12, 2018

Conversation

YaoZengzeng
Copy link
Contributor

@YaoZengzeng YaoZengzeng commented Apr 10, 2018

Signed-off-by: YaoZengzeng yaozengzeng@zju.edu.cn

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

With this PR, we could enable one of the security context --- SELinux, if it's configured in CRI.

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@YaoZengzeng YaoZengzeng force-pushed the selinux branch 4 times, most recently from 52b378a to c97f1b9 Compare April 11, 2018 01:48
@YaoZengzeng YaoZengzeng changed the title feature: selinux for both cri manager feature: selinux for cri manager Apr 11, 2018
@codecov-io
Copy link

codecov-io commented Apr 11, 2018

Codecov Report

Merging #1092 into master will decrease coverage by 0.31%.
The diff coverage is 30.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1092      +/-   ##
==========================================
- Coverage    15.8%   15.48%   -0.32%     
==========================================
  Files         163      161       -2     
  Lines        8793     8800       +7     
==========================================
- Hits         1390     1363      -27     
- Misses       7300     7334      +34     
  Partials      103      103
Impacted Files Coverage Δ
daemon/mgr/spec.go 0% <ø> (ø) ⬆️
daemon/mgr/cri_utils.go 28.85% <0%> (-1.57%) ⬇️
daemon/mgr/spec_linux.go 0% <0%> (ø) ⬆️
daemon/mgr/container_utils.go 58.03% <62.96%> (+1.84%) ⬆️
client/client.go 28.57% <0%> (-10.83%) ⬇️
cli/network.go 0% <0%> (ø) ⬆️
client/container.go 0% <0%> (ø) ⬆️
client/container_restart.go
client/container_top.go
client/container_resize.go
... and 3 more

@YaoZengzeng
Copy link
Contributor Author

@allencloud PTAL

meta.AppArmorProfile = value
case "seccomp":
meta.SeccompProfile = value
case "no-new-privileges":
Copy link
Collaborator

Choose a reason for hiding this comment

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

prevent processes in container to gain new privileges via the --security-opt=no-new-privileges flag

just attach a record which may do us a favour.

case "label":
labelOpts = append(labelOpts, value)
default:
return fmt.Errorf("invalid type %s in --security-opt %s: unknown type from apparmor and seccomp", key, securityOpt)
Copy link
Collaborator

Choose a reason for hiding this comment

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

With the code change, I do not think this line is correct any longer.

unknown type from apparmor and seccomp

except apparmor and seccomp, it seems that we should add no-new-privileges and label. Right? @YaoZengzeng

meta.SeccompProfile = value
case "no-new-privileges":
noNewPrivileges, err := strconv.ParseBool(value)
if labelOpts != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can judge if labelOpts == nil first to make return fast to simplify code and reduce ident.

if labelOpts == nil {
    return nil
}
meta.ProcessLabel, meta.MountLabel, err = label.InitLabels(labelOpts)
if err != nil{
    return fmt.Errorf("failed to init labels: %v", err)
}
return nil

Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn>
@YaoZengzeng
Copy link
Contributor Author

@allencloud Updated.

@allencloud
Copy link
Collaborator

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Apr 12, 2018
@allencloud allencloud merged commit 83e1778 into AliyunContainerService:master Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants