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: appArmor for both cri manager and container manager #672

Merged
merged 1 commit into from
Feb 1, 2018

Conversation

YaoZengzeng
Copy link
Contributor

Signed-off-by: YaoZengzeng [email protected]

1.Describe what this PR did

With this PR, we could enable one of the security option AppArmor.

Now we could apply AppArmor with options like:

  1. "apparmor=unconfined": which means don't apply any AppArmor profile
  2. "apparmor=XXX": which means apply AppArmor profile "XXX"
  3. "apparmor=pouch-default": see below.

Actually in docker, we should apply default AppArmor profile "docker-default" to every container which not explicitly specify it or explicitly specify it with "docker-default". We should implement it in pouch as well.

2.Does this pull request fix one issue?

fixes part of #635

3.Describe how you did it

4.Describe how to verify it

5.Special notes for reviews

@codecov-io
Copy link

codecov-io commented Jan 31, 2018

Codecov Report

Merging #672 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #672      +/-   ##
==========================================
- Coverage   10.16%   10.16%   -0.01%     
==========================================
  Files          71       71              
  Lines        3422     3425       +3     
==========================================
  Hits          348      348              
- Misses       3035     3038       +3     
  Partials       39       39
Impacted Files Coverage Δ
cli/container.go 26.25% <0%> (-0.17%) ⬇️
cli/create.go 0% <0%> (ø) ⬆️
cli/run.go 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d4b0838...0c6cddf. Read the comment docs.

@YaoZengzeng
Copy link
Contributor Author

@allencloud @Letty5411 PTAL.

@@ -63,6 +63,7 @@ func (cc *CreateCommand) addFlags() {
flagSet.StringVar(&cc.utsMode, "uts", "", "UTS namespace to use")
flagSet.StringSliceVar(&cc.sysctls, "sysctl", nil, "Sysctl options")
flagSet.StringSliceVar(&cc.network, "net", nil, "Set networks to container")
flagSet.StringSliceVar(&cc.securityOpt, "security-opt", nil, "Security Options")
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 the command line usage was not readable enough for users to understand even developers. I will profile an issue to fix this.

@YaoZengzeng
Copy link
Contributor Author

@allencloud this PR has passed all corresponding tests in cri-tools and we may use some code in this PR for our further development.

Maybe we should merge this ASAP :)

@@ -330,6 +330,10 @@ func (mgr *ContainerManager) Create(ctx context.Context, name string, config *ty
meta.Config.NetworkDisabled = true
}

if err := parseSecurityOpt(meta, config.HostConfig); err != nil {
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 this will panic. Since in the containercreate function, HostConfig could be nil. And if you use a nil to get SecurityOpt, it would panic.

Although at the very beginning, we checked that if config.HostConfig == nil, we could make function parseSecurityOpt more robust. How about just inputting config.HostConfig. SecurityOpt ? Then like func parseSecurityOpt(meta *ContainerMeta, securityOpts []string) error

@allencloud
Copy link
Collaborator

allencloud commented Feb 1, 2018

LGTM generally except one nits in function parseSecurityOpt .

@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 Feb 1, 2018
@allencloud allencloud merged commit 62aada5 into AliyunContainerService:master Feb 1, 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/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants