Bug 1359674

Summary: [infrastructure_public_278]SCC rules can't apply to init containers
Product: OpenShift Container Platform Reporter: DeShuai Ma <dma>
Component: NodeAssignee: Andy Goldstein <agoldste>
Status: CLOSED CURRENTRELEASE QA Contact: DeShuai Ma <dma>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.3.0CC: aos-bugs, ccoleman, jokerman, mmccomas, tdawson, wmeng
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-19 14:29:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description DeShuai Ma 2016-07-25 09:38:01 UTC
Description of problem:
When use has restricted scc rule, it still can create privileged init container.

Version-Release number of selected component (if applicable):
openshift v3.3.0.9
kubernetes v1.3.0+57fb9ac
etcd 2.3.0+git

How reproducible:
Always

Steps to Reproduce:
1.Create a pod with privileged init container
$ oc create -f https://raw.githubusercontent.com/mdshuai/testfile-openshift/master/initContainer/init-containers-privilege.yaml

2.Check the pod scc rule and status
[root@dhcp-128-7 Desktop]# oc get pod hello-pod -o json | grep openshift.io/scc
            "openshift.io/scc": "restricted",
[root@dhcp-128-7 Desktop]# oc get pod
NAME        READY     STATUS    RESTARTS   AGE
hello-pod   1/1       Running   0          14m

Actual results:
2. The pod is running.

Expected results:
1. Should restrict to create privileged init container when user has no permission

Additional info:
restricted user can also exec to the privileged container.

Comment 1 Clayton Coleman 2016-07-26 01:44:19 UTC
Fixed in https://github.com/openshift/origin/pull/9973

Comment 2 Weihua Meng 2016-07-28 06:45:43 UTC
Fixed.
openshift v3.3.0.11
kubernetes v1.3.0+57fb9ac
etcd 2.3.0+git


# oc create -f https://raw.githubusercontent.com/mdshuai/testfile-openshift/master/initContainer/init-containers-privilege.yaml

Error from server: error when creating "https://raw.githubusercontent.com/mdshuai/testfile-openshift/master/initContainer/init-containers-privilege.yaml": pods "hello-pod" is forbidden: unable to validate against any security context constraint: [spec.initContainers[0].securityContext.privileged: Invalid value: true: Privileged containers are not allowed]