2011-11-27 20:44:15 +01:00
|
|
|
.\"
|
2013-08-28 21:49:32 +02:00
|
|
|
.\" Copyright (c) 2011, 2013 Robert N. M. Watson
|
2011-11-27 20:44:15 +01:00
|
|
|
.\" Copyright (c) 2011 Jonathan Anderson
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2017-05-24 02:58:30 +02:00
|
|
|
.Dd May 18, 2017
|
2011-11-27 20:44:15 +01:00
|
|
|
.Dt CAPSICUM 4
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm Capsicum
|
|
|
|
.Nd lightweight OS capability and sandbox framework
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Cd "options CAPABILITY_MODE"
|
|
|
|
.Cd "options CAPABILITIES"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
|
|
|
is a lightweight OS capability and sandbox framework implementing a hybrid
|
|
|
|
capability system model.
|
|
|
|
.Nm
|
|
|
|
can be used 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.
|
|
|
|
.Pp
|
|
|
|
.Nm
|
|
|
|
provides two core kernel primitives:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It capability mode
|
|
|
|
A process mode, entered by invoking
|
|
|
|
.Xr 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.
|
2012-05-12 05:25:46 +02:00
|
|
|
Once set, the flag is inherited by future children processes, and may not be
|
2011-11-27 20:44:15 +01:00
|
|
|
cleared.
|
|
|
|
.It capabilities
|
2013-11-04 15:10:22 +01:00
|
|
|
Limit operations that can be called on file descriptors.
|
|
|
|
For example, a file descriptor returned by
|
2011-11-27 20:44:15 +01:00
|
|
|
.Xr open 2
|
|
|
|
may be refined using
|
2013-09-19 12:56:36 +02:00
|
|
|
.Xr cap_rights_limit 2
|
2011-11-27 20:44:15 +01:00
|
|
|
so that only
|
|
|
|
.Xr read 2
|
|
|
|
and
|
|
|
|
.Xr write 2
|
|
|
|
can be called, but not
|
|
|
|
.Xr fchmod 2 .
|
2013-11-04 15:10:22 +01:00
|
|
|
The complete list of the capability rights can be found in the
|
|
|
|
.Xr rights 4
|
|
|
|
manual page.
|
2011-11-27 20:44:15 +01:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
In some cases,
|
|
|
|
.Nm
|
|
|
|
requires use of alternatives to traditional POSIX APIs in order to name
|
|
|
|
objects using capabilities rather than global namespaces:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It process descriptors
|
|
|
|
File descriptors representing processes, allowing parent processes to manage
|
2013-08-28 21:49:32 +02:00
|
|
|
child processes without requiring access to the PID namespace; described in
|
|
|
|
greater detail in
|
|
|
|
.Xr procdesc 4 .
|
2011-11-27 20:44:15 +01:00
|
|
|
.It anonymous shared memory
|
|
|
|
An extension to the POSIX shared memory API to support anonymous swap objects
|
2013-08-28 21:49:32 +02:00
|
|
|
associated with file descriptors; described in greater detail in
|
|
|
|
.Xr shm_open 2 .
|
2011-11-27 20:44:15 +01:00
|
|
|
.El
|
2017-05-24 02:58:30 +02:00
|
|
|
.Pp
|
|
|
|
In some cases,
|
|
|
|
.Nm
|
|
|
|
limits the valid values of some parameters to traditional APIs in order to
|
|
|
|
restrict access to global namespaces:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It process IDs
|
|
|
|
Processes can only act upon their own process ID with syscalls such as
|
|
|
|
.Xr cpuset_setaffinity 2 .
|
|
|
|
.El
|
2011-11-27 20:44:15 +01:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr cap_enter 2 ,
|
2013-11-04 15:10:22 +01:00
|
|
|
.Xr cap_fcntls_limit 2 ,
|
2011-11-27 20:44:15 +01:00
|
|
|
.Xr cap_getmode 2 ,
|
2013-11-04 15:10:22 +01:00
|
|
|
.Xr cap_ioctls_limit 2 ,
|
2013-09-19 12:56:36 +02:00
|
|
|
.Xr cap_rights_limit 2 ,
|
2011-11-27 20:44:15 +01:00
|
|
|
.Xr fchmod 2 ,
|
|
|
|
.Xr open 2 ,
|
|
|
|
.Xr pdfork 2 ,
|
|
|
|
.Xr pdgetpid 2 ,
|
|
|
|
.Xr pdkill 2 ,
|
|
|
|
.Xr pdwait4 2 ,
|
|
|
|
.Xr read 2 ,
|
|
|
|
.Xr shm_open 2 ,
|
2013-08-28 21:49:32 +02:00
|
|
|
.Xr write 2 ,
|
2013-11-04 15:10:22 +01:00
|
|
|
.Xr cap_rights_get 3 ,
|
2016-07-06 01:03:57 +02:00
|
|
|
.Xr libcasper 3 ,
|
2016-03-31 17:16:22 +02:00
|
|
|
.Xr procdesc 4
|
2011-11-27 20:44:15 +01:00
|
|
|
.Sh HISTORY
|
|
|
|
.Nm
|
|
|
|
first appeared in
|
|
|
|
.Fx 9.0 ,
|
|
|
|
and was developed at the University of Cambridge.
|
|
|
|
.Sh AUTHORS
|
|
|
|
.Nm
|
|
|
|
was developed by
|
|
|
|
.An -nosplit
|
2014-06-26 23:46:14 +02:00
|
|
|
.An Robert Watson Aq Mt rwatson@FreeBSD.org
|
2011-11-27 20:44:15 +01:00
|
|
|
and
|
2014-06-26 23:46:14 +02:00
|
|
|
.An Jonathan Anderson Aq Mt jonathan@FreeBSD.org
|
2011-11-27 20:44:15 +01:00
|
|
|
at the University of Cambridge, and
|
2014-06-26 23:46:14 +02:00
|
|
|
.An Ben Laurie Aq Mt benl@FreeBSD.org
|
2011-11-27 20:44:15 +01:00
|
|
|
and
|
2014-06-26 23:46:14 +02:00
|
|
|
.An Kris Kennaway Aq Mt kris@FreeBSD.org
|
2013-11-04 15:10:22 +01:00
|
|
|
at Google, Inc., and
|
2014-06-26 23:46:14 +02:00
|
|
|
.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net .
|