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.Dd July 8, 2022 26.Dt VERIEXEC 8 27.Os 28.Sh NAME 29.Nm veriexec 30.Nd manipulate state of mac_veriexec 31.Sh SYNOPSIS 32.Nm 33.Op Fl v 34.Op Fl C Ar directory 35.Op Fl S 36.Pa manifest 37.Nm 38.Fl z Ar state 39.Nm 40.Fl i Ar state 41.Nm 42.Fl x 43.Ar file ... 44.Sh DESCRIPTION 45.Nm 46is a utility to query or manipulate the state of 47.Xr mac_veriexec 4 . 48.Pp 49The first form is for loading a 50.Pa manifest . 51.Nm 52first verifies a digital signature of the 53.Ar manifest 54and if successful, parses it and feeds its content to kernel. 55The 56.Fl S 57flag indicates that certificate validity should be checked. 58Without this, a valid signature with an expired certificate 59will still be accepted. 60.Pp 61The second form with 62.Fl z 63is used to modify the 64.Ar state , 65and with 66.Fl i 67to query the current 68.Ar state . 69.Pp 70The final form with 71.Fl x 72is used to test whether 73.Ar file 74is verified or not. 75This requires 76.Xr mac_veriexec 4 77to be in the 78.Ql active 79or 80.Ql enforce 81state. 82.Pp 83The possible states 84are: 85.Bl -tag -width enforce 86.It Ar loaded 87set automatically when first 88.Pa manifest 89has been loaded. 90.It Ar active 91.Xr mac_veriexec 4 92will begin checking files. 93This state can only be entered from the 94.Ar loaded 95state. 96.It Ar enforce 97.Xr mac_veriexec 4 98will fail attempts to 99.Xr exec 2 100or 101.Xr open 2 102files with 103.Dv O_VERIFY 104unless verified. 105.It Ar locked 106prevent loading of any more manifests. 107.El 108.Pp 109When setting or querying the state, it is sufficient to provide 110a unique prefix of the desired state. 111So 112.Fl i 113.Ar a 114or 115.Fl z 116.Ar e 117are sufficient, but 118.Fl i 119.Ar loc 120is the minimum required to avoid confusion with 121.Ar loaded . 122.Sh MANIFESTS 123The manifest contains a mapping of relative pathnames to fingerprints 124with optional flags. 125For example: 126.Bd -literal -offset indent 127sbin/veriexec sha256=f22136...c0ff71 no_ptrace 128usr/bin/python sha256=5944d9...876525 indirect 129sbin/somedaemon sha256=77fc2f...63f5687 label=mod1/val1,mod2/val2 130.Ed 131The supported flags are: 132.Bl -tag -width indirect 133.It Ql indirect 134the executable cannot be run directly, 135but can be used as an interpreter for example via: 136.Bd -literal -offset indent 137#!/usr/bin/python 138.Ed 139.It Ql no_ptrace 140do not allow running executable under a debugger. 141Useful for any application critical to the security state of system. 142.El 143.Pp 144The 145.Ql label 146argument allows associating a 147.Xr maclabel 7 148with the executable. 149Neither 150.Nm 151nor 152.Xr mac_veriexec 4 153(if it supports labels) 154pay any attention to the content of the label 155they are provided for the use of other 156.Xr mac 4 157modules. 158.Sh HISTORY 159The Verified Exec system first appeared in 160.Nx . 161This utility derrives from the one found in Junos. 162The key difference is the requirement that manifest files 163be digitally signed. 164