liveBook · Manning

Type enforcement

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

Type enforcement is an SELinux access-control technique that restricts interactions according to the security types assigned to processes and resources.

Type enforcement assigns security types to processes and filesystem objects, then lets SELinux rules control their interactions. Container processes typically use container_t, while container files use container_file_t. section 10.8 section 10.8.1

Podman volume mounts expose the boundary directly: a container process cannot read an ordinary user_home_t or ssh_home_t directory. Relabeling with :Z makes a volume private to one container; :z applies a shared, category-free label. section 10.8.1 section 10.8.2

Observe and change a volume label

Create foo under the home directory and mount it without relabeling: podman run -v ./foo:/foo ubi8 touch /foo/bar returns Permission denied. Running with -v ./foo:/foo:Z permits the write and changes the file label to container_file_t. Avoid relabeling sensitive directories such as .ssh. section 10.8.1

Type enforcement protects the host from container processes and has blocked documented container escapes, but it does not separate containers sharing the same type. Podman’s MCS enforcement assigns distinct categories; use :z only when sharing is intentional. section 10.8.1 section 10.8.2

Table 10.5 SELinux label type examples (view table figure)

Object

User

Role

Type

MCS level

Container process

system_u

system_r

container_t

s0:c1,c2

Container process

system_u

system_r

container_t

s0:c361,c871

Container file

system_u

object_r

container_file_t

s0:c1,c2

Container file

system_u

object_r

container_file_t

s0:s361,c871

/etc/shadow label

system_u

object_r

shadow_t

s0

Container process

system_u

system_r

spc_t

s0

User process

unconfined_u

unconfined_r

unconfined_t

s0-s0:c0.c1023

Compare process, container-file, host-file, and privileged-process labels to identify which SELinux type governs an access decision. section 10.8.1

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

How deep it goes
Explains labels, volume relabeling, access denials, and escape protection, while deferring detailed policy construction.
Examples
Demonstrates denied .ssh and user_home_t mounts, :z and :Z relabeling, label inspection, and blocked container-escape vulnerabilities.
What it assumes
Assumes Linux process, filesystem, and Podman volume familiarity while explaining SELinux labels and enforcement from the mechanism upward.
What you can do after
Operate/configure Podman volume labels and diagnose SELinux permission denials without weakening protection unnecessarily.
How it connects
Connects SELinux with MCS enforcement, Podman volume mounts, Linux security modules, namespaces, and container escape protection.

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.