Skip to content

Modify privileged SCC to allow to use all capabilities #12875

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/swagger-spec/openshift-openapi-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -55440,7 +55440,7 @@
"type": "boolean"
},
"allowedCapabilities": {
"description": "AllowedCapabilities is a list of capabilities that can be requested to add to the container. Capabilities in this field maybe added at the pod author's discretion. You must not list a capability in both AllowedCapabilities and RequiredDropCapabilities.",
"description": "AllowedCapabilities is a list of capabilities that can be requested to add to the container. Capabilities in this field maybe added at the pod author's discretion. You must not list a capability in both AllowedCapabilities and RequiredDropCapabilities. To allow all capabilities you may use '*'.",
"type": "array",
"items": {
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func GetBootstrapSecurityContextConstraints(sccNameToAdditionalGroups map[string
},
},
AllowPrivilegedContainer: true,
AllowedCapabilities: []kapi.Capability{kapi.CapabilityAll},
Volumes: []kapi.FSType{kapi.FSTypeAll},
AllowHostNetwork: true,
AllowHostPorts: true,
Expand Down
2 changes: 1 addition & 1 deletion pkg/openapi/zz_generated.openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -21916,7 +21916,7 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
},
"allowedCapabilities": {
SchemaProps: spec.SchemaProps{
Description: "AllowedCapabilities is a list of capabilities that can be requested to add to the container. Capabilities in this field maybe added at the pod author's discretion. You must not list a capability in both AllowedCapabilities and RequiredDropCapabilities.",
Description: "AllowedCapabilities is a list of capabilities that can be requested to add to the container. Capabilities in this field maybe added at the pod author's discretion. You must not list a capability in both AllowedCapabilities and RequiredDropCapabilities. To allow all capabilities you may use '*'.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
Expand Down
10 changes: 10 additions & 0 deletions pkg/security/admission/admission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func TestAdmitCaps(t *testing.T) {
requiresFooToBeDropped.Name = "requireDrop"
requiresFooToBeDropped.RequiredDropCapabilities = []kapi.Capability{"foo"}

allowAllInAllowed := restrictiveSCC()
allowAllInAllowed.Name = "allowAllCapsInAllowed"
allowAllInAllowed.AllowedCapabilities = []kapi.Capability{kapi.CapabilityAll}

tc := map[string]struct {
pod *kapi.Pod
sccs []*kapi.SecurityContextConstraints
Expand Down Expand Up @@ -108,6 +112,12 @@ func TestAdmitCaps(t *testing.T) {
Drop: []kapi.Capability{"foo"},
},
},
// UC 8: using '*' in allowed caps
"should accept cap add when all caps are allowed": {
pod: createPodWithCaps(&kapi.Capabilities{Add: []kapi.Capability{"foo"}}),
sccs: []*kapi.SecurityContextConstraints{restricted, allowAllInAllowed},
shouldPass: true,
},
}

for i := 0; i < 2; i++ {
Expand Down
4 changes: 4 additions & 0 deletions vendor/k8s.io/kubernetes/pkg/api/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/k8s.io/kubernetes/pkg/api/v1/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/k8s.io/kubernetes/pkg/api/validation/validation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.