xref: /freebsd/usr.sbin/setfmac/setfmac.8 (revision 214adc07e150b8282be1310518c33eeb7f7dd00f)
1.\" Copyright (c) 2002 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.Dd June 27, 2002
33.Dt SETFMAC 8
34.Sh NAME
35.Nm setfmac ,
36.Nm setfsmac
37.Nd set MAC label for a file system object
38.Sh SYNOPSIS
39.Nm setfmac
40.Op Fl hR
41.Ar label
42.Ar
43.Nm setfsmac
44.Op Fl ehvx
45.Op Fl f Ar specfile
46.Op Fl s Ar specfile
47.Ar
48.Sh DESCRIPTION
49The
50.Nm setfmac
51utility assigns the specified MAC label to the specified files.
52The following options are available:
53.Bl -tag -width indent
54.It Fl R
55Set the labels on the file hierarchies rooted in the files instead of
56just the files themselves.
57.It Fl h
58If the file is a symbolic link, change the label of the link rather
59than the file that the link points to.
60.El
61.Pp
62The
63.Nm setfsmac
64utility accepts a list of specification files as input and sets the MAC
65labels on the specified file system hierarchies.
66Path names specified will be visited in order as given on the command line,
67and each tree will be traversed in pre-order.
68(Generally, it will not be very useful to use relative, instead of absolute,
69paths.)
70The labels that match a file will be combined and set in a single
71transaction.
72.Pp
73The following options are available:
74.Bl -tag -width indent
75.It Fl e
76Treat any filesystems encountered which do not support MAC labelling as
77errors, instead of warning and skipping past them.
78.It Fl f Ar specfile
79Add the specifications in
80.Ar specfile
81as a set of which at most one will be applied to each file traversed per
82.Fl f Ar specfile
83given.
84.It Fl h
85If the file is a symbolic link, change the label of the link rather
86than the file that the link points to.
87.It Fl s Ar specfile
88Add the specification in
89.Ar specfile ,
90but assume that the specification format is that used in the port
91of
92.Tn SELinux
93to
94.Fx ,
95.Tn SEBSD.
96At most one of the specifications will be applied to each file traversed per
97.Fl f Ar specfile
98given.
99The prefix
100.Dq Li sebsd/
101will automatically be prepended to the labels in this file, and labels
102matching
103.Dq Li <<none>>
104will be explicitly not relabeled.
105This permits SEBSD to re-use existing
106.Tn SELinux
107policy specification files
108unmodified.
109.It Fl v
110Increase the degree of verbosity.
111When given, information detailing the labelling operation is printed while
112in progress.
113.It Fl x
114Do not cross recurse into new filesystems when traversing them.
115.El
116.Sh SEE ALSO
117.Xr mac 3 ,
118.Xr mac_set_file 3 ,
119.Xr mac_set_link 3 ,
120.Xr re_format 7 ,
121.Xr getfmac 8 ,
122.Xr mac 9
123