1.\" 2.\" Copyright (c) 2011 Robert N. M. Watson 3.\" Copyright (c) 2011 Jonathan Anderson 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.\" $FreeBSD$ 28.\" 29.Dd September 20, 2011 30.Dt CAPSICUM 4 31.Os 32.Sh NAME 33.Nm Capsicum 34.Nd lightweight OS capability and sandbox framework 35.Sh SYNOPSIS 36.Cd "options CAPABILITY_MODE" 37.Cd "options CAPABILITIES" 38.Cd "options PROCDESC" 39.Sh DESCRIPTION 40.Nm 41is a lightweight OS capability and sandbox framework implementing a hybrid 42capability system model. 43.Nm 44can be used for application and library compartmentalisation, the 45decomposition of larger bodies of software into isolated (sandboxed) 46components in order to implement security policies and limit the impact of 47software vulnerabilities. 48.Pp 49.Nm 50provides two core kernel primitives: 51.Bl -tag -width indent 52.It capability mode 53A process mode, entered by invoking 54.Xr cap_enter 2 , 55in which access to global OS namespaces (such as the file system and PID 56namespaces) is restricted; only explicitly delegated rights, referenced by 57memory mappings or file descriptors, may be used. 58Once set, the flag is inherited by future children proceses, and may not be 59cleared. 60.It capabilities 61File descriptors that wrap other file descriptors, masking operations that can 62be called on them; for example, a file descriptor returned by 63.Xr open 2 64may be refined using 65.Xr cap_new 2 66so that only 67.Xr read 2 68and 69.Xr write 2 70can be called, but not 71.Xr fchmod 2 . 72.El 73.Pp 74In some cases, 75.Nm 76requires use of alternatives to traditional POSIX APIs in order to name 77objects using capabilities rather than global namespaces: 78.Bl -tag -width indent 79.It process descriptors 80File descriptors representing processes, allowing parent processes to manage 81child processes without requiring access to the PID namespace. 82.It anonymous shared memory 83An extension to the POSIX shared memory API to support anonymous swap objects 84associated with file descriptors. 85.El 86.Sh SEE ALSO 87.Xr cap_enter 2 , 88.Xr cap_getmode 2 , 89.Xr cap_getrights 2 , 90.Xr cap_new 2 , 91.Xr fchmod 2 , 92.Xr open 2 , 93.Xr pdfork 2 , 94.Xr pdgetpid 2 , 95.Xr pdkill 2 , 96.Xr pdwait4 2 , 97.Xr read 2 , 98.Xr shm_open 2 , 99.Xr write 2 100.Sh HISTORY 101.Nm 102first appeared in 103.Fx 9.0 , 104and was developed at the University of Cambridge. 105.Sh AUTHORS 106.Nm 107was developed by 108.An -nosplit 109.An "Robert Watson" Aq rwatson@FreeBSD.org 110and 111.An "Jonathan Anderson" Aq jonathan@FreeBSD.org 112at the University of Cambridge, and 113.An "Ben Laurie" Aq benl@FreeBSD.org 114and 115.An "Kris Kennaway" Aq kris@FreeBSD.org 116at Google, Inc. 117.Sh BUGS 118.Nm 119is considered experimental in 120.Fx . 121