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