Part 1 of 7 · 1 min read
Why this page comes sixth
In this module you will
- Define a sandbox and say why it assumes that a process may be taken over.
- Use resource limits (
setrlimit) and explain the difference between a soft and a hard limit. - Explain a seccomp filter and show one that blocks a single system call.
- Show what
chrootchanges, and say why it is not a strong boundary alone. - Contrast discretionary and mandatory access control, and name SELinux and AppArmor.
Page 4 gave a process only the rights it needs, and page 5 showed that a bug can still take the process over. This page assumes that the take-over happens and builds walls around the process, so that the damage stays small. It uses the system calls of Level 0, the file view of Level 9 and the process limits of Level 1. Level 11 then builds containers from the same parts, plus namespaces and control groups.
About this example About this example
Real: Both C programs were compiled with gcc -Wall -Wextra and run as root on a Linux test machine (kernel 6.18, x86-64). All the outputs shown are real.
Scripted: The file /etc/hostname stands for any file that the sandboxed program should not be able to open. The empty directory /tmp/jail was created by hand for the chroot test.
Not real: The test machine does not list a Linux security module (the file /sys/kernel/security/lsm does not exist there), so section 5 describes SELinux and AppArmor from the books and shows no output. Its capability mask also lacks CAP_SYS_RESOURCE (page 4), which affects the hard-limit result in section 2.