]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - usr.sbin/ugidfw/ugidfw.8
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / usr.sbin / ugidfw / ugidfw.8
1 .\" Copyright (c) 2002, 2004 Networks Associates Technology, Inc.
2 .\" All rights reserved.
3 .\"
4 .\" This software was developed for the FreeBSD Project by Chris
5 .\" Costello at Safeport Network Services and NAI Labs, the Security
6 .\" Research Division of Network Associates, Inc. under DARPA/SPAWAR
7 .\" contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
8 .\" research program.
9 .\"
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
12 .\" are met:
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\"    notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\"    notice, this list of conditions and the following disclaimer in the
17 .\"    documentation and/or other materials provided with the distribution.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .\" $FreeBSD$
32 .\"
33 .Dd February 24, 2004
34 .Dt UGIDFW 8
35 .Os
36 .Sh NAME
37 .Nm ugidfw
38 .Nd "firewall-like access controls for file system objects"
39 .Sh SYNOPSIS
40 .Nm
41 .Cm add
42 .Cm subject
43 .Op Cm not
44 .Oo
45 .Op Cm \&!
46 .Cm uid Ar uid | minuid:maxuid
47 .Oc
48 .Oo
49 .Op Cm \&!
50 .Cm gid Ar gid | mingid:maxgid
51 .Oc
52 .Oo
53 .Op Cm \&!
54 .Cm jailid Ad jailid
55 .Oc
56 .Cm object
57 .Op Cm not
58 .Oo
59 .Op Cm \&!
60 .Cm uid Ar uid | minuid:maxuid
61 .Oc
62 .Oo
63 .Op Cm \&!
64 .Cm gid Ar gid | mingid:maxgid
65 .Oc
66 .Oo
67 .Op Cm \&!
68 .Cm filesys Ad path
69 .Oc
70 .Oo
71 .Op Cm \&!
72 .Cm suid
73 .Oc
74 .Oo
75 .Op Cm \&!
76 .Cm sgid
77 .Oc
78 .Oo
79 .Op Cm \&!
80 .Cm uid_of_subject
81 .Oc
82 .Oo
83 .Op Cm \&!
84 .Cm gid_of_subject
85 .Oc
86 .Oo
87 .Op Cm \&!
88 .Cm type Ar ardbclsp
89 .Oc
90 .Cm mode
91 .Ar arswxn
92 .Nm
93 .Cm list
94 .Nm
95 .Cm set
96 .Ar rulenum
97 .Cm subject
98 .Op Cm not
99 .Oo
100 .Op Cm \&!
101 .Cm uid Ar uid | minuid:maxuid
102 .Oc
103 .Oo
104 .Op Cm \&!
105 .Cm gid Ar gid | mingid:maxgid
106 .Oc
107 .Oo
108 .Op Cm \&!
109 .Cm jailid Ad jailid
110 .Oc
111 .Cm object
112 .Op Cm not
113 .Oo
114 .Op Cm \&!
115 .Cm uid Ar uid | minuid:maxuid
116 .Oc
117 .Oo
118 .Op Cm \&!
119 .Cm gid Ar gid | mingid:maxgid
120 .Oc
121 .Oo
122 .Op Cm \&!
123 .Cm filesys Ad path
124 .Oc
125 .Oo
126 .Op Cm \&!
127 .Cm suid
128 .Oc
129 .Oo
130 .Op Cm \&!
131 .Cm sgid
132 .Oc
133 .Oo
134 .Op Cm \&!
135 .Cm uid_of_subject
136 .Oc
137 .Oo
138 .Op Cm \&!
139 .Cm gid_of_subject
140 .Oc
141 .Oo
142 .Op Cm \&!
143 .Cm type Ar ardbclsp
144 .Oc
145 .Cm mode
146 .Ar arswxn
147 .Nm
148 .Cm remove
149 .Ar rulenum
150 .Sh DESCRIPTION
151 The
152 .Nm
153 utility provides an
154 .Xr ipfw 8 Ns -like
155 interface to manage access to file system objects by UID and GID,
156 supported by the
157 .Xr mac_bsdextended 4
158 .Xr mac 9
159 policy.
160 .Pp
161 The arguments are as follows:
162 .Bl -tag -width indent -offset indent
163 .It Xo
164 .Cm add
165 .Cm subject
166 .Ar ...
167 .Cm object
168 .Ar ...
169 .Cm mode
170 .Ar arswxn
171 .Xc
172 Add a new rule, automatically selecting the rule number.
173 See the description of
174 .Cm set
175 for syntax information.
176 .It Cm list
177 Produces a list of all the current
178 .Nm
179 rules in the system.
180 .It Xo
181 .Cm set Ar rulenum
182 .Cm subject
183 .Ar ...
184 .Cm object
185 .Ar ...
186 .Cm mode
187 .Ar arswxn
188 .Xc
189 Add a new rule or modify an existing rule.
190 The arguments are as follows:
191 .Bl -tag -width ".Ar rulenum"
192 .It Ar rulenum
193 Rule number.
194 Entries with a lower rule number
195 are applied first;
196 placing the most frequently-matched rules at the beginning of the list
197 (i.e., lower-numbered)
198 will yield a slight performance increase.
199 .It Xo
200 .Cm subject
201 .Op Cm not
202 .Oo
203 .Op Cm \&!
204 .Cm uid Ar uid | minuid:maxuid
205 .Oc
206 .Oo
207 .Op Cm \&!
208 .Cm gid Ar gid | mingid:maxgid
209 .Oc
210 .Oo
211 .Op Cm \&!
212 .Cm jailid Ad jailid
213 .Oc
214 .Xc
215 Subjects performing an operation must match all the conditions given.
216 A leading
217 .Cm not
218 means that the subject should not match the remainder of the specification.
219 A condition may be prefixed by
220 .Cm \&!
221 to indicate that particular condition must not match the subject.
222 The subject can be required to have a particular
223 .Ar uid
224 and/or
225 .Ar gid .
226 A range of uids/gids can be specified, separated by a colon.
227 The subject can be required to be in a particular jail with the
228 .Ar jailid .
229 .It Xo
230 .Cm object
231 .Op Cm not
232 .Oo
233 .Op Cm \&!
234 .Cm uid Ar uid | minuid:maxuid
235 .Oc
236 .Oo
237 .Op Cm \&!
238 .Cm gid Ar gid | mingid:maxgid
239 .Oc
240 .Oo
241 .Op Cm \&!
242 .Cm filesys Ad path
243 .Oc
244 .Oo
245 .Op Cm \&!
246 .Cm suid
247 .Oc
248 .Oo
249 .Op Cm \&!
250 .Cm sgid
251 .Oc
252 .Oo
253 .Op Cm \&!
254 .Cm uid_of_subject
255 .Oc
256 .Oo
257 .Op Cm \&!
258 .Cm gid_of_subject
259 .Oc
260 .Oo
261 .Op Cm \&!
262 .Cm type Ar ardbclsp
263 .Oc
264 .Xc
265 The rule will apply only to objects matching all the specified conditions.
266 A leading
267 .Cm not
268 means that the object should not match all the remaining conditions.
269 A condition may be prefixed by
270 .Cm \&!
271 to indicate that particular condition must not match the object.
272 Objects can be required to be owned by the user and/or group specified by
273 .Ar uid
274 and/or
275 .Ar gid .
276 A range of uids/gids can be specified, separated by a colon.
277 The object can be required to be in a particular filesystem by
278 specifying the filesystem using
279 .Cm filesys .
280 Note,
281 if the filesystem is unmounted and remounted,
282 then the rule may need to be reapplied to ensure the correct filesystem
283 id is used.
284 The object can be required to have the
285 .Cm suid
286 or
287 .Cm sgid
288 bits set.
289 The owner of the object can be required to match the
290 .Cm uid_of_subject
291 or the
292 .Cm gid_of_subject
293 attempting the operation.
294 The type of the object can be restricted to a subset of
295 the following types.
296 .Pp
297 .Bl -tag -width ".Cm w" -compact -offset indent
298 .It Cm a
299 any file type
300 .It Cm r
301 a regular file
302 .It Cm d
303 a directory
304 .It Cm b
305 a block special device
306 .It Cm c
307 a character special device
308 .It Cm l
309 a symbolic link
310 .It Cm s
311 a unix domain socket
312 .It Cm p
313 a named pipe (FIFO)
314 .El
315 .It Cm mode Ar arswxn
316 Similar to
317 .Xr chmod 1 ,
318 each character represents an access mode.
319 If the rule applies,
320 the specified access permissions are enforced
321 for the object.
322 When a character is specified in the rule,
323 the rule will allow for the operation.
324 Conversely, not including it will cause the operation
325 to be denied.
326 The definitions of each character are as follows:
327 .Pp
328 .Bl -tag -width ".Cm w" -compact -offset indent
329 .It Cm a
330 administrative operations
331 .It Cm r
332 read access
333 .It Cm s
334 access to file attributes
335 .It Cm w
336 write access
337 .It Cm x
338 execute access
339 .It Cm n
340 none
341 .El
342 .El
343 .It Cm remove Ar rulenum
344 Disable and remove the rule with the specified rule number.
345 .El
346 .Sh SEE ALSO
347 .Xr mac_bsdextended 4 ,
348 .Xr mac 9
349 .Sh HISTORY
350 The
351 .Nm
352 utility first appeared in
353 .Fx 5.0 .
354 .Sh AUTHORS
355 This software was contributed to the
356 .Fx
357 Project by NAI Labs, the Security Research Division of Network Associates
358 Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
359 .Pq Dq CBOSS ,
360 as part of the DARPA CHATS research program.