| ... | ... |
@@ -14,6 +14,17 @@ NOTE: OpenShift is in alpha and is not intended for production use yet. However |
| 14 | 14 |
[](https://godoc.org/github.com/openshift/origin) |
| 15 | 15 |
[](https://travis-ci.org/openshift/origin) |
| 16 | 16 |
|
| 17 |
+Security Warning |
|
| 18 |
+---------------- |
|
| 19 |
+OpenShift no longer requires SElinux to be disabled, however OpenShift is a system which runs Docker containers on your system. In some cases (build operations and the registry service) it does so using privileged containers. Furthermore those containers access your host's Docker daemon and perform `docker build` and `docker push` operations. As such, you should be aware of the inherent security risks associated with performing `docker run` operations on arbitrary images as they effectively have root access. This is particularly relevant when running the OpenShift nodes directly on your host system. |
|
| 20 |
+ |
|
| 21 |
+For more information, see these articles: |
|
| 22 |
+ |
|
| 23 |
+* http://opensource.com/business/14/7/docker-security-selinux |
|
| 24 |
+* https://docs.docker.com/articles/security/ |
|
| 25 |
+ |
|
| 26 |
+The OpenShift security model will continue to evolve and tighten as we head towards production ready code. |
|
| 27 |
+ |
|
| 17 | 28 |
Getting Started |
| 18 | 29 |
--------------- |
| 19 | 30 |
The simplest way to start is to run OpenShift Origin in a Docker container: |
| ... | ... |
@@ -21,13 +21,6 @@ System Environment |
| 21 | 21 |
|
| 22 | 22 |
$ systemctl stop firewalld |
| 23 | 23 |
|
| 24 |
-1. Disable selinux |
|
| 25 |
- |
|
| 26 |
- Eventually this will not be necessary but we are currently focused on features and will be revisiting selinux policies in the future. |
|
| 27 |
- |
|
| 28 |
- $ setenforce 0 |
|
| 29 |
- |
|
| 30 |
- |
|
| 31 | 24 |
Build Failures |
| 32 | 25 |
-------------- |
| 33 | 26 |
|
| ... | ... |
@@ -11,6 +11,7 @@ import ( |
| 11 | 11 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/meta" |
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/validation" |
| 14 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet" |
|
| 14 | 15 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 15 | 16 |
//"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| 16 | 17 |
"github.com/golang/glog" |
| ... | ... |
@@ -136,6 +137,9 @@ func walkJSONFiles(inDir string, fn func(name, path string, data []byte)) error |
| 136 | 136 |
} |
| 137 | 137 |
|
| 138 | 138 |
func TestExampleObjectSchemas(t *testing.T) {
|
| 139 |
+ // Allow privileged containers |
|
| 140 |
+ // TODO: make this configurable and not the default https://github.com/openshift/origin/issues/662 |
|
| 141 |
+ kubelet.SetupCapabilities(true) |
|
| 139 | 142 |
cases := map[string]map[string]runtime.Object{
|
| 140 | 143 |
"../examples/guestbook": {
|
| 141 | 144 |
"template": &templateapi.Template{},
|
| ... | ... |
@@ -9,6 +9,17 @@ Alternatively, if you are using the openshift/origin Docker container, please |
| 9 | 9 |
make sure you follow these instructions first: |
| 10 | 10 |
https://github.com/openshift/origin/blob/master/examples/sample-app/container-setup.md |
| 11 | 11 |
|
| 12 |
+Security Warning |
|
| 13 |
+---------------- |
|
| 14 |
+OpenShift no longer requires SElinux to be disabled, however OpenShift is a system which runs Docker containers on your system. In some cases (build operations and the registry service) it does so using privileged containers. Furthermore those containers access your host's Docker daemon and perform `docker build` and `docker push` operations. As such, you should be aware of the inherent security risks associated with performing `docker run` operations on arbitrary images as they effectively have root access. This is particularly relevant when running the OpenShift nodes directly on your host system. |
|
| 15 |
+ |
|
| 16 |
+For more information, see these articles: |
|
| 17 |
+ |
|
| 18 |
+* http://opensource.com/business/14/7/docker-security-selinux |
|
| 19 |
+* https://docs.docker.com/articles/security/ |
|
| 20 |
+ |
|
| 21 |
+The OpenShift security model will continue to evolve and tighten as we head towards production ready code. |
|
| 22 |
+ |
|
| 12 | 23 |
Setup |
| 13 | 24 |
----- |
| 14 | 25 |
At this stage of OpenShift 3 development, there are a few things that you will need to configure on the host where OpenShift is running in order for things to work. |
| ... | ... |
@@ -33,16 +44,6 @@ This will instruct the docker daemon to trust any docker registry on the 172.30. |
| 33 | 33 |
|
| 34 | 34 |
These instructions assume you have not changed the kubernetes/openshift service subnet configuration from the default value of 172.30.17.0/24. |
| 35 | 35 |
|
| 36 |
-### SELinux Changes ### |
|
| 37 |
- |
|
| 38 |
-Presently the OpenShift 3 policies for SELinux are a work in progress. For the time being, to play around with the OpenShift system, it is easiest to temporarily disable SELinux: |
|
| 39 |
- |
|
| 40 |
- $ sudo setenforce 0 |
|
| 41 |
- |
|
| 42 |
-This can be re-enabled after you are done with the sample app: |
|
| 43 |
- |
|
| 44 |
- $ sudo setenforce 1 |
|
| 45 |
- |
|
| 46 | 36 |
### FirewallD Changes ### |
| 47 | 37 |
|
| 48 | 38 |
Similar to our work on SELinux policies, the OpenShift firewalld rules are also a work in progress. For now it is easiest to disable firewalld altogether: |
| ... | ... |
@@ -65,7 +65,8 @@ |
| 65 | 65 |
"readOnly":false |
| 66 | 66 |
} |
| 67 | 67 |
], |
| 68 |
- "command": ["sh", "-c", "REGISTRY_URL=${DOCKER_REGISTRY_SERVICE_HOST}:${DOCKER_REGISTRY_SERVICE_PORT} OPENSHIFT_URL=http://${KUBERNETES_SERVICE_HOST}:443/osapi/v1beta1 exec docker-registry"]
|
|
| 68 |
+ "command": ["sh", "-c", "REGISTRY_URL=${DOCKER_REGISTRY_SERVICE_HOST}:${DOCKER_REGISTRY_SERVICE_PORT} OPENSHIFT_URL=http://${KUBERNETES_SERVICE_HOST}:443/osapi/v1beta1 exec docker-registry"],
|
|
| 69 |
+ privileged: true |
|
| 69 | 70 |
} |
| 70 | 71 |
], |
| 71 | 72 |
"version":"v1beta1", |
| ... | ... |
@@ -51,6 +51,8 @@ func (bs *CustomBuildStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.Pod, |
| 51 | 51 |
Name: "custom-build", |
| 52 | 52 |
Image: strategy.Image, |
| 53 | 53 |
Env: containerEnv, |
| 54 |
+ // TODO: run unprivileged https://github.com/openshift/origin/issues/662 |
|
| 55 |
+ Privileged: true, |
|
| 54 | 56 |
}, |
| 55 | 57 |
}, |
| 56 | 58 |
RestartPolicy: kapi.RestartPolicy{
|
| ... | ... |
@@ -34,6 +34,8 @@ func (bs *DockerBuildStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.Pod, |
| 34 | 34 |
Env: []kapi.EnvVar{
|
| 35 | 35 |
{Name: "BUILD", Value: string(buildJSON)},
|
| 36 | 36 |
}, |
| 37 |
+ // TODO: run unprivileged https://github.com/openshift/origin/issues/662 |
|
| 38 |
+ Privileged: true, |
|
| 37 | 39 |
}, |
| 38 | 40 |
}, |
| 39 | 41 |
RestartPolicy: kapi.RestartPolicy{
|
| ... | ... |
@@ -47,6 +47,8 @@ func (bs *STIBuildStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.Pod, er |
| 47 | 47 |
Env: []kapi.EnvVar{
|
| 48 | 48 |
{Name: "BUILD", Value: string(buildJSON)},
|
| 49 | 49 |
}, |
| 50 |
+ // TODO: run unprivileged https://github.com/openshift/origin/issues/662 |
|
| 51 |
+ Privileged: true, |
|
| 50 | 52 |
}, |
| 51 | 53 |
}, |
| 52 | 54 |
RestartPolicy: kapi.RestartPolicy{
|
| ... | ... |
@@ -81,6 +81,9 @@ func (c *NodeConfig) EnsureVolumeDir() {
|
| 81 | 81 |
// RunKubelet starts the Kubelet. |
| 82 | 82 |
func (c *NodeConfig) RunKubelet() {
|
| 83 | 83 |
// initialize Kubelet |
| 84 |
+ // Allow privileged containers |
|
| 85 |
+ // TODO: make this configurable and not the default https://github.com/openshift/origin/issues/662 |
|
| 86 |
+ kubelet.SetupCapabilities(true) |
|
| 84 | 87 |
cfg := kconfig.NewPodConfig(kconfig.PodConfigNotificationSnapshotAndUpdates) |
| 85 | 88 |
kconfig.NewSourceEtcd(kconfig.EtcdKeyForHost(c.NodeHost), c.EtcdClient, cfg.Channel("etcd"))
|
| 86 | 89 |
k := kubelet.NewMainKubelet( |