liveBook · Manning

SELinux

As explained in Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

An SELinux system is an operating system environment with SELinux mandatory access-control enforcement enabled.

SELinux is a Linux labeling system that assigns labels to processes and filesystem objects, then lets the kernel enforce rules governing their interactions. Containers use it to restrict process access to designated filesystems and volumes. section 10.8 section 10.0

Container isolation uses two SELinux mechanisms:

  • Type enforcement controls what processes may do according to their assigned type. section 10.8
  • MCS enforcement adds categories assigned to processes, strengthening separation between container contexts. section 10.8
  • SELinux works alongside namespaces, capabilities, seccomp, and read-only kernel filesystems rather than providing container isolation alone. section 1.2

Denied container access

When a container process cannot access a filesystem resource, investigate the security boundary instead of immediately using --privileged, which disables all security separation. section 10.0

Table 1.1 Advanced Linux security features (view table figure)

Component

Description

Reference

Linux capabilities

Linux capabilities subdivide the power of root into distinct capabilities.

The capabilities man page is a good overview of the available capabilities (https://bit.ly/3A3Ppeg).

SELinux

Security-Enhanced Linux (SELinux) is a Linux kernel mechanism that labels every process and every filesystem object on the system. A SELinux policy defines the rules on how labeled processes interact with label objects. The Linux kernel enforces the rules.

I wrote the SELinux Coloring Book, which is a fun way to help you understand SELinux (https://bit.ly/33plEbD). If you really want to study the subject, check out the SELinux notebook (https://bit.ly/3GxGhkm).

Seccomp

seccomp is a Linux kernel mechanism that limits the number of syscalls to a group of processes on the system. You can remove potentially dangerous syscalls from being called by the processes.

The seccomp man page is a good source of additional information on seccomp (https://bit.ly/3rnnim1).

User namespace

The user namespace allows you to have Linux capabilities within the group of UIDs and GIDs assigned to the namespace, without having root capabilities on the host.

The user namespace is fully explained in chapter 3.

Review SELinux alongside capabilities, seccomp, namespaces, and other advanced Linux security features. section 1.2

How Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more covers it

How deep it goes
Explains labels, policy interactions, type enforcement, and MCS, but stops short of policy authoring or troubleshooting procedures.
Examples
Uses container filesystem restrictions, denied access, privileged mode, and an advanced Linux security-features comparison.
What it assumes
Assumes Linux process and filesystem concepts while defining SELinux labels, enforcement types, and container boundaries.
What you can do after
Evaluate container filesystem denials as security boundaries and avoid disabling isolation with --privileged.
How it connects
Connects filesystem access control with namespaces, Linux capabilities, seccomp, cgroups, and user namespaces.

Also explained in

Compare how 2 books explain SELinux →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more. The section links point to the parts of the book it draws on.