Blame man/veritysetup.8

Packit Service a9384c
.TH VERITYSETUP "8" "January 2019" "veritysetup" "Maintenance Commands"
Packit Service a9384c
.SH NAME
Packit Service a9384c
veritysetup - manage dm-verity (block level verification) volumes
Packit Service a9384c
.SH SYNOPSIS
Packit Service a9384c
.B veritysetup <options> <action> <action args>
Packit Service a9384c
.SH DESCRIPTION
Packit Service a9384c
.PP
Packit Service a9384c
Veritysetup is used to configure dm-verity managed device-mapper mappings.
Packit Service a9384c
Packit Service a9384c
Device-mapper verity target provides read-only transparent integrity
Packit Service a9384c
checking of block devices using kernel crypto API.
Packit Service a9384c
Packit Service a9384c
The dm-verity devices are always read-only.
Packit Service a9384c
Packit Service a9384c
Veritysetup supports these operations:
Packit Service a9384c
.PP
Packit Service a9384c
\fIformat\fR <data_device> <hash_device>
Packit Service a9384c
.IP
Packit Service a9384c
Calculates and permanently stores hash verification data for data_device.
Packit Service a9384c
Hash area can be located on the same device after data if specified
Packit Service a9384c
by \-\-hash\-offset option.
Packit Service a9384c
Packit Service a9384c
Note you need to provide root hash string for device verification
Packit Service a9384c
or activation. Root hash must be trusted.
Packit Service a9384c
Packit Service a9384c
The data or hash device argument can be block device or file image.
Packit Service a9384c
If hash device path doesn't exist, it will be created as file.
Packit Service a9384c
Packit Service a9384c
\fB<options>\fR can be [\-\-hash, \-\-no-superblock, \-\-format,
Packit Service a9384c
\-\-data-block-size, \-\-hash-block-size, \-\-data-blocks, \-\-hash-offset,
Packit Service a9384c
\-\-salt, \-\-uuid]
Packit Service a9384c
.PP
Packit Service a9384c
\fIopen\fR <data_device> <name> <hash_device> <root_hash>
Packit Service a9384c
.br
Packit Service a9384c
\fIcreate\fR <name> <data_device> <hash_device> <root_hash>  (\fBOBSOLETE syntax\fR)
Packit Service a9384c
.IP
Packit Service a9384c
Creates a mapping with <name> backed by device <data_device> and using
Packit Service a9384c
<hash_device> for in-kernel verification.
Packit Service a9384c
Packit Service a9384c
The <root_hash> is a hexadecimal string.
Packit Service a9384c
Packit Service a9384c
\fB<options>\fR can be [\-\-hash-offset, \-\-no-superblock,
Packit Service a9384c
\-\-ignore-corruption or \-\-restart-on-corruption, \-\-ignore-zero-blocks,
Packit Service a9384c
\-\-check-at-most-once, \-\-root-hash-signature]
Packit Service a9384c
Packit Service a9384c
If option \-\-no-superblock is used, you have to use as the same options
Packit Service a9384c
as in initial format operation.
Packit Service a9384c
.PP
Packit Service a9384c
\fIverify\fR <data_device> <hash_device> <root_hash>
Packit Service a9384c
.IP
Packit Service a9384c
Verifies data on data_device with use of hash blocks stored on hash_device.
Packit Service a9384c
Packit Service a9384c
This command performs userspace verification, no kernel device is created.
Packit Service a9384c
Packit Service a9384c
The <root_hash> is a hexadecimal string.
Packit Service a9384c
Packit Service a9384c
\fB<options>\fR can be [\-\-hash-offset, \-\-no-superblock]
Packit Service a9384c
Packit Service a9384c
If option \-\-no-superblock is used, you have to use as the same options
Packit Service a9384c
as in initial format operation.
Packit Service a9384c
.PP
Packit Service a9384c
\fIclose\fR <name>
Packit Service a9384c
.IP
Packit Service a9384c
Removes existing mapping <name>.
Packit Service a9384c
Packit Service a9384c
For backward compatibility there is \fBremove\fR command alias
Packit Service a9384c
for \fBclose\fR command.
Packit Service a9384c
.PP
Packit Service a9384c
\fIstatus\fR <name>
Packit Service a9384c
.IP
Packit Service a9384c
Reports status for the active verity mapping <name>.
Packit Service a9384c
.PP
Packit Service a9384c
\fIdump\fR <hash_device>
Packit Service a9384c
.IP
Packit Service a9384c
Reports parameters of verity device from on-disk stored superblock.
Packit Service a9384c
Packit Service a9384c
\fB<options>\fR can be [\-\-no-superblock]
Packit Service a9384c
.SH OPTIONS
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-verbose, \-v"
Packit Service a9384c
Print more information on command execution.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-debug"
Packit Service a9384c
Run in debug mode with full diagnostic logs. Debug output
Packit Service a9384c
lines are always prefixed by '#'.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-no-superblock"
Packit Service a9384c
Create or use dm-verity without permanent on-disk superblock.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-format=number"
Packit Service a9384c
Specifies the hash version type.
Packit Service a9384c
Format type 0 is original Chrome OS version. Format type 1 is current version.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-data-block-size=bytes"
Packit Service a9384c
Used block size for the data device.
Packit Service a9384c
(Note kernel supports only page-size as maximum here.)
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-hash-block-size=bytes"
Packit Service a9384c
Used block size for the hash device.
Packit Service a9384c
(Note kernel supports only page-size as maximum here.)
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-data-blocks=blocks"
Packit Service a9384c
Size of data device used in verification.
Packit Service a9384c
If not specified, the whole device is used.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-hash-offset=bytes"
Packit Service a9384c
Offset of hash area/superblock on hash_device.
Packit Service a9384c
Value must be aligned to disk sector offset.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-salt=hex string"
Packit Service a9384c
Salt used for format or verification.
Packit Service a9384c
Format is a hexadecimal string.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-uuid=UUID"
Packit Service a9384c
Use the provided UUID for format command instead of generating new one.
Packit Service a9384c
Packit Service a9384c
The UUID must be provided in standard UUID format,
Packit Service a9384c
e.g. 12345678-1234-1234-1234-123456789abc.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-ignore-corruption", "\-\-restart-on-corruption"
Packit Service a9384c
Defines what to do if data integrity problem is detected (data corruption).
Packit Service a9384c
Packit Service a9384c
Without these options kernel fails the IO operation with I/O error.
Packit Service a9384c
With \-\-ignore-corruption option the corruption is only logged.
Packit Service a9384c
With \-\-restart-on-corruption the kernel is restarted immediately.
Packit Service a9384c
(You have to provide way how to avoid restart loops.)
Packit Service a9384c
Packit Service a9384c
\fBWARNING:\fR Use these options only for very specific cases.
Packit Service a9384c
These options are available since Linux kernel version 4.1.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-ignore-zero-blocks"
Packit Service a9384c
Instruct kernel to not verify blocks that are expected to contain zeroes
Packit Service a9384c
and always directly return zeroes instead.
Packit Service a9384c
Packit Service a9384c
\fBWARNING:\fR Use this option only in very specific cases.
Packit Service a9384c
This option is available since Linux kernel version 4.5.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-check-at-most-once"
Packit Service a9384c
Instruct kernel to verify blocks only the first time they are read
Packit Service a9384c
from the data device, rather than every time.
Packit Service a9384c
Packit Service a9384c
\fBWARNING:\fR It provides a reduced level of security because only
Packit Service a9384c
offline tampering of the data device's content will be detected,
Packit Service a9384c
not online tampering.
Packit Service a9384c
This option is available since Linux kernel version 4.17.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-hash=hash"
Packit Service a9384c
Hash algorithm for dm-verity. For default see \-\-help option.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-version"
Packit Service a9384c
Show the program version.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-fec-device=fec_device"
Packit Service a9384c
Use forward error correction (FEC) to recover from corruption if hash verification fails.
Packit Service a9384c
Use encoding data from the specified device.
Packit Service a9384c
Packit Service a9384c
The fec device argument can be block device or file image.
Packit Service a9384c
For format, if fec device path doesn't exist, it will be created as file.
Packit Service a9384c
Packit Service a9384c
Note: block sizes for data and hash devices must match. Also, if the verity data_device is encrypted the fec_device should be too.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-fec-offset=bytes"
Packit Service a9384c
This is the offset, in bytes, from the start of the FEC device to the beginning of the encoding data.
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-fec-roots=num"
Packit Service a9384c
Number of generator roots. This equals to the number of parity bytes in the encoding data.
Packit Service a9384c
In RS(M, N) encoding, the number of roots is M-N. M is 255 and M-N is between 2 and 24 (including).
Packit Service a9384c
.TP
Packit Service a9384c
.B "\-\-root-hash-signature=FILE"
Packit Service a9384c
Path to roothash signature file used to verify the root hash (in kernel).
Packit Service a9384c
This feature requires Linux kernel version 5.4 or more recent.
Packit Service a9384c
.TP
Packit Service a9384c
.SH RETURN CODES
Packit Service a9384c
Veritysetup returns 0 on success and a non-zero value on error.
Packit Service a9384c
Packit Service a9384c
Error codes are:
Packit Service a9384c
    1 wrong parameters
