2 .\" Copyright (c) 2008-2010 Robert N. M. Watson
3 .\" Copyright (c) 2012-2013 The FreeBSD Foundation
4 .\" All rights reserved.
6 .\" This software was developed at the University of Cambridge Computer
7 .\" Laboratory with support from a grant from Google, Inc.
9 .\" Portions of this documentation were written by Pawel Jakub Dawidek
10 .\" under sponsorship from the FreeBSD Foundation.
12 .\" Redistribution and use in source and binary forms, with or without
13 .\" modification, are permitted provided that the following conditions
15 .\" 1. Redistributions of source code must retain the above copyright
16 .\" notice, this list of conditions and the following disclaimer.
17 .\" 2. Redistributions in binary form must reproduce the above copyright
18 .\" notice, this list of conditions and the following disclaimer in the
19 .\" documentation and/or other materials provided with the distribution.
21 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 .Nd Capsicum capability rights for file descriptors
40 When a file descriptor is created by a function such as
54 it is assigned all capability rights.
55 Those rights can be reduced (but never expanded) by using the
56 .Xr cap_rights_limit 2 ,
57 .Xr cap_fcntls_limit 2 and
58 .Xr cap_ioctls_limit 2
60 Once capability rights are reduced, operations on the file descriptor will be
61 limited to those permitted by rights.
63 The complete list of capability rights is provided below.
66 type is used to store list of capability rights.
69 family of functions should be used to manage the structure.
71 The following rights may be specified in a rights mask:
72 .Bl -tag -width CAP_RENAMEAT_SOURCE
80 .Xr acl_valid_fd_np 3 .
83 .Xr acl_delete_fd_np 3 .
95 When not in capabilities mode, permit
104 Note that sockets can also become bound implicitly as a result of
108 and that socket options set with
110 may also affect binding behavior.
114 This right has to be present on the directory descriptor.
115 This right includes the
124 When not in capabilities mode, permit
133 This right is also required for
135 with a non-NULL destination address.
139 This right has to be present on the directory descriptor.
140 This right includes the
155 to be used in monitoring the file descriptor for events.
156 .It Dv CAP_EXTATTR_DELETE
158 .Xr extattr_delete_fd 2 .
159 .It Dv CAP_EXTATTR_GET
161 .Xr extattr_get_fd 2 .
162 .It Dv CAP_EXTATTR_LIST
164 .Xr extattr_list_fd 2 .
165 .It Dv CAP_EXTATTR_SET
167 .Xr extattr_set_fd 2 .
178 right is also present.
186 right is also present.
199 right is also present.
214 commands require this capability right.
215 Also note that the list of permitted commands can be further limited with the
216 .Xr cap_fcntls_limit 2
249 Permit UFS background-fsck operations on the descriptor.
257 right is also present.
297 right is also present.
303 .It Dv CAP_GETPEERNAME
306 .It Dv CAP_GETSOCKNAME
309 .It Dv CAP_GETSOCKOPT
315 Be aware that this system call has enormous scope, including potentially
316 global scope for some objects.
317 The list of permitted ioctl commands can be further limited with the
318 .Xr cap_ioctls_limit 2
322 .Dv CAP_KQUEUE_CHANGE
324 .Dv CAP_KQUEUE_EVENT .
325 .It Dv CAP_KQUEUE_CHANGE
330 descriptor that modifies list of monitored events (the
332 argument is non-NULL).
333 .It Dv CAP_KQUEUE_EVENT
338 descriptor that monitors events (the
340 argument is non-NULL).
342 is also required on file descriptors that will be monitored using
344 .It Dv CAP_LINKAT_SOURCE
347 on the source directory descriptor.
348 This right includes the
353 .Dv CAP_LINKAT_SOURCE
354 makes it possible to link files in a directory for which file
355 descriptors exist that have additional rights.
357 a file stored in a directory that does not allow
359 may be linked in another directory that does allow
361 thereby granting read access to a file that is otherwise unreadable.
362 .It Dv CAP_LINKAT_TARGET
365 on the target directory descriptor.
366 This right includes the
372 not much use (generally) without
375 Permit the file descriptor to be used as a starting directory for calls such as
389 This right includes the
395 This right includes the
401 This right includes the
416 This right includes the
443 This right includes the
459 This right includes the
499 is also required) and related system calls.
503 .It Dv CAP_RENAMEAT_SOURCE
506 on the source directory descriptor.
507 This right includes the
512 .Dv CAP_RENAMEAT_SOURCE
513 makes it possible to move files to a directory for which file
514 descriptors exist that have additional rights.
516 a file stored in a directory that does not allow
518 may be moved to another directory that does allow
520 thereby granting read access to a file that is otherwise unreadable.
521 .It Dv CAP_RENAMEAT_TARGET
524 on the target directory descriptor.
525 This right includes the
529 Permit operations that seek on the file descriptor, such as
531 but also required for I/O system calls that can read or write at any position
536 .It Dv CAP_SEM_GETVALUE
550 .It Dv CAP_SETSOCKOPT
553 this controls various aspects of socket behavior and may affect binding,
554 connecting, and other behaviors with global scope.
558 closing the socket will also generally shut down any connections on it.
562 This right includes the
566 Allow configuration of TTY hooks, such as
568 on the file descriptor.
574 This right is only required for
576 on the destination directory descriptor if the destination object already
577 exists and will be removed by the rename.
578 This right includes the
597 and related system calls.
600 with a non-NULL connection address,
607 flag, but without the
629 .Xr cap_fcntls_limit 2 ,
630 .Xr cap_ioctls_limit 2 ,
631 .Xr cap_rights_limit 2 ,
635 .Xr extattr_delete_fd 2 ,
636 .Xr extattr_get_fd 2 ,
637 .Xr extattr_list_fd 2 ,
638 .Xr extattr_set_fd 2 ,
697 .Xr acl_delete_fd_np 3 ,
699 .Xr acl_get_fd_np 3 ,
701 .Xr acl_set_fd_np 3 ,
702 .Xr acl_valid_fd_np 3 ,
712 Support for capabilities and capabilities mode was developed as part of the
717 This manual page was created by
718 .An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
719 under sponsorship from the FreeBSD Foundation based on the
722 .An Robert Watson Aq Mt rwatson@FreeBSD.org .