concept SELinux in category openshift

appears as: SELinux
OpenShift in Action

This is an excerpt from Manning's book OpenShift in Action.

In OpenShift, the service that handles the creation and management of containers is docker (https://github.com/docker). Docker is a large, active, open source project started by Docker, Inc. The resources that docker uses to isolate processes in containers all exist as part of the Linux kernel. These resources include things like SELinux, Linux namespaces, and control groups (cgroups), which will all be covered later in the book. In addition to making these resources much easier to use, docker has also added several features that have enhanced its popularity and growth:

SELinux is a Linux kernel module that’s used to enforce mandatory access control (MAC). MAC is a set of access levels that are assigned to users by the system. Only users with root-level privileges can alter them. For typical users, including the automated user accounts in OpenShift that deploy applications, the SELinux configuration specified for a deployment is an immutable fact.

MAC is in contrast to discretionary access control (DAC) in Linux. DAC is the system of users and file ownership/access modes that we all use every day on Linux hosts. If only DAC were in effect in your OpenShift cluster, users could allow full access to their container’s resources by changing the ownership or the access mode for the container process or storage resources. One of the key security features of OpenShift is that SELinux automatically enforces MAC policies that can’t be changed by unprivileged users for pods and other resources, even if they deployed the application.

We need to take a few pages to discuss some fundamental information that we’ll use throughout the chapter. As with security in general, this won’t be a full SELinux introduction. Entire books have been written on that topic, including an SELinux coloring book available at https://github.com/mairin/selinux-coloring-book. But the following information will help you understand how OpenShift uses SELinux to create a secure platform. We’ll focus on the following SELinux concepts:

The default type of SELinux loaded on a Linux system is the targeted type. The rules in the targeted SELinux type are applied only to objects that have matching contexts. Every object on a server is assigned a label based on the SELinux context it matches. If an object doesn’t match a context, it’s assigned an unconfined_t type in its SELinux label. The unconfined_t type has no contexts or policies associated with it. Interactions between objects that aren’t covered by a policy in targeted SELinux are allowed to run with no interference.