Packit Service a9384c
    2 no permission
Packit Service a9384c
    3 out of memory
Packit Service a9384c
    4 wrong device specified
Packit Service a9384c
    5 device already exists or device is busy.
Packit Service a9384c
Packit Service a9384c
.SH EXAMPLES
Packit Service a9384c
.B "veritysetup \-\-data-blocks=256 format <data_device> <hash_device>"
Packit Service a9384c
Packit Service a9384c
Calculates and stores verification data on hash_device for the first 256 blocks (of block-size).
Packit Service a9384c
If hash_device does not exist, it is created (as file image).
Packit Service a9384c
Packit Service a9384c
.B "veritysetup format <data_device> <hash_device>"
Packit Service a9384c
Packit Service a9384c
Calculates and stores verification data on hash_device for the whole data_device.
Packit Service a9384c
Packit Service a9384c
.B "veritysetup \-\-data-blocks=256 \-\-hash-offset=1052672 format <device> <device>"
Packit Service a9384c
Packit Service a9384c
Verification data (hashes) is stored on the same device as data (starting at hash-offset).
Packit Service a9384c
Hash-offset must be greater than number of blocks in data-area.
Packit Service a9384c
Packit Service a9384c
.B "veritysetup \-\-data-blocks=256 \-\-hash-offset=1052672 create test-device <device> <device> <root_hash>"
Packit Service a9384c
Packit Service a9384c
Activates the verity device named test-device. Options \-\-data-blocks and \-\-hash-offset are the same
Packit Service a9384c
as in the format command. The <root_hash> was calculated in format command.
Packit Service a9384c
Packit Service a9384c
.B "veritysetup \-\-data-blocks=256 \-\-hash-offset=1052672 verify <data_device> <hash_device> <root_hash>"
Packit Service a9384c
Packit Service a9384c
Verifies device without activation (in userspace).
Packit Service a9384c
Packit Service a9384c
.B "veritysetup \-\-fec-device=<fec_device> \-\-fec-roots=10 format <data_device> <hash_device>"
Packit Service a9384c
Packit Service a9384c
Calculates and stores verification and encoding data for data_device.
Packit Service a9384c
Packit Service a9384c
.SH REPORTING BUGS
Packit Service a9384c
Report bugs, including ones in the documentation, on
Packit Service a9384c
the cryptsetup mailing list at <dm-crypt@saout.de>
Packit Service a9384c
or in the 'Issues' section on LUKS website.
Packit Service a9384c
Please attach the output of the failed command with the
Packit Service a9384c
\-\-debug option added.
Packit Service a9384c
.SH AUTHORS
Packit Service a9384c
The first implementation of veritysetup was written by Chrome OS authors.
Packit Service a9384c
Packit Service a9384c
This version is based on verification code written by Mikulas Patocka <mpatocka@redhat.com>
Packit Service a9384c
and rewritten for libcryptsetup by Milan Broz <gmazyland@gmail.com>.
Packit Service a9384c
.SH COPYRIGHT
Packit Service a9384c
Copyright \(co 2012-2020 Red Hat, Inc.
Packit Service a9384c
.br
Packit Service a9384c
Copyright \(co 2012-2020 Milan Broz
Packit Service a9384c
Packit Service a9384c
This is free software; see the source for copying conditions.  There is NO
Packit Service a9384c
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit Service a9384c
.SH SEE ALSO
Packit Service a9384c
The project website at \fBhttps://gitlab.com/cryptsetup/cryptsetup\fR
Packit Service a9384c
Packit Service a9384c
The verity on-disk format specification available at
Packit Service a9384c
\fBhttps://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity\fR