1.\" $NetBSD: veriexecctl.8,v 1.30 2007/05/15 19:47:47 elad Exp $ 2.\" 3.\" Copyright (c) 1999 4.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au 5.\" 6.\" This code is donated to The NetBSD Foundation by the author. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. The name of the Author may not be used to endorse or promote 17.\" products derived from this software without specific prior written 18.\" permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" $Id: veriexecctl.8,v 1.30 2007/05/15 19:47:47 elad Exp $ 33.\" 34.Dd May 15, 2007 35.Dt VERIEXECCTL 8 36.Os 37.Sh NAME 38.Nm veriexecctl 39.Nd manage the 40.Em Veriexec 41subsystem 42.Sh SYNOPSIS 43.Nm 44.Op Fl ek 45.Cm load Ar file 46.Nm 47.Cm delete Ar file | mount_point 48.Nm 49.Cm dump 50.Nm 51.Cm flush 52.Nm 53.Cm query Ar file 54.Sh DESCRIPTION 55The 56.Nm 57command is used to manipulate 58.Em Veriexec , 59the 60.Nx 61file integrity subsystem. 62.Ss Commands 63.Bl -tag -width XXXX 64.It Cm load Ar file 65Load the fingerprint entries contained in 66.Ar file . 67This operation is only allowed in learning mode (strict level zero). 68.Pp 69The following flags are allowed with this command: 70.Bl -tag -width indent 71.It Fl e 72Evaluate fingerprint on load, as opposed to when the file is accessed. 73.It Fl k 74Keep the filenames in the entry for more accurate logging. 75.El 76.It Cm delete Ar file | mount_point 77Delete either a single entry 78.Ar file 79or all entries on 80.Ar mount_point 81from being monitored by 82.Em Veriexec . 83.It Cm dump 84Dump the 85.Em Veriexec 86database from the kernel. 87Only entries that have the filename will be presented. 88.Pp 89This can be used to recover a lost database: 90.Bd -literal -offset indent 91# veriexecctl dump > /etc/signatures 92.Ed 93.It Cm flush 94Delete all entries in the 95.Em Veriexec 96database. 97.It Cm query Ar file 98Query 99.Em Veriexec 100for information associated with 101.Ar file : 102Filename, mount, fingerprint, fingerprint algorithm, evaluation status, 103and entry type. 104.El 105.Ss Signatures 106.Em Veriexec 107loads entries to the in-kernel database from a file describing files to be 108monitored and the type of monitoring. 109This file is often referred to as the 110.Sq signatures 111file. 112It has a line based structure, where each line has several fields separated 113by white-space (space, tabs, etc.) taking the following form: 114.Pp 115.Dl path type fingerprint flags 116.Pp 117The description for each field is as follows: 118.Bl -tag -width XXXX 119.It path 120The full path to the file. 121White-space characters can be escaped if prefixed with a 122.Sq \ . 123.It type 124Type of fingerprinting algorithm used for the file. 125.Pp 126Requires kernel support for the specified algorithm. 127List of fingerprinting algorithms supported by the kernel can be obtained by 128using the following command: 129.Bd -literal -offset indent 130# sysctl kern.veriexec.algorithms 131.Ed 132.It fingerprint 133The fingerprint for the file. 134Can (usually) be generated using the following command: 135.Bd -literal -offset indent 136% cksum -a \*[Lt]algorithm\*[Gt] \*[Lt]file\*[Gt] 137.Ed 138.It flags 139Optional listing of entry flags, separated by a comma. 140These may include: 141.Bl -tag -width XXXX 142.It direct 143Allow direct execution only. 144.Pp 145Execution of a program is said to be 146.Dq direct 147when the program is invoked by the user (either in a script, manually typing it, 148etc.) via the 149.Xr execve 2 150syscall. 151.It indirect 152Allow indirect execution only. 153.Pp 154Execution of a program is said to be 155.Dq indirect 156if it is invoked by the kernel to interpret a script ( 157.Dq hash-bang ). 158.It file 159Allow opening the file only, via the 160.Xr open 2 161syscall (no execution is allowed). 162.It untrusted 163Indicate that the file is located on untrusted storage and its fingerprint 164evaluation status should not be cached, but rather re-calculated each time 165it is accessed. 166.\"It also enabled per-page fingerprints for the file, causing pages it as 167.\"backing store to be verified for their integrity as well. 168.Pp 169Fingerprints for untrusted files will always be evaluated on load. 170.El 171.Pp 172To improve readaibility of the signatures file, the following aliases are 173provided: 174.Bl -tag -width XXXX 175.It program 176An alias for 177.Dq direct . 178.It interpreter 179An alias for 180.Dq indirect 181.It script 182An alias for both 183.Dq direct 184and 185.Dq file . 186.It library 187An alias for both 188.Dq file 189and 190.Dq indirect . 191.El 192.Pp 193If no flags are specified, 194.Dq direct 195is assumed. 196.El 197.Pp 198Comments begin with a 199.Sq \&# 200character and span to the end of the line. 201.Pp 202Automatic generation of the signatures file is possible using the 203.Xr veriexecgen 8 204program. 205.Sh FILES 206.Bl -tag -width /etc/signatures -compact 207.It Pa /dev/veriexec 208.Em Veriexec 209pseudo-device 210.It Pa /etc/signatures 211default signatures file 212.El 213.Sh SEE ALSO 214.Xr veriexec 4 , 215.Xr veriexecgen 8 , 216.Xr veriexec 9 217.Sh HISTORY 218.Nm 219first appeared in 220.Nx 2.0 . 221.Sh AUTHORS 222.An Brett Lymn Aq blymn@NetBSD.org 223.An Elad Efrat Aq elad@NetBSD.org 224.Sh NOTES 225The kernel is expected to have the 226.Dq veriexec 227pseudo-device. 228