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

Remove the SecurityContextDeny admission controller so that the testing environment matches the production environment #21004

Merged

Conversation

roberthbailey
Copy link
Contributor

This was removed from config-default.sh in #16986.

Fixes #18851

/cc @pmorie @vishh @ArtfulCoder

@k8s-github-robot
Copy link

Labelling this PR as size/XS

@k8s-github-robot k8s-github-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 10, 2016
@vishh
Copy link
Contributor

vishh commented Feb 10, 2016

LGTM

@k8s-bot
Copy link

k8s-bot commented Feb 10, 2016

GCE e2e test build/test passed for commit d602088db8f757a741075c4c9e2e14acdd961df8.

@roberthbailey
Copy link
Contributor Author

@k8s-bot unit test this issue: #18708

@roberthbailey
Copy link
Contributor Author

ping @ArtfulCoder

@ArtfulCoder ArtfulCoder added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 16, 2016
@k8s-github-robot
Copy link

@k8s-bot test this

Tests are more than 48 hours old. Re-running tests.

@k8s-bot
Copy link

k8s-bot commented Feb 16, 2016

GCE e2e test build/test passed for commit d602088db8f757a741075c4c9e2e14acdd961df8.

@k8s-github-robot
Copy link

@k8s-bot test this

Tests are more than 48 hours old. Re-running tests.

@k8s-bot
Copy link

k8s-bot commented Feb 18, 2016

GCE e2e test build/test passed for commit d602088db8f757a741075c4c9e2e14acdd961df8.

@ArtfulCoder
Copy link
Contributor

@roberthbailey

https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/admission/securitycontext/scdeny/admission.go#L51

The admission controller does not check if the pod spec has set pod.Spec.SecurityContext.Privileged == True.

As a result, my test which explicity tests whether Privileged pod can be created, succeeds, even though the SecurityContextDeny was set on ApiServer.
https://github.com/kubernetes/kubernetes/blob/master/test/e2e/privileged.go#L129

I believe it might be a bug in the SecurityContext Admission control that we don't verify whether Privileged is set or not

@bgrant0607

@ArtfulCoder
Copy link
Contributor

Actually, there is a separate flag for allow-privileged, probably for historical reasons and hence it is not part of the SecurityContextDeny admission control.

So that should solve the mystery of why privileged pods are allowed even with SecurityContextDeny.
We have turned on --allow-privileged=true

@bgrant0607
Copy link
Member

Please also do a search for SecurityContextDeny. It appears in lots of places.

cc @pweil-

@bgrant0607
Copy link
Member

@ArtfulCoder What SecurityPolicyDeny does is described here:
https://github.com/kubernetes/kubernetes/blob/master/docs/admin/admission-controllers.md#securitycontextdeny

The comment says:

// Admit will deny any pod that defines SELinuxOptions or RunAsUser.

@bgrant0607
Copy link
Member

And we want to allow privileged pods by default, in case that wasn't clear.

The feature should be controlled by PodSecurityPolicy instead, in most cases:

type PodSecurityPolicySpec struct {

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Feb 19, 2016

GCE e2e build/test failed for commit d602088db8f757a741075c4c9e2e14acdd961df8.

@ArtfulCoder
Copy link
Contributor

@bgrant0607
The doc you mentioned, https://github.com/kubernetes/kubernetes/blob/master/docs/admin/admission-controllers.md#securitycontextdeny has a link to
https://github.com/kubernetes/kubernetes/blob/master/docs/user-guide/security-context.md#security-contexts which says it is for (uid, gid, capabilities, SELinux role, etc..)

Note the use of "etc" in the document :))

It is super confusing to have Admission Control (securitycontextdeny), PodSecurityPolicy and on top, another flag --allow-privileged, with seemingly overlapping responsibilities.

@bgrant0607
Copy link
Member

@ArtfulCoder I agree. I don't think we need SecurityContextDeny at this point. I was suggesting removing it more broadly from the defaults: from hyperkube, vagrant, kubemark, centos, ubuntu, HA config, etc.

Openshift uses SecurityContextConstraint instead:
https://github.com/openshift/origin/blob/master/pkg/cmd/server/kubernetes/master_config.go#L48
https://github.com/openshift/origin/blob/master/pkg/security/admission/admission.go#L97

cc @derekwaynecarr @pweil- @erictune

@pweil-
Copy link
Contributor

pweil- commented Feb 23, 2016

+1 to removing this. It was initially implemented to prevent usage of the features but now that they've had plenty of burn in time I don't think it's serving a purpose.

In the future a PSP admission controller will serve this purpose.

Also it would close: #16456

@erictune
Copy link
Member

SGTM.

On Tue, Feb 23, 2016 at 11:45 AM, Paul Weil notifications@github.com
wrote:

+1 to removing this. It was initially implemented to prevent usage of the
features but now that they've had plenty of burn in time I don't think it's
serving a purpose.

In the future a PSP admission controller will serve this purpose.

Also it would close: #16456
#16456


Reply to this email directly or view it on GitHub
#21004 (comment)
.

@roberthbailey
Copy link
Contributor Author

@k8s-bot test this: issue #21463

@derekwaynecarr
Copy link
Member

+1

@k8s-bot
Copy link

k8s-bot commented Feb 25, 2016

GCE e2e build/test failed for commit d602088db8f757a741075c4c9e2e14acdd961df8.

testing environment matches the production environment. This
was removed from config-default.sh in kubernetes#16986.
@roberthbailey roberthbailey force-pushed the gce-e2e-admission-controllers branch from d602088 to a238d90 Compare February 25, 2016 05:07
@k8s-github-robot
Copy link

@k8s-bot ok to test
@k8s-bot test this

pr builder appears to be missing, activating due to 'lgtm' label.

@roberthbailey
Copy link
Contributor Author

Rebased to try and avoid flakes.

@k8s-bot test this issue #21475

@k8s-github-robot
Copy link

PR changed after LGTM, removing LGTM.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 25, 2016
@k8s-bot
Copy link

k8s-bot commented Feb 25, 2016

GCE e2e test build/test passed for commit a238d90.

@ArtfulCoder ArtfulCoder added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 25, 2016
fabioy added a commit that referenced this pull request Feb 26, 2016
…llers

Remove the SecurityContextDeny admission controller so that the testing environment matches the production environment
@fabioy fabioy merged commit 1460dce into kubernetes:master Feb 26, 2016
@ghost ghost mentioned this pull request Feb 26, 2016
@roberthbailey roberthbailey deleted the gce-e2e-admission-controllers branch May 23, 2016 17:44
sttts added a commit that referenced this pull request May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.