xref: /dflybsd-src/lib/libc/sys/syscap_get.2 (revision 2b3f93ea6d1f70880f3e87f3c2cbe0dc0bfc9332)
1*2b3f93eaSMatthew Dillon.\" Copyright (c) 2023 The DragonFly Project.  All rights reserved.
2*2b3f93eaSMatthew Dillon.\"
3*2b3f93eaSMatthew Dillon.\" This code is derived from software contributed to The DragonFly Project
4*2b3f93eaSMatthew Dillon.\" by Matthew Dillon <dillon@backplane.com>
5*2b3f93eaSMatthew Dillon.\"
6*2b3f93eaSMatthew Dillon.\" Redistribution and use in source and binary forms, with or without
7*2b3f93eaSMatthew Dillon.\" modification, are permitted provided that the following conditions
8*2b3f93eaSMatthew Dillon.\" are met:
9*2b3f93eaSMatthew Dillon.\"
10*2b3f93eaSMatthew Dillon.\" 1. Redistributions of source code must retain the above copyright
11*2b3f93eaSMatthew Dillon.\"    notice, this list of conditions and the following disclaimer.
12*2b3f93eaSMatthew Dillon.\" 2. Redistributions in binary form must reproduce the above copyright
13*2b3f93eaSMatthew Dillon.\"    notice, this list of conditions and the following disclaimer in
14*2b3f93eaSMatthew Dillon.\"    the documentation and/or other materials provided with the
15*2b3f93eaSMatthew Dillon.\"    distribution.
16*2b3f93eaSMatthew Dillon.\" 3. Neither the name of The DragonFly Project nor the names of its
17*2b3f93eaSMatthew Dillon.\"    contributors may be used to endorse or promote products derived
18*2b3f93eaSMatthew Dillon.\"    from this software without specific, prior written permission.
19*2b3f93eaSMatthew Dillon.\"
20*2b3f93eaSMatthew Dillon.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21*2b3f93eaSMatthew Dillon.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*2b3f93eaSMatthew Dillon.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*2b3f93eaSMatthew Dillon.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
24*2b3f93eaSMatthew Dillon.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*2b3f93eaSMatthew Dillon.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*2b3f93eaSMatthew Dillon.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27*2b3f93eaSMatthew Dillon.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*2b3f93eaSMatthew Dillon.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*2b3f93eaSMatthew Dillon.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30*2b3f93eaSMatthew Dillon.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*2b3f93eaSMatthew Dillon.\" SUCH DAMAGE.
32*2b3f93eaSMatthew Dillon.\"
33*2b3f93eaSMatthew Dillon.Dd October 11, 2023
34*2b3f93eaSMatthew Dillon.Dt syscap_get 2
35*2b3f93eaSMatthew Dillon.Os
36*2b3f93eaSMatthew Dillon.Sh NAME
37*2b3f93eaSMatthew Dillon.Nm syscap_get ,
38*2b3f93eaSMatthew Dillon.Nm syscap_set
39*2b3f93eaSMatthew Dillon.Nd Get and set a capability restriction
40*2b3f93eaSMatthew Dillon.Sh LIBRARY
41*2b3f93eaSMatthew Dillon.Lb libc
42*2b3f93eaSMatthew Dillon.Sh SYNOPSIS
43*2b3f93eaSMatthew Dillon.In sys/caps.h
44*2b3f93eaSMatthew Dillon.Ft int
45*2b3f93eaSMatthew Dillon.Fn syscap_get "int cap" "void *data" "size_t bytes"
46*2b3f93eaSMatthew Dillon.Ft int
47*2b3f93eaSMatthew Dillon.Fn syscap_set "int cap" "int flags" "void *data" "size_t bytes"
48*2b3f93eaSMatthew Dillon.Sh DESCRIPTION
49*2b3f93eaSMatthew DillonThe
50*2b3f93eaSMatthew Dillon.Fn syscap_get
51*2b3f93eaSMatthew Dillonfunction returns the current flags for the requested capability.
52*2b3f93eaSMatthew Dillon.Pp
53*2b3f93eaSMatthew DillonThe
54*2b3f93eaSMatthew Dillon.Fn syscap_set
55*2b3f93eaSMatthew Dillonfunction add the specified flags to the restrictions applied to a
56*2b3f93eaSMatthew Dillonspecific capability for the current process.
57*2b3f93eaSMatthew DillonThe flags are bitwise ORd into the capability.
58*2b3f93eaSMatthew DillonCapability restrictions cannot be removed once set.
59*2b3f93eaSMatthew Dillon.Sh GENERAL
60*2b3f93eaSMatthew DillonCapability restrictions mostly apply to the root user.  Capability
61*2b3f93eaSMatthew Dillonrestrictions are grouped in sets of 16.  Group 0 restrictions
62*2b3f93eaSMatthew Dillonalso restrict all capabilities in group N.  For example, the
63*2b3f93eaSMatthew DillonSYSCAP_RESTRICTEDROOT capability (group 0 capability 1) also
64*2b3f93eaSMatthew Dillonrestricts all capabilities in group 1.
65*2b3f93eaSMatthew Dillon.Pp
66*2b3f93eaSMatthew DillonCapabillities are applied to the current process or its parent process.
67*2b3f93eaSMatthew DillonAll threads in a process share the same capabilities.
68*2b3f93eaSMatthew Dillon.Pp
69*2b3f93eaSMatthew DillonOne can create a relatively (but not completely) secure root environment
70*2b3f93eaSMatthew Dillonwithout jails by combining numerous capability restrictions with a chrooted
71*2b3f93eaSMatthew Dillonenvironment into a filesystem topology constructed from null mounts and
72*2b3f93eaSMatthew Dillontmpfs mounts.  The following capabilities are commonly employed when
73*2b3f93eaSMatthew Dilloncreating such environments: SYSCAP_RESTRICTEDROOT, SYSCAP_SENSITIVEROOT,
74*2b3f93eaSMatthew DillonSYSCAP_NONET_SENSITIVE, SYSCAP_NOVFS_SENSITIVE, SYSCAP_NOMOUNT, and
75*2b3f93eaSMatthew Dillonpossibly also SYSCAP_NOEXEC_SUID and SYSCAP_NOEXEC_SGID.
76*2b3f93eaSMatthew Dillon.Pp
77*2b3f93eaSMatthew Dillon.Sh GROUP 0 CAPABILITIES (also disable their related sub-groups)
78*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
79*2b3f93eaSMatthew Dillon.It Dv SYSCAP_ANY
80*2b3f93eaSMatthew DillonReturns flags that are a wire-or of all other capabilities, indicating that
81*2b3f93eaSMatthew Dillonsome mucking around with capabilities was done.  Generally not explicitly set.
82*2b3f93eaSMatthew Dillon.It Dv SYSCAP_RESTRICTEDROOT
83*2b3f93eaSMatthew DillonRestricts all group 1 capabilities.  These are capabililties which most
84*2b3f93eaSMatthew Dillonroot-run programs should never need to use.
85*2b3f93eaSMatthew Dillon.Pp
86*2b3f93eaSMatthew DillonMost modifying root operations not available as separate capabilities
87*2b3f93eaSMatthew Dillonare also restricted by this capability.
88*2b3f93eaSMatthew Dillon.It Dv SYSCAP_SENSITIVEROOT
89*2b3f93eaSMatthew DillonRestrict all group 2 capabilities.  These are capabilities that most
90*2b3f93eaSMatthew Dillonroot-run scripts probably don't need.
91*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOEXEC
92*2b3f93eaSMatthew DillonRestricts ALL exec*() system calls, including the ones in group 3.
93*2b3f93eaSMatthew DillonHowever, it is generally not a good idea to prevent execs entirely except
94*2b3f93eaSMatthew Dillonin the depths of a well controlled program.
95*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED
96*2b3f93eaSMatthew DillonRestrict all cred system calls, such as setuid() that are otherwise not
97*2b3f93eaSMatthew Dillongenerally restricted by RESTRICTEDROOT.  These are capabilities that most
98*2b3f93eaSMatthew Dillonroot run scripts do not need to use unless they are messing around
99*2b3f93eaSMatthew Dillonwith pty's and terminal emulation.
100*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOJAIL
101*2b3f93eaSMatthew DillonRestrict all jail related system calls.
102*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET
103*2b3f93eaSMatthew DillonRestrict all network related system calls (if you also do NONET_SENSITIVE in
104*2b3f93eaSMatthew Dillonaddition to this one), generally preventing the use of reserved ports or
105*2b3f93eaSMatthew Dillonraw sockets.  Note that numerous applications use reserved ports.
106*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET_SENSITIVE
107*2b3f93eaSMatthew DillonRestrict all sensitive network related system calls such as ifconfig, packet
108*2b3f93eaSMatthew Dillonfilter, and other related operations that most programs and scripts do not
109*2b3f93eaSMatthew Dillonneed to mess with.
110*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS
111*2b3f93eaSMatthew DillonRestrict all vfs related system calls (if you also do NOVFS_SENSITIVE in
112*2b3f93eaSMatthew Dillonaddition to this one), generally only allowing basic file open,
113*2b3f93eaSMatthew Dillonclose, read, and write, and disallowing things like chown, chmod, chroot,
114*2b3f93eaSMatthew Dillonand so forth.
115*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_SENSITIVE
116*2b3f93eaSMatthew DillonRestrict all sensitive vfs related system calls such as mknod and filesystem
117*2b3f93eaSMatthew Dilloncontrol ioctls.
118*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOMOUNT
119*2b3f93eaSMatthew DillonRestrict all mount and umount operations.  This can be combined with a
120*2b3f93eaSMatthew Dillonchrooted environment to create secure filesystem topologies.  Read-only
121*2b3f93eaSMatthew Dillonnull mounts are a very powerful tool for creating such environments
122*2b3f93eaSMatthew Dilloncheaply.
123*2b3f93eaSMatthew Dillon.El
124*2b3f93eaSMatthew Dillon.Sh GROUP 1 CAPABILITIES (ALSO DISABLED BY SYSCAP_RESTRICTEDROOT)
125*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
126*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NODRIVER
127*2b3f93eaSMatthew DillonRestrict most driver-related ioctls.
128*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVM_MLOCK
129*2b3f93eaSMatthew DillonRestrict mlock() calls.
130*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVM_RESIDENT
131*2b3f93eaSMatthew DillonRestrict access to mechanisms which cache already-relocated dynamic
132*2b3f93eaSMatthew Dillonbinaries in memory.
133*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCPUCTL_WRMSR
134*2b3f93eaSMatthew DillonRestrict access to CPUCTL_WRMSR (cpu control registers).
135*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCPUCTL_UPDATE
136*2b3f93eaSMatthew DillonRestrict access to CPUCTL_UPDATE (cpu control registers).
137*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOACCT
138*2b3f93eaSMatthew DillonRestrict access to the acct() system call.
139*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOKENV_WR
140*2b3f93eaSMatthew DillonRestrict the ability to write to the kernel environment table.
141*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOKLD
142*2b3f93eaSMatthew DillonDisallow kldload, kldunload, and device firmware loading.
143*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOKERN_WR
144*2b3f93eaSMatthew DillonDisallow general modifications to kernel space (these are mostly
145*2b3f93eaSMatthew Dilloncovered by the over-arching RESTRICTEDROOT capability).
146*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOREBOOT
147*2b3f93eaSMatthew DillonDisallow rebooting and also disallow signaling process 1.
148*2b3f93eaSMatthew Dillon.El
149*2b3f93eaSMatthew Dillon.Sh GROUP 2 CAPABILITIES (ALSO DISABLED BY SYSCAP_SENSITIVEROOT)
150*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
151*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOPROC_TRESPASS
152*2b3f93eaSMatthew DillonDo not allow cross-uid process signaling beyond simple uid checks.
153*2b3f93eaSMatthew Dillonuid 0 can still signal non-uid-0 processes as long as SYSCAP_RESTRICTEDROOT
154*2b3f93eaSMatthew Dillonis active for those processes.
155*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOPROC_SETLOGIN
156*2b3f93eaSMatthew DillonDisallow use of the setlogin() system call.
157*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOPROC_SETRLIMIT
158*2b3f93eaSMatthew DillonDo not allow root to raise process resource limits.
159*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOSYSCTL_WR
160*2b3f93eaSMatthew DillonDo not allow modifying global sysctl() calls.
161*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVARSYM_SYS
162*2b3f93eaSMatthew DillonDo not allow modifying system-level varsym operations.
163*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOSETHOSTNAME
164*2b3f93eaSMatthew DillonDisallow use of the sethostname() system call.
165*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOQUOTA_WR
166*2b3f93eaSMatthew DillonDisallow use of all modifying filesystem quota operations.
167*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NODEBUG_UNPRIV
168*2b3f93eaSMatthew DillonDo not allow the debugger to be entered via sysctl or root access
169*2b3f93eaSMatthew Dillonvia procfs.
170*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOSETTIME
171*2b3f93eaSMatthew DillonDo not allow the system time to be set or adjusted.
172*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOSCHED
173*2b3f93eaSMatthew DillonDo not allow the system scheduler to be changed, rtprio, or
174*2b3f93eaSMatthew Dillonpriority raising.
175*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOSCHED_CPUSET
176*2b3f93eaSMatthew DillonDo not allow the cpuset to be restricted via scheduler calls.
177*2b3f93eaSMatthew Dillon.El
178*2b3f93eaSMatthew Dillon.Sh GROUP 3 CAPABILITIES (ALSO DISABLED BY SYSCAP_NOEXEC)
179*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
180*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOEXEC_SUID
181*2b3f93eaSMatthew DillonDo not allow suid execs.
182*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOEXEC_SGID
183*2b3f93eaSMatthew DillonDo not allow sgid execs.
184*2b3f93eaSMatthew Dillon.El
185*2b3f93eaSMatthew Dillon.Sh GROUP 4 CAPABILITIES (ALSO DISABLED BY SYSCAP_NOCRED)
186*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
187*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED_SETUID
188*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED_SETGID
189*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED_SETEUID
190*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED_SETEGID
191*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED_SETREUID
192*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED_SETREGID
193*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED_SETRESUID
194*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED_SETRESGID
195*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOCRED_SETGROUPS
196*2b3f93eaSMatthew DillonDo not allow various cred related system calls.
197*2b3f93eaSMatthew Dillon.El
198*2b3f93eaSMatthew Dillon.Sh GROUP 5 CAPABILITIES (ALSO DISABLED BY SYSCAP_NOJAIL)
199*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
200*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOJAIL_CREATE
201*2b3f93eaSMatthew DillonDo not allow jail creates.
202*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOJAIL_ATTACH
203*2b3f93eaSMatthew DillonDo not allow jail attachments.
204*2b3f93eaSMatthew Dillon.El
205*2b3f93eaSMatthew Dillon.Sh GROUP 6 CAPABILITIES (ALSO DISABLED BY SYSCAP_NONET)
206*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
207*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET_RESPORT
208*2b3f93eaSMatthew DillonDo not allow ports in the reserved ranges to be bound.
209*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET_RAW
210*2b3f93eaSMatthew DillonDo not allow use of raw sockets.
211*2b3f93eaSMatthew Dillon.El
212*2b3f93eaSMatthew Dillon.Sh GROUP 7 CAPABILITIES (ALSO DISABLED BY SYSCAP_NONET_SENSITIVE)
213*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
214*2b3f93eaSMatthew Dillon
215*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET_IFCONFIG
216*2b3f93eaSMatthew DillonDo not allow modifications to NICs via ifconfig.
217*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET_ROUTE
218*2b3f93eaSMatthew DillonDo not allow modifications to the route table (not implemented yet).
219*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET_LAGG
220*2b3f93eaSMatthew DillonDo not allow modifications to LAGG interfaces.
221*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET_NETGRAPH
222*2b3f93eaSMatthew DillonDo not allow modifying netgraph operations.
223*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET_BT_RAW
224*2b3f93eaSMatthew DillonDo not allow raw bluetooth operations.
225*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NONET_WIFI
226*2b3f93eaSMatthew DillonDo not allow wifi related device ioctls.
227*2b3f93eaSMatthew Dillon.El
228*2b3f93eaSMatthew Dillon.Sh GROUP 8 CAPABILITIES (ALSO DISABLED BY SYSCAP_NOVFS)
229*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
230*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_SYSFLAGS
231*2b3f93eaSMatthew DillonDo not allow chflags on files not owned by the user even if modes
232*2b3f93eaSMatthew Dillonor group allow such operations.
233*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_CHOWN
234*2b3f93eaSMatthew DillonDo not allow chown operations on files.
235*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_CHMOD
236*2b3f93eaSMatthew DillonDo not allow chmod operations on files.
237*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_LINK
238*2b3f93eaSMatthew DillonDo not allow hard links.
239*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_CHFLAGS_DEV
240*2b3f93eaSMatthew DillonDo not allow chflags on device nodes.
241*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_SETATTR
242*2b3f93eaSMatthew DillonIf set, prevents most file attribute changes.  This should be used only
243*2b3f93eaSMatthew Dillonby programs who know for damn sure that none of the library calls they
244*2b3f93eaSMatthew Dillonmake depend on chflags, chmod(), and other file related functions
245*2b3f93eaSMatthew Dillon(obsolete).
246*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_SETGID
247*2b3f93eaSMatthew DillonIf set, clears SGID during certain file operations in UFS (obsolete).
248*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_GENERATION
249*2b3f93eaSMatthew DillonFile generation number will be reported as 0 in *stat() calls.
250*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_RETAINSUGID
251*2b3f93eaSMatthew DillonIf restricted, SUID and SGID bits are cleared when a file is written to.
252*2b3f93eaSMatthew DillonOtherwise normal unix operation is to not clear the bits.
253*2b3f93eaSMatthew Dillon.El
254*2b3f93eaSMatthew Dillon.Sh GROUP 9 CAPABILITIES (ALSO DISABLED BY SYSCAP_NOVFS_SENSITIVE)
255*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
256*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_MKNOD_BAD
257*2b3f93eaSMatthew DillonDo not allow mknod() to create bad entries.
258*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_MKNOD_WHT
259*2b3f93eaSMatthew DillonDo not allow mknod() to create whitespace entries.
260*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_MKNOD_DIR
261*2b3f93eaSMatthew DillonDo not allow mknod() to create directories.
262*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_MKNOD_DEV
263*2b3f93eaSMatthew DillonDo not allow mknod() to create devices.
264*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_IOCTL
265*2b3f93eaSMatthew DillonDisallow use of sensitive filesystem related ioctls().
266*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_CHROOT
267*2b3f93eaSMatthew DillonDisallow use of the chroot() system call.
268*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOVFS_REVOKE
269*2b3f93eaSMatthew DillonDisallow use of the revoke() system call.
270*2b3f93eaSMatthew Dillon.El
271*2b3f93eaSMatthew Dillon.Sh GROUP 10 CAPABILITIES (ALSO DISABLED BY SYSCAP_NOMOUNT)
272*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
273*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOMOUNT_NULLFS
274*2b3f93eaSMatthew DillonDisallow nullfs mounts.
275*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOMOUNT_DEVFS
276*2b3f93eaSMatthew DillonDisallow devfs mounts.
277*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOMOUNT_TMPFS
278*2b3f93eaSMatthew DillonDisallow tmpfs mounts.
279*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOMOUNT_UMOUNT
280*2b3f93eaSMatthew DillonDisallow unmounts.
281*2b3f93eaSMatthew Dillon.It Dv SYSCAP_NOMOUNT_FUSE
282*2b3f93eaSMatthew DillonDisallow fuse mounts and unmounts.
283*2b3f93eaSMatthew Dillon.El
284*2b3f93eaSMatthew Dillon.Sh CAPABILITY DIRECTOR FLAGS (or'd with cap, not the flags)
285*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
286*2b3f93eaSMatthew Dillon.It Dv __SYSCAP_INPARENT
287*2b3f93eaSMatthew DillonAdjusts the capability in the parent process of the calling process.
288*2b3f93eaSMatthew DillonIf not specified, the capability in the calling process is adjusted.
289*2b3f93eaSMatthew DillonThe parent process must be in the same jail and have the same uid.
290*2b3f93eaSMatthew Dillon.El
291*2b3f93eaSMatthew Dillon.Sh FLAGS (flags argument)
292*2b3f93eaSMatthew Dillon.Bl -tag -width Dv
293*2b3f93eaSMatthew Dillon.It Dv __SYSCAP_SELF
294*2b3f93eaSMatthew DillonA bit mask indicating the restriction is applied to the calling process
295*2b3f93eaSMatthew Dillon(or parent process if the capabliity is directed to __SYSCAP_INPARENT ),
296*2b3f93eaSMatthew Dillonincluding process fork()s.
297*2b3f93eaSMatthew Dillon.It Dv __SYSCAP_EXEC
298*2b3f93eaSMatthew DillonA bit mask indicating the restriction is applied to any exec performed
299*2b3f93eaSMatthew Dillonby the process.   This bit is shifted into the __SYSCAP_SELF bit upon a
300*2b3f93eaSMatthew Dillonsuccessful exec*().  The __SYSCAP_EXEC bit is retained so all deeper
301*2b3f93eaSMatthew Dillonapplications will wind up with both bits set.
302*2b3f93eaSMatthew Dillon.It Dv __SYSCAP_ALL
303*2b3f93eaSMatthew DillonA multi-bit mask that covers both SELF and EXEC
304*2b3f93eaSMatthew Dillon.El
305*2b3f93eaSMatthew Dillon.Sh ERRORS
306*2b3f93eaSMatthew DillonThese functions return the current or post-modified capability flags
307*2b3f93eaSMatthew Dillonfor the specified capability, or returns -1 with errno set as follows.
308*2b3f93eaSMatthew Dillon.Bl -tag -width Er
309*2b3f93eaSMatthew Dillon.It Bq Er EOPNOTSUPP
310*2b3f93eaSMatthew DillonThe requested capability does not exist or is not supported.
311*2b3f93eaSMatthew Dillon.It Bq Er EINVAL
312*2b3f93eaSMatthew DillonAn invalid parameter was passed.  This can be an illegal flag,
313*2b3f93eaSMatthew Dillonimproper pointer, unsupported structure size, or unsupported
314*2b3f93eaSMatthew Dilloncontent that is not otherwise ignored by the system.
315*2b3f93eaSMatthew Dillon.El
316*2b3f93eaSMatthew Dillon.Sh SEE ALSO
317*2b3f93eaSMatthew Dillon.Xr syscap_set 2
318*2b3f93eaSMatthew Dillon.Sh HISTORY
319*2b3f93eaSMatthew DillonThe
320*2b3f93eaSMatthew Dillon.Fn syscap_get
321*2b3f93eaSMatthew Dillonand
322*2b3f93eaSMatthew Dillon.Fn syscap_set
323*2b3f93eaSMatthew Dillonfunctions first appeared in
324*2b3f93eaSMatthew Dillon.Dx 6.5 .
325