CAPSICUM(4)
π CAPSICUM(4) π
okay bestie, gather round, because we're talking about Capsicum β the lightweight OS capability and sandbox framework, and she is that girl. this is a kernel interfaces manual page, so yes we're in section 4, and yes it's giving iconic security architecture. π
β¨ SYNOPSIS β¨
options CAPABILITY_MODE
options CAPABILITIES
that's it. that's the whole vibe. two kernel options and you're in business. π
πΈ DESCRIPTION πΈ
so, Capsicum is a lightweight OS capability and sandbox framework implementing a hybrid capability system model. no cap. and what is it for? bestie, it's for:
- application and library compartmentalisation
- the decomposition of larger bodies of software into isolated (sandboxed) components
...in order to implement security policies and limit the impact of software vulnerabilities. literally the "don't let one bug take down the whole app" agenda and we are obsessed. π¦
Capsicum provides two core kernel primitives, and they are the main characters:
- capability mode β a process mode, entered by invoking
cap_enter(2), in which access to global OS namespaces (such as the file system and PID namespaces) is restricted; only explicitly delegated rights, referenced by memory mappings or file descriptors, may be used. and here's the spicy part: once set, the flag is inherited by future children processes, and may not be cleared. so like, choose your fate carefully, because it's permanent. periodt. π - capabilities β limit operations that can be called on file descriptors. for example, a file descriptor returned by
open(2)may be refined usingcap_rights_limit(2)so that onlyread(2)andwrite(2)can be called, but notfchmod(2). the complete list of the capability rights can be found in therights(4)manual page. it's giving "you can come in but you can't touch anything." β¨
π«Ά the "we need alternatives" section π«Ά
in some cases, Capsicum requires use of alternatives to traditional POSIX APIs in order to name objects using capabilities rather than global namespaces:
- process descriptors β file descriptors representing processes, allowing parent processes to manage child processes without requiring access to the PID namespace; described in greater detail in
procdesc(4). - anonymous shared memory β an extension to the POSIX shared memory API to support anonymous swap objects associated with file descriptors; described in greater detail in
shm_open(2).
π the "we're limiting your options, babe" section π
in some cases, Capsicum limits the valid values of some parameters to traditional APIs in order to restrict access to global namespaces:
- process IDs β processes can only act upon their own process ID with syscalls such as
cpuset_setaffinity(2).
like, mind your own business, but make it a kernel feature. π
π₯ SEE ALSO π₯
go read these next, i'm literally begging you:
cap_enter(2)cap_fcntls_limit(2)cap_getmode(2)cap_ioctls_limit(2)cap_rights_limit(2)fchmod(2)open(2)pdfork(2)pdgetpid(2)pdkill(2)pdwait4(2)read(2)shm_open(2)write(2)cap_rights_get(3)libcasper(3)procdesc(4)
β HISTORY β
Capsicum first appeared in FreeBSD 9.0, and was developed at the University of Cambridge. β¨ academic baddies, we love to see it.
π AUTHORS π
Capsicum was developed by:
- Robert Watson
<rwatson@FreeBSD.org> - Jonathan Anderson
<jonathan@FreeBSD.org>
...at the University of Cambridge, and:
- Ben Laurie
<benl@FreeBSD.org> - Kris Kennaway
<kris@FreeBSD.org>
...at Google, Inc., and:
- Pawel Jakub Dawidek
<pawel@dawidek.net>
a whole squad of legends fr fr. π«Ά
π friendly reminder: capability mode is irreversible. once you cap_enter(2), you can't take it back. no take-backs, no undo, no "wait actually". it's a one-way door and it is locked.
okay that's the whole page, bestie!! this one came from the Debian distro flavour of things, dated May 18, 2017, and you just read the CAPSICUM(4) manual page β sandbox yourself responsibly, mwah πππ§
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2011, 2013 Robert N. M. Watson
- Copyright (c) 2011 Jonathan Anderson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms