xref: /freebsd/lib/libc/posix1e/acl.3 (revision 62bf35335508c6329e14e0385c9909737f8c1344)
1a889d1fbSRobert Watson.\"-
2963b8cdcSRobert Watson.\" Copyright (c) 2000, 2001, 2002 Robert N. M. Watson
3a889d1fbSRobert Watson.\" All rights reserved.
4a889d1fbSRobert Watson.\"
56394f703SRobert Watson.\" This software was developed by Robert Watson for the TrustedBSD Project.
66394f703SRobert Watson.\"
7a889d1fbSRobert Watson.\" Redistribution and use in source and binary forms, with or without
8a889d1fbSRobert Watson.\" modification, are permitted provided that the following conditions
9a889d1fbSRobert Watson.\" are met:
10a889d1fbSRobert Watson.\" 1. Redistributions of source code must retain the above copyright
11a889d1fbSRobert Watson.\"    notice, this list of conditions and the following disclaimer.
12a889d1fbSRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright
13a889d1fbSRobert Watson.\"    notice, this list of conditions and the following disclaimer in the
14a889d1fbSRobert Watson.\"    documentation and/or other materials provided with the distribution.
15a889d1fbSRobert Watson.\"
16a889d1fbSRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17a889d1fbSRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18a889d1fbSRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19a889d1fbSRobert Watson.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20a889d1fbSRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21a889d1fbSRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22a889d1fbSRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23a889d1fbSRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24a889d1fbSRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25a889d1fbSRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26a889d1fbSRobert Watson.\" SUCH DAMAGE.
27a889d1fbSRobert Watson.\"
28a889d1fbSRobert Watson.\" $FreeBSD$
29a889d1fbSRobert Watson.\"
30*62bf3533SEdward Tomasz Napierala.Dd October 30, 2014
31a889d1fbSRobert Watson.Dt ACL 3
32a307d598SRuslan Ermilov.Os
33a889d1fbSRobert Watson.Sh NAME
34c32381adSMike Pritchard.Nm acl
35*62bf3533SEdward Tomasz Napierala.Nd introduction to the POSIX.1e/NFSv4 ACL security API
36f75b050cSAlexey Zelkin.Sh LIBRARY
3731acc836SRuslan Ermilov.Lb libc
38a889d1fbSRobert Watson.Sh SYNOPSIS
3932eef9aeSRuslan Ermilov.In sys/types.h
4032eef9aeSRuslan Ermilov.In sys/acl.h
41a889d1fbSRobert Watson.Sh DESCRIPTION
42a21c3aa0SRobert Watson.Fx
43a21c3aa0SRobert Watsonpermits file systems to export Access Control Lists via the VFS, and
44a21c3aa0SRobert Watsonprovides a library for userland access to and manipulation of these ACLs.
45*62bf3533SEdward Tomasz Napierala.Fx
46*62bf3533SEdward Tomasz Napieralasupports POSIX.1e and NFSv4 ACLs, but
47*62bf3533SEdward Tomasz Napieralanot all file systems provide support for ACLs, and some may require that
4857bd0fc6SJens SchweikhardtACL support be explicitly enabled by the administrator.
49a21c3aa0SRobert WatsonThe library calls include routines to allocate, duplicate, retrieve, set,
50a21c3aa0SRobert Watsonand validate ACLs associated with file objects.
51a889d1fbSRobert WatsonAs well as the POSIX.1e routines, there are a number of non-portable
52*62bf3533SEdward Tomasz Napieralaextensions defined that allow for ACL semantics alternative to
53*62bf3533SEdward Tomasz NapieralaPOSIX.1e, such as NFSv4.
54a21c3aa0SRobert WatsonWhere routines are non-standard, they are suffixed with _np to indicate that
55a889d1fbSRobert Watsonthey are not portable.
5642635956SRuslan Ermilov.Pp
57a889d1fbSRobert WatsonPOSIX.1e describes a set of ACL manipulation routines to manage the
58a21c3aa0SRobert Watsoncontents of ACLs, as well as their relationships with files; almost
59a21c3aa0SRobert Watsonall of these support routines are implemented in
60a21c3aa0SRobert Watson.Fx .
6142635956SRuslan Ermilov.Pp
62a889d1fbSRobert WatsonAvailable functions, sorted by behavior, include:
63336ee39aSRuslan Ermilov.Bl -tag -width indent
64aa015c8eSEdward Tomasz Napierala.It Fn acl_add_flag_np
65aa015c8eSEdward Tomasz NapieralaThis function is described in
66aa015c8eSEdward Tomasz Napierala.Xr acl_add_flag_np 3 ,
67aa015c8eSEdward Tomasz Napieralaand may be used to add flags to a flagset.
68336ee39aSRuslan Ermilov.It Fn acl_add_perm
696822f9dfSChris D. FaulhaberThis function is described in
706822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 ,
716822f9dfSChris D. Faulhaberand may be used to add permissions to a permission set.
72336ee39aSRuslan Ermilov.It Fn acl_calc_mask
736822f9dfSChris D. FaulhaberThis function is described in
746822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 ,
756822f9dfSChris D. Faulhaberand may be used to calculate and set the permissions associated with
76336ee39aSRuslan Ermilovthe
77336ee39aSRuslan Ermilov.Dv ACL_MASK
78336ee39aSRuslan Ermiloventry.
79aa015c8eSEdward Tomasz Napierala.It Fn acl_clear_flags_np
80aa015c8eSEdward Tomasz NapieralaThis function is described in
81aa015c8eSEdward Tomasz Napierala.Xr acl_clear_flags_np 3 ,
82aa015c8eSEdward Tomasz Napieralaand may be used to clear all flags from a flagset.
83336ee39aSRuslan Ermilov.It Fn acl_clear_perms
846822f9dfSChris D. FaulhaberThis function is described in
856822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 ,
866822f9dfSChris D. Faulhaberand may be used to clear all permissions from a permission set.
87336ee39aSRuslan Ermilov.It Fn acl_copy_entry
886822f9dfSChris D. FaulhaberThis function is described in
896822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 ,
906822f9dfSChris D. Faulhaberand may be used to copy the contents of an ACL entry.
91aa015c8eSEdward Tomasz Napierala.It Xo
92aa015c8eSEdward Tomasz Napierala.Fn acl_create_entry ,
93aa015c8eSEdward Tomasz Napierala.Fn acl_create_entry_np
94aa015c8eSEdward Tomasz Napierala.Xc
95aa015c8eSEdward Tomasz NapieralaThese functions are described in
966822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 ,
976822f9dfSChris D. Faulhaberand may be used to create an empty entry in an ACL.
98336ee39aSRuslan Ermilov.It Xo
99a889d1fbSRobert Watson.Fn acl_delete_def_file ,
1006394f703SRobert Watson.Fn acl_delete_def_link_np ,
1016394f703SRobert Watson.Fn acl_delete_fd_np ,
102a889d1fbSRobert Watson.Fn acl_delete_file_np ,
1036394f703SRobert Watson.Fn acl_delete_link_np
104336ee39aSRuslan Ermilov.Xc
105a889d1fbSRobert WatsonThese functions are described in
106a889d1fbSRobert Watson.Xr acl_delete 3 ,
107a889d1fbSRobert Watsonand may be used to delete ACLs from file system objects.
108aa015c8eSEdward Tomasz Napierala.It Xo
109aa015c8eSEdward Tomasz Napierala.Fn acl_delete_entry ,
110aa015c8eSEdward Tomasz Napierala.Fn acl_delete_entry_np ,
111aa015c8eSEdward Tomasz Napierala.Xc
112aa015c8eSEdward Tomasz NapieralaThis functions are described in
1136822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 ,
1146822f9dfSChris D. Faulhaberand may be used to delete an entry from an ACL.
115aa015c8eSEdward Tomasz Napierala.It Fn acl_delete_flag_np
116aa015c8eSEdward Tomasz NapieralaThis function is described in
117aa015c8eSEdward Tomasz Napierala.Xr acl_delete_flag_np 3 ,
118aa015c8eSEdward Tomasz Napieralaand may be used to delete flags from a flagset.
119336ee39aSRuslan Ermilov.It Fn acl_delete_perm
1206822f9dfSChris D. FaulhaberThis function is described in
1216822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 ,
1226822f9dfSChris D. Faulhaberand may be used to delete permissions from a permset.
123336ee39aSRuslan Ermilov.It Fn acl_dup
1246822f9dfSChris D. FaulhaberThis function is described in
1256822f9dfSChris D. Faulhaber.Xr acl_dup 3 ,
1266822f9dfSChris D. Faulhaberand may be used to duplicate an ACL structure.
127336ee39aSRuslan Ermilov.It Fn acl_free
128a889d1fbSRobert WatsonThis function is described in
129a889d1fbSRobert Watson.Xr acl_free 3 ,
130a889d1fbSRobert Watsonand may be used to free userland working ACL storage.
131336ee39aSRuslan Ermilov.It Fn acl_from_text
132a889d1fbSRobert WatsonThis function is described in
133a889d1fbSRobert Watson.Xr acl_from_text 3 ,
134a889d1fbSRobert Watsonand may be used to convert a text-form ACL into working ACL state, if
135b372d0d8SEdward Tomasz Napieralathe ACL has POSIX.1e or NFSv4 semantics.
136ce157d5cSEdward Tomasz Napierala.It Fn acl_get_brand_np
137ce157d5cSEdward Tomasz NapieralaThis function is described in
138ce157d5cSEdward Tomasz Napierala.Xr acl_get_brand_np 3
139ce157d5cSEdward Tomasz Napieralaand may be used to determine whether the ACL has POSIX.1e or NFSv4 semantics.
14021aaa49cSChris D. Faulhaber.It Fn acl_get_entry
14121aaa49cSChris D. FaulhaberThis function is described in
14221aaa49cSChris D. Faulhaber.Xr acl_get_entry 3 ,
14321aaa49cSChris D. Faulhaberand may be used to retrieve a designated ACL entry from an ACL.
144336ee39aSRuslan Ermilov.It Xo
145a889d1fbSRobert Watson.Fn acl_get_fd ,
1466394f703SRobert Watson.Fn acl_get_fd_np ,
1476394f703SRobert Watson.Fn acl_get_file ,
1486394f703SRobert Watson.Fn acl_get_link_np
149336ee39aSRuslan Ermilov.Xc
150a889d1fbSRobert WatsonThese functions are described in
151a889d1fbSRobert Watson.Xr acl_get 3 ,
152a889d1fbSRobert Watsonand may be used to retrieve ACLs from file system objects.
153aa015c8eSEdward Tomasz Napierala.It Fn acl_get_entry_type_np
154aa015c8eSEdward Tomasz NapieralaThis function is described in
155aa015c8eSEdward Tomasz Napierala.Xr acl_get_entry_type_np 3 ,
156aa015c8eSEdward Tomasz Napieralaand may be used to retrieve an ACL type from an ACL entry.
157aa015c8eSEdward Tomasz Napierala.It Fn acl_get_flagset_np
158aa015c8eSEdward Tomasz NapieralaThis function is described in
159aa015c8eSEdward Tomasz Napierala.Xr acl_get_flagset_np 3 ,
160aa015c8eSEdward Tomasz Napieralaand may be used to retrieve a flagset from an ACL entry.
161336ee39aSRuslan Ermilov.It Fn acl_get_permset
1626822f9dfSChris D. FaulhaberThis function is described in
1636822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 ,
1646822f9dfSChris D. Faulhaberand may be used to retrieve a permset from an ACL entry.
165336ee39aSRuslan Ermilov.It Fn acl_get_qualifier
1666822f9dfSChris D. FaulhaberThis function is described in
1676822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 ,
1686822f9dfSChris D. Faulhaberand may be used to retrieve the qualifier from an ACL entry.
169336ee39aSRuslan Ermilov.It Fn acl_get_tag_type
1706822f9dfSChris D. FaulhaberThis function is described in
1716822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 ,
1726822f9dfSChris D. Faulhaberand may be used to retrieve the tag type from an ACL entry.
173336ee39aSRuslan Ermilov.It Fn acl_init
174a889d1fbSRobert WatsonThis function is described in
175a889d1fbSRobert Watson.Xr acl_init 3 ,
176a889d1fbSRobert Watsonand may be used to allocate a fresh (empty) ACL structure.
177aa015c8eSEdward Tomasz Napierala.It Fn acl_is_trivial_np
178aa015c8eSEdward Tomasz NapieralaThis function is described in
179aa015c8eSEdward Tomasz Napierala.Xr acl_is_trivial_np 3 ,
180aa015c8eSEdward Tomasz Napieralaand may be used to find out whether ACL is trivial.
181336ee39aSRuslan Ermilov.It Xo
182a889d1fbSRobert Watson.Fn acl_set_fd ,
1836394f703SRobert Watson.Fn acl_set_fd_np ,
1846394f703SRobert Watson.Fn acl_set_file ,
1856394f703SRobert Watson.Fn acl_set_link_np
186336ee39aSRuslan Ermilov.Xc
187c32381adSMike PritchardThese functions are described in
188a889d1fbSRobert Watson.Xr acl_set 3 ,
189a889d1fbSRobert Watsonand may be used to assign an ACL to a file system object.
190aa015c8eSEdward Tomasz Napierala.It Fn acl_set_entry_type_np
191aa015c8eSEdward Tomasz NapieralaThis function is described in
192aa015c8eSEdward Tomasz Napierala.Xr acl_set_entry_type_np 3 ,
193aa015c8eSEdward Tomasz Napieralaand may be used to set the ACL type of an ACL entry.
194aa015c8eSEdward Tomasz Napierala.It Fn acl_set_flagset_np
195aa015c8eSEdward Tomasz NapieralaThis function is described in
196aa015c8eSEdward Tomasz Napierala.Xr acl_set_flagset_np 3 ,
197aa015c8eSEdward Tomasz Napieralaand may be used to set the flags of an ACL entry from a flagset.
198336ee39aSRuslan Ermilov.It Fn acl_set_permset
1996822f9dfSChris D. FaulhaberThis function is described in
2006822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 ,
2016822f9dfSChris D. Faulhaberand may be used to set the permissions of an ACL entry from a permset.
202336ee39aSRuslan Ermilov.It Fn acl_set_qualifier
2036822f9dfSChris D. FaulhaberThis function is described in
2046822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 ,
2056822f9dfSChris D. Faulhaberand may be used to set the qualifier of an ACL.
206336ee39aSRuslan Ermilov.It Fn acl_set_tag_type
2076822f9dfSChris D. FaulhaberThis function is described in
2086822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 ,
2096822f9dfSChris D. Faulhaberand may be used to set the tag type of an ACL.
210aa015c8eSEdward Tomasz Napierala.It Fn acl_strip_np
211a889d1fbSRobert WatsonThis function is described in
212aa015c8eSEdward Tomasz Napierala.Xr acl-strip_np 3 ,
213aa015c8eSEdward Tomasz Napieralaand may be used to remove extended entries from an ACL.
214aa015c8eSEdward Tomasz Napierala.It Xo
215aa015c8eSEdward Tomasz Napierala.Fn acl_to_text ,
216aa015c8eSEdward Tomasz Napierala.Fn acl_to_text_np
217aa015c8eSEdward Tomasz Napierala.Xc
218aa015c8eSEdward Tomasz NapieralaThese functions are described in
219a889d1fbSRobert Watson.Xr acl_to_text 3 ,
220b372d0d8SEdward Tomasz Napieralaand may be used to generate a text-form of a POSIX.1e or NFSv4 semantics ACL.
221336ee39aSRuslan Ermilov.It Xo
222a889d1fbSRobert Watson.Fn acl_valid ,
2236394f703SRobert Watson.Fn acl_valid_fd_np ,
224a889d1fbSRobert Watson.Fn acl_valid_file_np ,
2256394f703SRobert Watson.Fn acl_valid_link_np
226336ee39aSRuslan Ermilov.Xc
227336ee39aSRuslan ErmilovThese functions are described in
228a889d1fbSRobert Watson.Xr acl_valid 3 ,
229a889d1fbSRobert Watsonand may be used to validate an ACL as correct POSIX.1e-semantics, or
230a889d1fbSRobert Watsonas appropriate for a particular file system object regardless of semantics.
231336ee39aSRuslan Ermilov.El
23242635956SRuslan Ermilov.Pp
233a889d1fbSRobert WatsonDocumentation of the internal kernel interfaces backing these calls may
234a889d1fbSRobert Watsonbe found in
235a889d1fbSRobert Watson.Xr acl 9 .
236a889d1fbSRobert WatsonThe syscalls between the internal interfaces and the public library
237a21c3aa0SRobert Watsonroutines may change over time, and as such are not documented.
238a21c3aa0SRobert WatsonThey are not intended to be called directly without going through the
239a21c3aa0SRobert Watsonlibrary.
2406822f9dfSChris D. Faulhaber.Sh SEE ALSO
241963b8cdcSRobert Watson.Xr getfacl 1 ,
242963b8cdcSRobert Watson.Xr setfacl 1 ,
243aa015c8eSEdward Tomasz Napierala.Xr acl_add_flag_np 3 ,
2446822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 ,
2456822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 ,
246aa015c8eSEdward Tomasz Napierala.Xr acl_clear_flags_np 3 ,
2476822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 ,
2486822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 ,
2496822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 ,
2506822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 ,
251aa015c8eSEdward Tomasz Napierala.Xr acl_delete_flag_np 3 ,
2526822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 ,
2536822f9dfSChris D. Faulhaber.Xr acl_dup 3 ,
2546822f9dfSChris D. Faulhaber.Xr acl_free 3 ,
2556822f9dfSChris D. Faulhaber.Xr acl_from_text 3 ,
2566822f9dfSChris D. Faulhaber.Xr acl_get 3 ,
257ce157d5cSEdward Tomasz Napierala.Xr acl_get_brand_np 3 ,
258aa015c8eSEdward Tomasz Napierala.Xr acl_get_entry_type_np 3 ,
259aa015c8eSEdward Tomasz Napierala.Xr acl_get_flagset_np 3 ,
2606822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 ,
2616822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 ,
2626822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 ,
2636822f9dfSChris D. Faulhaber.Xr acl_init 3 ,
264aa015c8eSEdward Tomasz Napierala.Xr acl_is_trivial_np 3 ,
2656822f9dfSChris D. Faulhaber.Xr acl_set 3 ,
266aa015c8eSEdward Tomasz Napierala.Xr acl_set_entry_type_np 3 ,
267aa015c8eSEdward Tomasz Napierala.Xr acl_set_flagset_np 3 ,
2686822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 ,
2696822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 ,
2706822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 ,
271aa015c8eSEdward Tomasz Napierala.Xr acl_strip_np 3 ,
2726822f9dfSChris D. Faulhaber.Xr acl_to_text 3 ,
2736822f9dfSChris D. Faulhaber.Xr acl_valid 3 ,
2745521ff5aSRuslan Ermilov.Xr posix1e 3 ,
2755521ff5aSRuslan Ermilov.Xr acl 9
2766822f9dfSChris D. Faulhaber.Sh STANDARDS
277a889d1fbSRobert WatsonPOSIX.1e assigns security labels to all objects, extending the security
278a21c3aa0SRobert Watsonfunctionality described in POSIX.1.
279a21c3aa0SRobert WatsonThese additional labels provide fine-grained discretionary access control,
280a21c3aa0SRobert Watsonfine-grained capabilities, and labels necessary for mandatory access
281a21c3aa0SRobert Watsoncontrol.
282a21c3aa0SRobert WatsonPOSIX.2c describes a set of userland utilities for manipulating these
283a21c3aa0SRobert Watsonlabels.
2846822f9dfSChris D. Faulhaber.Pp
285a21c3aa0SRobert WatsonPOSIX.1e is described in IEEE POSIX.1e draft 17.
286a21c3aa0SRobert WatsonDiscussion of the draft continues on the cross-platform POSIX.1e
287a21c3aa0SRobert Watsonimplementation mailing list.
288a21c3aa0SRobert WatsonTo join this list, see the
289c32381adSMike Pritchard.Fx
290a21c3aa0SRobert WatsonPOSIX.1e implementation page for more information.
291a889d1fbSRobert Watson.Sh HISTORY
292c32381adSMike PritchardPOSIX.1e support was introduced in
293a21c3aa0SRobert Watson.Fx 4.0 ;
294a21c3aa0SRobert Watson.Fx 5.0
295a21c3aa0SRobert Watsonwas the first version to include a complete ACL implementation based
296963b8cdcSRobert Watsonon extended attributes for the UFS and UFS2 file systems.
297*62bf3533SEdward Tomasz NapieralaNFSv4 ACL support was introduced in
298*62bf3533SEdward Tomasz Napierala.Fx 8.0 .
299963b8cdcSRobert Watson.Pp
300d6498251SPhilippe CharnierThe
301963b8cdcSRobert Watson.Xr getfacl 1
302963b8cdcSRobert Watsonand
303963b8cdcSRobert Watson.Xr setfacl 1
304d6498251SPhilippe Charnierutilities describe the user tools that permit direct manipulation of complete
305d6498251SPhilippe Charnierfile ACLs.
306a889d1fbSRobert Watson.Sh AUTHORS
307c32381adSMike Pritchard.An Robert N M Watson
308