xref: /freebsd/sbin/veriexec/veriexec.8 (revision d746ab215cc85d8f7ab05c5f866c338782c390ec)
1.\"-
2.\" Copyright (c) 2018, Juniper Networks, Inc.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd February 14, 2022
28.Dt VERIEXEC 8
29.Os
30.Sh NAME
31.Nm veriexec
32.Nd manipulate state of mac_veriexec
33.Sh SYNOPSIS
34.Nm
35.Op Fl v
36.Op Fl C Ar directory
37.Pa manifest
38.Nm
39.Fl z Ar state
40.Nm
41.Fl i Ar state
42.Nm
43.Fl x
44.Ar file ...
45.Sh DESCRIPTION
46.Nm
47is a utility to query or manipulate the state of
48.Xr mac_veriexec 4 .
49.Pp
50The first form is for loading a
51.Pa manifest .
52.Nm
53first verifies a digital signature of the
54.Ar manifest
55and if successful, parses it and feeds its content to kernel.
56.Pp
57The second form with
58.Fl z
59is used to modify the
60.Ar state ,
61and with
62.Fl i
63to query the current
64.Ar state .
65.Pp
66The final form with
67.Fl x
68is used to test whether
69.Ar file
70is verified or not.
71This requires
72.Xr mac_veriexec 4
73to be in the
74.Ql active
75or
76.Ql enforce
77state.
78.Pp
79The possible states
80are:
81.Bl -tag -width enforce
82.It Ar loaded
83set automatically when first
84.Pa manifest
85has been loaded.
86.It Ar active
87.Xr mac_veriexec 4
88will begin checking files.
89This state can only be entered from the
90.Ar loaded
91state.
92.It Ar enforce
93.Xr mac_veriexec 4
94will fail attempts to
95.Xr exec 2
96or
97.Xr open 2
98files with
99.Dv O_VERIFY
100unless verified.
101.It Ar locked
102prevent loading of any more manifests.
103.El
104.Pp
105When setting or querying the state, it is sufficient to provide
106a unique prefix of the desired state.
107So
108.Fl i
109.Ar a
110or
111.Fl z
112.Ar e
113are sufficient, but
114.Fl i
115.Ar loc
116is the minimum required to avoid confusion with
117.Ar loaded .
118.Sh MANIFESTS
119The manifest contains a mapping of relative pathnames to fingerprints
120with optional flags.
121For example:
122.Bd -literal -offset indent
123sbin/veriexec sha256=f22136...c0ff71 no_ptrace
124usr/bin/python sha256=5944d9...876525 indirect
125sbin/somedaemon sha256=77fc2f...63f5687 label=mod1/val1,mod2/val2
126.Ed
127The supported flags are:
128.Bl -tag -width indirect
129.It Ql indirect
130the executable cannot be run directly,
131but can be used as an interpreter for example via:
132.Bd -literal -offset indent
133#!/usr/bin/python
134.Ed
135.It Ql no_ptrace
136do not allow running executable under a debugger.
137Useful for any application critical to the security state of system.
138.El
139.Pp
140The
141.Ql label
142argument allows associating a
143.Xr maclabel 7
144with the executable.
145Neither
146.Nm
147nor
148.Xr mac_veriexec 4
149(if it supports labels)
150pay any attention to the content of the label
151they are provided for the use of other
152.Xr mac 4
153modules.
154.Sh HISTORY
155The Verified Exec system first appeared in
156.Nx .
157This utility derrives from the one found in Junos.
158The key difference is the requirement that manifest files
159be digitally signed.
160