12f07cdf8SPawel Jakub Dawidek.\" Copyright (c) 2005-2019 Pawel Jakub Dawidek <pawel@dawidek.net> 2e4b0a90eSBrooks Davis.\" All rights reserved. 3e4b0a90eSBrooks Davis.\" 4e4b0a90eSBrooks Davis.\" Redistribution and use in source and binary forms, with or without 5e4b0a90eSBrooks Davis.\" modification, are permitted provided that the following conditions 6e4b0a90eSBrooks Davis.\" are met: 7e4b0a90eSBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 8e4b0a90eSBrooks Davis.\" notice, this list of conditions and the following disclaimer. 9e4b0a90eSBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 10e4b0a90eSBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 11e4b0a90eSBrooks Davis.\" documentation and/or other materials provided with the distribution. 12e4b0a90eSBrooks Davis.\" 13e4b0a90eSBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 14e4b0a90eSBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15e4b0a90eSBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16e4b0a90eSBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 17e4b0a90eSBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18e4b0a90eSBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19e4b0a90eSBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20e4b0a90eSBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21e4b0a90eSBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22e4b0a90eSBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23e4b0a90eSBrooks Davis.\" SUCH DAMAGE. 24e4b0a90eSBrooks Davis.\" 25*4b794914SAlan Somers.Dd April 24, 2024 26e4b0a90eSBrooks Davis.Dt GELI 8 27e4b0a90eSBrooks Davis.Os 28e4b0a90eSBrooks Davis.Sh NAME 29e4b0a90eSBrooks Davis.Nm geli 30e4b0a90eSBrooks Davis.Nd "control utility for the cryptographic GEOM class" 31e4b0a90eSBrooks Davis.Sh SYNOPSIS 32e4b0a90eSBrooks DavisTo compile GEOM_ELI into your kernel, add the following lines to your kernel 33e4b0a90eSBrooks Davisconfiguration file: 34e4b0a90eSBrooks Davis.Bd -ragged -offset indent 35e4b0a90eSBrooks Davis.Cd "device crypto" 36e4b0a90eSBrooks Davis.Cd "options GEOM_ELI" 37e4b0a90eSBrooks Davis.Ed 38e4b0a90eSBrooks Davis.Pp 39e4b0a90eSBrooks DavisAlternatively, to load the GEOM_ELI module at boot time, add the following line 40e4b0a90eSBrooks Davisto your 41e4b0a90eSBrooks Davis.Xr loader.conf 5 : 42e4b0a90eSBrooks Davis.Bd -literal -offset indent 43e4b0a90eSBrooks Davisgeom_eli_load="YES" 44e4b0a90eSBrooks Davis.Ed 45e4b0a90eSBrooks Davis.Pp 466709a516SMateusz Piotrowski.No Usage of the Nm 47e4b0a90eSBrooks Davisutility: 48e4b0a90eSBrooks Davis.Pp 49e4b0a90eSBrooks Davis.Nm 50e4b0a90eSBrooks Davis.Cm init 512f07cdf8SPawel Jakub Dawidek.Op Fl bdgPRTv 52e4b0a90eSBrooks Davis.Op Fl a Ar aalgo 53e4b0a90eSBrooks Davis.Op Fl B Ar backupfile 54e4b0a90eSBrooks Davis.Op Fl e Ar ealgo 55e4b0a90eSBrooks Davis.Op Fl i Ar iterations 56e4b0a90eSBrooks Davis.Op Fl J Ar newpassfile 57e4b0a90eSBrooks Davis.Op Fl K Ar newkeyfile 58e4b0a90eSBrooks Davis.Op Fl l Ar keylen 59e4b0a90eSBrooks Davis.Op Fl s Ar sectorsize 60e4b0a90eSBrooks Davis.Op Fl V Ar version 61368455ecSBen Woods.Ar prov ... 62e4b0a90eSBrooks Davis.Nm 63e4b0a90eSBrooks Davis.Cm label - an alias for 64e4b0a90eSBrooks Davis.Cm init 65e4b0a90eSBrooks Davis.Nm 66e4b0a90eSBrooks Davis.Cm attach 67e4b0a90eSBrooks Davis.Op Fl Cdprv 68e4b0a90eSBrooks Davis.Op Fl n Ar keyno 69e4b0a90eSBrooks Davis.Op Fl j Ar passfile 70e4b0a90eSBrooks Davis.Op Fl k Ar keyfile 71217df2daSBen Woods.Ar prov ... 72e4b0a90eSBrooks Davis.Nm 73e4b0a90eSBrooks Davis.Cm detach 74e4b0a90eSBrooks Davis.Op Fl fl 75e4b0a90eSBrooks Davis.Ar prov ... 76e4b0a90eSBrooks Davis.Nm 77e4b0a90eSBrooks Davis.Cm stop - an alias for 78e4b0a90eSBrooks Davis.Cm detach 79e4b0a90eSBrooks Davis.Nm 80e4b0a90eSBrooks Davis.Cm onetime 812f07cdf8SPawel Jakub Dawidek.Op Fl dRT 82e4b0a90eSBrooks Davis.Op Fl a Ar aalgo 83e4b0a90eSBrooks Davis.Op Fl e Ar ealgo 84e4b0a90eSBrooks Davis.Op Fl l Ar keylen 85e4b0a90eSBrooks Davis.Op Fl s Ar sectorsize 86e4b0a90eSBrooks Davis.Ar prov 87e4b0a90eSBrooks Davis.Nm 88e4b0a90eSBrooks Davis.Cm configure 892f07cdf8SPawel Jakub Dawidek.Op Fl bBdDgGrRtT 90e4b0a90eSBrooks Davis.Ar prov ... 91e4b0a90eSBrooks Davis.Nm 92e4b0a90eSBrooks Davis.Cm setkey 93e4b0a90eSBrooks Davis.Op Fl pPv 94e4b0a90eSBrooks Davis.Op Fl i Ar iterations 95e4b0a90eSBrooks Davis.Op Fl j Ar passfile 96e4b0a90eSBrooks Davis.Op Fl J Ar newpassfile 97e4b0a90eSBrooks Davis.Op Fl k Ar keyfile 98e4b0a90eSBrooks Davis.Op Fl K Ar newkeyfile 99e4b0a90eSBrooks Davis.Op Fl n Ar keyno 100e4b0a90eSBrooks Davis.Ar prov 101e4b0a90eSBrooks Davis.Nm 102e4b0a90eSBrooks Davis.Cm delkey 103e4b0a90eSBrooks Davis.Op Fl afv 104e4b0a90eSBrooks Davis.Op Fl n Ar keyno 105e4b0a90eSBrooks Davis.Ar prov 106e4b0a90eSBrooks Davis.Nm 107e4b0a90eSBrooks Davis.Cm kill 108e4b0a90eSBrooks Davis.Op Fl av 109e4b0a90eSBrooks Davis.Op Ar prov ... 110e4b0a90eSBrooks Davis.Nm 111e4b0a90eSBrooks Davis.Cm backup 112e4b0a90eSBrooks Davis.Op Fl v 113e4b0a90eSBrooks Davis.Ar prov 114e4b0a90eSBrooks Davis.Ar file 115e4b0a90eSBrooks Davis.Nm 116e4b0a90eSBrooks Davis.Cm restore 117e4b0a90eSBrooks Davis.Op Fl fv 118e4b0a90eSBrooks Davis.Ar file 119e4b0a90eSBrooks Davis.Ar prov 120e4b0a90eSBrooks Davis.Nm 121e4b0a90eSBrooks Davis.Cm suspend 122e4b0a90eSBrooks Davis.Op Fl v 123e4b0a90eSBrooks Davis.Fl a | Ar prov ... 124e4b0a90eSBrooks Davis.Nm 125e4b0a90eSBrooks Davis.Cm resume 126e4b0a90eSBrooks Davis.Op Fl pv 127e4b0a90eSBrooks Davis.Op Fl j Ar passfile 128e4b0a90eSBrooks Davis.Op Fl k Ar keyfile 129e4b0a90eSBrooks Davis.Ar prov 130e4b0a90eSBrooks Davis.Nm 131e4b0a90eSBrooks Davis.Cm resize 132e4b0a90eSBrooks Davis.Op Fl v 133e4b0a90eSBrooks Davis.Fl s Ar oldsize 134e4b0a90eSBrooks Davis.Ar prov 135e4b0a90eSBrooks Davis.Nm 136e4b0a90eSBrooks Davis.Cm version 137e4b0a90eSBrooks Davis.Op Ar prov ... 138e4b0a90eSBrooks Davis.Nm 139e4b0a90eSBrooks Davis.Cm clear 140e4b0a90eSBrooks Davis.Op Fl v 141e4b0a90eSBrooks Davis.Ar prov ... 142e4b0a90eSBrooks Davis.Nm 143e4b0a90eSBrooks Davis.Cm dump 144e4b0a90eSBrooks Davis.Op Fl v 145e4b0a90eSBrooks Davis.Ar prov ... 146e4b0a90eSBrooks Davis.Nm 147e4b0a90eSBrooks Davis.Cm list 148e4b0a90eSBrooks Davis.Nm 149e4b0a90eSBrooks Davis.Cm status 150e4b0a90eSBrooks Davis.Nm 151e4b0a90eSBrooks Davis.Cm load 152e4b0a90eSBrooks Davis.Nm 153e4b0a90eSBrooks Davis.Cm unload 154e4b0a90eSBrooks Davis.Sh DESCRIPTION 155e4b0a90eSBrooks DavisThe 156e4b0a90eSBrooks Davis.Nm 157e4b0a90eSBrooks Davisutility is used to configure encryption on GEOM providers. 158e4b0a90eSBrooks Davis.Pp 159e4b0a90eSBrooks DavisThe following is a list of the most important features: 160e4b0a90eSBrooks Davis.Pp 161e4b0a90eSBrooks Davis.Bl -bullet -offset indent -compact 162e4b0a90eSBrooks Davis.It 163e4b0a90eSBrooks DavisUtilizes the 164e4b0a90eSBrooks Davis.Xr crypto 9 165e4b0a90eSBrooks Davisframework, so when there is crypto hardware available, 166e4b0a90eSBrooks Davis.Nm 167e4b0a90eSBrooks Daviswill make use of it automatically. 168e4b0a90eSBrooks Davis.It 169e4b0a90eSBrooks DavisSupports many cryptographic algorithms (currently 170e4b0a90eSBrooks Davis.Nm AES-XTS , 171e4b0a90eSBrooks Davis.Nm AES-CBC , 172e4b0a90eSBrooks Davisand 173e2b99193SJohn Baldwin.Nm Camellia-CBC ) . 174e4b0a90eSBrooks Davis.It 175e4b0a90eSBrooks DavisCan optionally perform data authentication (integrity verification) utilizing 176e4b0a90eSBrooks Davisone of the following algorithms: 177e4b0a90eSBrooks Davis.Nm HMAC/SHA1 , 178e4b0a90eSBrooks Davis.Nm HMAC/RIPEMD160 , 179e4b0a90eSBrooks Davis.Nm HMAC/SHA256 , 180e4b0a90eSBrooks Davis.Nm HMAC/SHA384 181e4b0a90eSBrooks Davisor 182e4b0a90eSBrooks Davis.Nm HMAC/SHA512 . 183e4b0a90eSBrooks Davis.It 184e4b0a90eSBrooks DavisCan create a User Key from up to two, piecewise components: a passphrase 185e4b0a90eSBrooks Davisentered via prompt or read from one or more passfiles; a keyfile read from 186e4b0a90eSBrooks Davisone or more files. 187e4b0a90eSBrooks Davis.It 188e4b0a90eSBrooks DavisAllows encryption of the root partition. 189217df2daSBen WoodsThe user is asked for the passphrase before the root filesystem is mounted. 190e4b0a90eSBrooks Davis.It 191e4b0a90eSBrooks DavisStrengthens the passphrase component of the User Key with: 192e4b0a90eSBrooks Davis.Rs 193e4b0a90eSBrooks Davis.%A B. Kaliski 194e4b0a90eSBrooks Davis.%T "PKCS #5: Password-Based Cryptography Specification, Version 2.0." 195e4b0a90eSBrooks Davis.%R RFC 196e4b0a90eSBrooks Davis.%N 2898 197e4b0a90eSBrooks Davis.Re 198e4b0a90eSBrooks Davis.It 199e4b0a90eSBrooks DavisAllows the use of two independent User Keys (e.g., a 200e4b0a90eSBrooks Davis.Qq "user key" 201e4b0a90eSBrooks Davisand a 202e4b0a90eSBrooks Davis.Qq "company key" ) . 203e4b0a90eSBrooks Davis.It 204e4b0a90eSBrooks DavisIt is fast - 205e4b0a90eSBrooks Davis.Nm 206e4b0a90eSBrooks Davisperforms simple sector-to-sector encryption. 207e4b0a90eSBrooks Davis.It 208e4b0a90eSBrooks DavisAllows the encrypted Master Key to be backed up and restored, 209e4b0a90eSBrooks Davisso that if a user has to quickly destroy key material, 210e4b0a90eSBrooks Davisit is possible to get the data back by restoring keys from 211e4b0a90eSBrooks Davisbackup. 212e4b0a90eSBrooks Davis.It 213217df2daSBen WoodsProviders can be configured to automatically detach on last close, 214217df2daSBen Woodsso users do not have to remember to detach providers after unmounting 215217df2daSBen Woodsthe filesystems. 216e4b0a90eSBrooks Davis.It 217217df2daSBen WoodsAllows attaching a provider with a random, one-time Master Key, 218217df2daSBen Woodswhich is useful for swap partitions and temporary filesystems. 219e4b0a90eSBrooks Davis.It 220e4b0a90eSBrooks DavisAllows verification of data integrity (data authentication). 221e4b0a90eSBrooks Davis.It 222e4b0a90eSBrooks DavisAllows suspending and resuming encrypted devices. 223e4b0a90eSBrooks Davis.El 224e4b0a90eSBrooks Davis.Pp 225e4b0a90eSBrooks DavisThe first argument to 226e4b0a90eSBrooks Davis.Nm 227e4b0a90eSBrooks Davisindicates an action to be performed: 228e4b0a90eSBrooks Davis.Bl -tag -width ".Cm configure" 229e4b0a90eSBrooks Davis.It Cm init 230368455ecSBen WoodsInitialize providers which need to be encrypted. 231368455ecSBen WoodsIf multiple providers are listed as arguments, they will all be initialized 232368455ecSBen Woodswith the same passphrase and/or User Key. 233368455ecSBen WoodsA unique salt will be randomly generated for each provider to ensure the 234368455ecSBen WoodsMaster Key for each is unique. 235e4b0a90eSBrooks DavisHere you can set up the cryptographic algorithm to use, Data Key length, 236e4b0a90eSBrooks Davisetc. 237368455ecSBen WoodsThe last sector of the providers is used to store metadata. 238e4b0a90eSBrooks DavisThe 239e4b0a90eSBrooks Davis.Cm init 240e4b0a90eSBrooks Davissubcommand also automatically writes metadata backups to 241e4b0a90eSBrooks Davis.Pa /var/backups/<prov>.eli 242e4b0a90eSBrooks Davisfile. 243e4b0a90eSBrooks DavisThe metadata can be recovered with the 244e4b0a90eSBrooks Davis.Cm restore 245e4b0a90eSBrooks Davissubcommand described below. 246e4b0a90eSBrooks Davis.Pp 247e4b0a90eSBrooks DavisAdditional options include: 248e4b0a90eSBrooks Davis.Bl -tag -width ".Fl J Ar newpassfile" 249e4b0a90eSBrooks Davis.It Fl a Ar aalgo 250e4b0a90eSBrooks DavisEnable data integrity verification (authentication) using the given algorithm. 251e4b0a90eSBrooks DavisThis will reduce the size of storage available and also reduce speed. 252e4b0a90eSBrooks DavisFor example, when using 4096 bytes sector and 253e4b0a90eSBrooks Davis.Nm HMAC/SHA256 254e4b0a90eSBrooks Davisalgorithm, 89% of the original provider storage will be available for use. 255e4b0a90eSBrooks DavisCurrently supported algorithms are: 256e4b0a90eSBrooks Davis.Nm HMAC/SHA1 , 257e4b0a90eSBrooks Davis.Nm HMAC/RIPEMD160 , 258e4b0a90eSBrooks Davis.Nm HMAC/SHA256 , 259e4b0a90eSBrooks Davis.Nm HMAC/SHA384 260e4b0a90eSBrooks Davisand 261e4b0a90eSBrooks Davis.Nm HMAC/SHA512 . 262e4b0a90eSBrooks DavisIf the option is not given, there will be no authentication, only encryption. 263e4b0a90eSBrooks DavisThe recommended algorithm is 264e4b0a90eSBrooks Davis.Nm HMAC/SHA256 . 265e4b0a90eSBrooks Davis.It Fl b 266e4b0a90eSBrooks DavisTry to decrypt this partition during boot, before the root partition is mounted. 267e4b0a90eSBrooks DavisThis makes it possible to use an encrypted root partition. 268e4b0a90eSBrooks DavisOne will still need bootable unencrypted storage with a 269e4b0a90eSBrooks Davis.Pa /boot/ 270e4b0a90eSBrooks Davisdirectory, which can be a CD-ROM disc or USB pen-drive, that can be removed 271e4b0a90eSBrooks Davisafter boot. 272e4b0a90eSBrooks Davis.It Fl B Ar backupfile 273e4b0a90eSBrooks DavisFile name to use for metadata backup instead of the default 274e4b0a90eSBrooks Davis.Pa /var/backups/<prov>.eli . 275e4b0a90eSBrooks DavisTo inhibit backups, you can use 276e4b0a90eSBrooks Davis.Pa none 277e4b0a90eSBrooks Davisas the 278e4b0a90eSBrooks Davis.Ar backupfile . 279368455ecSBen WoodsIf multiple providers were initialized in the one command, you can use 280368455ecSBen Woods.Pa PROV 281368455ecSBen Woods(all upper-case) in the file name, and it will be replaced with the provider 282368455ecSBen Woodsname. 283368455ecSBen WoodsIf 284368455ecSBen Woods.Pa PROV 285368455ecSBen Woodsis not found in the file name and multiple providers were initialized in the 286368455ecSBen Woodsone command, 287368455ecSBen Woods.Pa -<prov> 288368455ecSBen Woodswill be appended to the end of the file name specified. 289e4b0a90eSBrooks Davis.It Fl d 290e4b0a90eSBrooks DavisWhen entering the passphrase to boot from this encrypted root filesystem, echo 291e4b0a90eSBrooks Davis.Ql * 292e4b0a90eSBrooks Davischaracters. 293e4b0a90eSBrooks DavisThis makes the length of the passphrase visible. 294e4b0a90eSBrooks Davis.It Fl e Ar ealgo 295e4b0a90eSBrooks DavisEncryption algorithm to use. 296e4b0a90eSBrooks DavisCurrently supported algorithms are: 297e4b0a90eSBrooks Davis.Nm AES-XTS , 298e4b0a90eSBrooks Davis.Nm AES-CBC , 299e4b0a90eSBrooks Davis.Nm Camellia-CBC , 300e4b0a90eSBrooks Davisand 301e4b0a90eSBrooks Davis.Nm NULL . 302e4b0a90eSBrooks DavisThe default and recommended algorithm is 303e4b0a90eSBrooks Davis.Nm AES-XTS . 304e4b0a90eSBrooks Davis.Nm NULL 305e4b0a90eSBrooks Davisis unencrypted. 306e4b0a90eSBrooks Davis.It Fl g 307e4b0a90eSBrooks DavisEnable booting from this encrypted root filesystem. 308e4b0a90eSBrooks DavisThe boot loader prompts for the passphrase and loads 309e4b0a90eSBrooks Davis.Xr loader 8 310e4b0a90eSBrooks Davisfrom the encrypted partition. 311e4b0a90eSBrooks Davis.It Fl i Ar iterations 312e4b0a90eSBrooks DavisNumber of iterations to use with PKCS#5v2 when processing User Key 313e4b0a90eSBrooks Davispassphrase component. 314e4b0a90eSBrooks DavisIf this option is not specified, 315e4b0a90eSBrooks Davis.Nm 316e4b0a90eSBrooks Daviswill find the number of iterations which is equal to 2 seconds of crypto work. 317e4b0a90eSBrooks DavisIf 0 is given, PKCS#5v2 will not be used. 318e4b0a90eSBrooks DavisPKCS#5v2 processing is performed once, after all parts of the passphrase 319e4b0a90eSBrooks Daviscomponent have been read. 320e4b0a90eSBrooks Davis.It Fl J Ar newpassfile 321e4b0a90eSBrooks DavisSpecifies a file which contains the passphrase component of the User Key 322e4b0a90eSBrooks Davis(or part of it). 323e4b0a90eSBrooks DavisIf 324e4b0a90eSBrooks Davis.Ar newpassfile 325e4b0a90eSBrooks Davisis given as -, standard input will be used. 326e4b0a90eSBrooks DavisOnly the first line (excluding new-line character) is taken from the given file. 327e4b0a90eSBrooks DavisThis argument can be specified multiple times, which has the effect of 328e4b0a90eSBrooks Davisreassembling a single passphrase split across multiple files. 329e4b0a90eSBrooks DavisCannot be combined with the 330e4b0a90eSBrooks Davis.Fl P 331e4b0a90eSBrooks Davisoption. 332e4b0a90eSBrooks Davis.It Fl K Ar newkeyfile 333e4b0a90eSBrooks DavisSpecifies a file which contains the keyfile component of the User Key 334e4b0a90eSBrooks Davis(or part of it). 335e4b0a90eSBrooks DavisIf 336e4b0a90eSBrooks Davis.Ar newkeyfile 337e4b0a90eSBrooks Davisis given as -, standard input will be used. 338e4b0a90eSBrooks DavisThis argument can be specified multiple times, which has the effect of 339e4b0a90eSBrooks Davisreassembling a single keyfile split across multiple keyfile parts. 340e4b0a90eSBrooks Davis.It Fl l Ar keylen 341e4b0a90eSBrooks DavisData Key length to use with the given cryptographic algorithm. 342e4b0a90eSBrooks DavisIf the length is not specified, the selected algorithm uses its 343e4b0a90eSBrooks Davis.Em default 344e4b0a90eSBrooks Daviskey length. 345e4b0a90eSBrooks Davis.Bl -ohang -offset indent 346e4b0a90eSBrooks Davis.It Nm AES-XTS 347e4b0a90eSBrooks Davis.Em 128 , 348e4b0a90eSBrooks Davis256 349e4b0a90eSBrooks Davis.It Nm AES-CBC , Nm Camellia-CBC 350e4b0a90eSBrooks Davis.Em 128 , 351e4b0a90eSBrooks Davis192, 352e4b0a90eSBrooks Davis256 353e4b0a90eSBrooks Davis.El 354e4b0a90eSBrooks Davis.It Fl P 355e4b0a90eSBrooks DavisDo not use a passphrase as a component of the User Key. 356e4b0a90eSBrooks DavisCannot be combined with the 357e4b0a90eSBrooks Davis.Fl J 358e4b0a90eSBrooks Davisoption. 359e4b0a90eSBrooks Davis.It Fl s Ar sectorsize 360e4b0a90eSBrooks DavisChange decrypted provider's sector size. 361e4b0a90eSBrooks DavisIncreasing the sector size allows increased performance, 362e4b0a90eSBrooks Davisbecause encryption/decryption which requires an initialization vector 363e4b0a90eSBrooks Davisis done per sector; fewer sectors means less computational work. 3642f07cdf8SPawel Jakub Dawidek.It Fl R 3652f07cdf8SPawel Jakub DawidekTurn off automatic expansion. 3662f07cdf8SPawel Jakub DawidekBy default, if the underlying provider grows, the encrypted provider will 3672f07cdf8SPawel Jakub Dawidekgrow automatically too. 3682f07cdf8SPawel Jakub DawidekThe metadata will be moved to the new location. 3692f07cdf8SPawel Jakub DawidekIf automatic expansion if turned off and the underlying provider changes 3702f07cdf8SPawel Jakub Dawideksize, attaching encrypted provider will no longer be possible as the metadata 3712f07cdf8SPawel Jakub Dawidekwill no longer be located in the last sector. 3722f07cdf8SPawel Jakub DawidekIn this case 3732f07cdf8SPawel Jakub Dawidek.Nm GELI 3742f07cdf8SPawel Jakub Dawidekwill only log the previous size of the underlying provider, so metadata can 3752f07cdf8SPawel Jakub Dawidekbe found easier, if resize was done by mistake. 376e4b0a90eSBrooks Davis.It Fl T 377e4b0a90eSBrooks DavisDon't pass through 378e4b0a90eSBrooks Davis.Dv BIO_DELETE 379e4b0a90eSBrooks Daviscalls (i.e., TRIM/UNMAP). 380e4b0a90eSBrooks DavisThis can prevent an attacker from knowing how much space you're actually 381e4b0a90eSBrooks Davisusing and which sectors contain live data, but will also prevent the 382e4b0a90eSBrooks Davisbacking store (SSD, etc) from reclaiming space you're not using, which 383e4b0a90eSBrooks Davismay degrade its performance and lifespan. 384e4b0a90eSBrooks DavisThe underlying provider may or may not actually obliterate the deleted 385e4b0a90eSBrooks Davissectors when TRIM is enabled, so it should not be considered to add any 386e4b0a90eSBrooks Davissecurity. 387e4b0a90eSBrooks Davis.It Fl V Ar version 388e4b0a90eSBrooks DavisMetadata version to use. 389e4b0a90eSBrooks DavisThis option is helpful when creating a provider that may be used by older 390e4b0a90eSBrooks Davis.Nm FreeBSD/GELI 391e4b0a90eSBrooks Davisversions. 392e4b0a90eSBrooks DavisConsult the 393e4b0a90eSBrooks Davis.Sx HISTORY 394217df2daSBen Woodssection to find which metadata version is supported by which 395217df2daSBen Woods.Fx 396217df2daSBen Woodsversion. 397e4b0a90eSBrooks DavisNote that using an older version of metadata may limit the number of 398e4b0a90eSBrooks Davisfeatures available. 399e4b0a90eSBrooks Davis.El 400e4b0a90eSBrooks Davis.It Cm attach 401217df2daSBen WoodsAttach the given providers. 402217df2daSBen WoodsThe encrypted Master Keys are loaded from the metadata and decrypted 403217df2daSBen Woodsusing the given passphrase/keyfile and new GEOM providers are created 404217df2daSBen Woodsusing the specified provider names. 405217df2daSBen WoodsA 406e4b0a90eSBrooks Davis.Qq .eli 407217df2daSBen Woodssuffix is added to the user specified provider names. 408217df2daSBen WoodsMultiple providers can only be attached with a single 409217df2daSBen Woods.Cm attach 410217df2daSBen Woodscommand if they all have the same passphrase and keyfiles. 411e4b0a90eSBrooks Davis.Pp 412e4b0a90eSBrooks DavisAdditional options include: 413e4b0a90eSBrooks Davis.Bl -tag -width ".Fl j Ar passfile" 414e4b0a90eSBrooks Davis.It Fl C 415e4b0a90eSBrooks DavisDo a dry-run decryption. 416e4b0a90eSBrooks DavisThis is useful to verify passphrase and keyfile without decrypting the device. 417e4b0a90eSBrooks Davis.It Fl d 418217df2daSBen WoodsIf specified, the decrypted providers are detached automatically on last close, 419217df2daSBen Woodsso the user does not have to remember to detach 420217df2daSBen Woodsproviders after unmounting the filesystems. 421217df2daSBen WoodsThis only works when providers were opened for writing, and will not work if 422217df2daSBen Woodsthe filesystems on the providers were mounted read-only. 423e4b0a90eSBrooks DavisProbably a better choice is the 424e4b0a90eSBrooks Davis.Fl l 425e4b0a90eSBrooks Davisoption for the 426e4b0a90eSBrooks Davis.Cm detach 427e4b0a90eSBrooks Davissubcommand. 428e4b0a90eSBrooks Davis.It Fl n Ar keyno 429e4b0a90eSBrooks DavisSpecifies the index number of the Master Key copy to use (could be 0 or 1). 430e4b0a90eSBrooks DavisIf the index number is not provided all keys will be tested. 431e4b0a90eSBrooks Davis.It Fl j Ar passfile 432e4b0a90eSBrooks DavisSpecifies a file which contains the passphrase component of the User Key 433e4b0a90eSBrooks Davis(or part of it). 434e4b0a90eSBrooks DavisFor more information see the description of the 435e4b0a90eSBrooks Davis.Fl J 436e4b0a90eSBrooks Davisoption for the 437e4b0a90eSBrooks Davis.Cm init 438e4b0a90eSBrooks Davissubcommand. 439217df2daSBen WoodsThe same passfiles are used for all listed providers. 440e4b0a90eSBrooks Davis.It Fl k Ar keyfile 441e4b0a90eSBrooks DavisSpecifies a file which contains the keyfile component of the User Key 442e4b0a90eSBrooks Davis(or part of it). 443e4b0a90eSBrooks DavisFor more information see the description of the 444e4b0a90eSBrooks Davis.Fl K 445e4b0a90eSBrooks Davisoption for the 446e4b0a90eSBrooks Davis.Cm init 447e4b0a90eSBrooks Davissubcommand. 448217df2daSBen WoodsThe same keyfiles are used for all listed providers. 449e4b0a90eSBrooks Davis.It Fl p 450217df2daSBen WoodsDo not use a passphrase as a component of the User Keys. 451e4b0a90eSBrooks DavisCannot be combined with the 452e4b0a90eSBrooks Davis.Fl j 453e4b0a90eSBrooks Davisoption. 454e4b0a90eSBrooks Davis.It Fl r 455217df2daSBen WoodsAttach read-only providers. 456217df2daSBen WoodsThey are not opened for writing. 457e4b0a90eSBrooks Davis.El 458e4b0a90eSBrooks Davis.It Cm detach 459e4b0a90eSBrooks DavisDetach the given providers, which means remove the devfs entry 460e4b0a90eSBrooks Davisand clear the Master Key and Data Keys from memory. 461e4b0a90eSBrooks Davis.Pp 462e4b0a90eSBrooks DavisAdditional options include: 463e4b0a90eSBrooks Davis.Bl -tag -width ".Fl f" 464e4b0a90eSBrooks Davis.It Fl f 465e4b0a90eSBrooks DavisForce detach - detach even if the provider is open. 466e4b0a90eSBrooks Davis.It Fl l 467217df2daSBen WoodsMark provider to detach on last close, after the last filesystem has been 468217df2daSBen Woodsunmounted. 469e4b0a90eSBrooks DavisIf this option is specified, the provider will not be detached 470e4b0a90eSBrooks Daviswhile it is open, but will be automatically detached when it is closed for the 471e4b0a90eSBrooks Davislast time even if it was only opened for reading. 472e4b0a90eSBrooks Davis.El 473e4b0a90eSBrooks Davis.It Cm onetime 474e4b0a90eSBrooks DavisAttach the given providers with a random, one-time (ephemeral) Master Key. 475e4b0a90eSBrooks DavisThe command can be used to encrypt swap partitions or temporary filesystems. 476e4b0a90eSBrooks Davis.Pp 477e4b0a90eSBrooks DavisAdditional options include: 478e4b0a90eSBrooks Davis.Bl -tag -width ".Fl a Ar sectorsize" 479e4b0a90eSBrooks Davis.It Fl a Ar aalgo 480e4b0a90eSBrooks DavisEnable data integrity verification (authentication). 481e4b0a90eSBrooks DavisFor more information, see the description of the 482e4b0a90eSBrooks Davis.Cm init 483e4b0a90eSBrooks Davissubcommand. 484e4b0a90eSBrooks Davis.It Fl e Ar ealgo 485e4b0a90eSBrooks DavisEncryption algorithm to use. 486e4b0a90eSBrooks DavisFor more information, see the description of the 487e4b0a90eSBrooks Davis.Cm init 488e4b0a90eSBrooks Davissubcommand. 489e4b0a90eSBrooks Davis.It Fl d 490217df2daSBen WoodsDetach on last close, after the last filesystem has been unmounted. 491217df2daSBen WoodsNote: this option is not usable for temporary filesystems as the provider is 492217df2daSBen Woodsdetached after the filesystem has been created. 493217df2daSBen WoodsIt still can, and should, be used for swap partitions. 494e4b0a90eSBrooks DavisFor more information, see the description of the 495e4b0a90eSBrooks Davis.Cm attach 496e4b0a90eSBrooks Davissubcommand. 497e4b0a90eSBrooks Davis.It Fl l Ar keylen 498e4b0a90eSBrooks DavisData Key length to use with the given cryptographic algorithm. 499e4b0a90eSBrooks DavisFor more information, see the description of the 500e4b0a90eSBrooks Davis.Cm init 501e4b0a90eSBrooks Davissubcommand. 502e4b0a90eSBrooks Davis.It Fl s Ar sectorsize 503e4b0a90eSBrooks DavisChange decrypted provider's sector size. 504e4b0a90eSBrooks DavisFor more information, see the description of the 505e4b0a90eSBrooks Davis.Cm init 506e4b0a90eSBrooks Davissubcommand. 5072f07cdf8SPawel Jakub Dawidek.It Fl R 5082f07cdf8SPawel Jakub DawidekTurn off automatic expansion. 5092f07cdf8SPawel Jakub DawidekFor more information, see the description of the 5102f07cdf8SPawel Jakub Dawidek.Cm init 5112f07cdf8SPawel Jakub Dawideksubcommand. 512e4b0a90eSBrooks Davis.It Fl T 513e4b0a90eSBrooks DavisDisable TRIM/UNMAP passthru. 514e4b0a90eSBrooks DavisFor more information, see the description of the 515e4b0a90eSBrooks Davis.Cm init 516e4b0a90eSBrooks Davissubcommand. 517e4b0a90eSBrooks Davis.El 518e4b0a90eSBrooks Davis.It Cm configure 519e4b0a90eSBrooks DavisChange configuration of the given providers. 520e4b0a90eSBrooks Davis.Pp 521e4b0a90eSBrooks DavisAdditional options include: 522e4b0a90eSBrooks Davis.Bl -tag -width ".Fl b" 523e4b0a90eSBrooks Davis.It Fl b 524e4b0a90eSBrooks DavisSet the BOOT flag on the given providers. 525e4b0a90eSBrooks DavisFor more information, see the description of the 526e4b0a90eSBrooks Davis.Cm init 527e4b0a90eSBrooks Davissubcommand. 528e4b0a90eSBrooks Davis.It Fl B 529e4b0a90eSBrooks DavisRemove the BOOT flag from the given providers. 530e4b0a90eSBrooks Davis.It Fl d 531e4b0a90eSBrooks DavisWhen entering the passphrase to boot from this encrypted root filesystem, echo 532e4b0a90eSBrooks Davis.Ql * 533e4b0a90eSBrooks Davischaracters. 534e4b0a90eSBrooks DavisThis makes the length of the passphrase visible. 535e4b0a90eSBrooks Davis.It Fl D 536e4b0a90eSBrooks DavisDisable echoing of any characters when a passphrase is entered to boot from this 537e4b0a90eSBrooks Davisencrypted root filesystem. 538e4b0a90eSBrooks DavisThis hides the passphrase length. 539e4b0a90eSBrooks Davis.It Fl g 540e4b0a90eSBrooks DavisEnable booting from this encrypted root filesystem. 541e4b0a90eSBrooks DavisThe boot loader prompts for the passphrase and loads 542e4b0a90eSBrooks Davis.Xr loader 8 543e4b0a90eSBrooks Davisfrom the encrypted partition. 544e4b0a90eSBrooks Davis.It Fl G 545e4b0a90eSBrooks DavisDeactivate booting from this encrypted root partition. 5462f07cdf8SPawel Jakub Dawidek.It Fl r 5472f07cdf8SPawel Jakub DawidekTurn on automatic expansion. 5482f07cdf8SPawel Jakub DawidekFor more information, see the description of the 5492f07cdf8SPawel Jakub Dawidek.Cm init 5502f07cdf8SPawel Jakub Dawideksubcommand. 5512f07cdf8SPawel Jakub Dawidek.It Fl R 5522f07cdf8SPawel Jakub DawidekTurn off automatic expansion. 553e4b0a90eSBrooks Davis.It Fl t 554e4b0a90eSBrooks DavisEnable TRIM/UNMAP passthru. 555e4b0a90eSBrooks DavisFor more information, see the description of the 556e4b0a90eSBrooks Davis.Cm init 557e4b0a90eSBrooks Davissubcommand. 558e4b0a90eSBrooks Davis.It Fl T 559e4b0a90eSBrooks DavisDisable TRIM/UNMAP passthru. 560e4b0a90eSBrooks Davis.El 561e4b0a90eSBrooks Davis.It Cm setkey 562e4b0a90eSBrooks DavisInstall a copy of the Master Key into the selected slot, encrypted with 563e4b0a90eSBrooks Davisa new User Key. 564e4b0a90eSBrooks DavisIf the selected slot is populated, replace the existing copy. 565e4b0a90eSBrooks DavisA provider has one Master Key, which can be stored in one or both slots, 566e4b0a90eSBrooks Daviseach encrypted with an independent User Key. 567e4b0a90eSBrooks DavisWith the 568e4b0a90eSBrooks Davis.Cm init 569e4b0a90eSBrooks Davissubcommand, only key number 0 is initialized. 570e4b0a90eSBrooks DavisThe User Key can be changed at any time: for an attached provider, 571e4b0a90eSBrooks Davisfor a detached provider, or on the backup file. 572e4b0a90eSBrooks DavisWhen a provider is attached, the user does not have to provide 573e4b0a90eSBrooks Davisan existing passphrase/keyfile. 574e4b0a90eSBrooks Davis.Pp 575e4b0a90eSBrooks DavisAdditional options include: 576e4b0a90eSBrooks Davis.Bl -tag -width ".Fl J Ar newpassfile" 577e4b0a90eSBrooks Davis.It Fl i Ar iterations 578e4b0a90eSBrooks DavisNumber of iterations to use with PKCS#5v2. 579e4b0a90eSBrooks DavisIf 0 is given, PKCS#5v2 will not be used. 580e4b0a90eSBrooks DavisTo be able to use this option with the 581e4b0a90eSBrooks Davis.Cm setkey 582e4b0a90eSBrooks Davissubcommand, only one key has to be defined and this key must be changed. 583e4b0a90eSBrooks Davis.It Fl j Ar passfile 584e4b0a90eSBrooks DavisSpecifies a file which contains the passphrase component of a current User Key 585e4b0a90eSBrooks Davis(or part of it). 586e4b0a90eSBrooks Davis.It Fl J Ar newpassfile 587e4b0a90eSBrooks DavisSpecifies a file which contains the passphrase component of the new User Key 588e4b0a90eSBrooks Davis(or part of it). 589e4b0a90eSBrooks Davis.It Fl k Ar keyfile 590e4b0a90eSBrooks DavisSpecifies a file which contains the keyfile component of a current User Key 591e4b0a90eSBrooks Davis(or part of it). 592e4b0a90eSBrooks Davis.It Fl K Ar newkeyfile 593e4b0a90eSBrooks DavisSpecifies a file which contains the keyfile component of the new User Key 594e4b0a90eSBrooks Davis(or part of it). 595e4b0a90eSBrooks Davis.It Fl n Ar keyno 596e4b0a90eSBrooks DavisSpecifies the index number of the Master Key copy to change (could be 0 or 1). 597e4b0a90eSBrooks DavisIf the provider is attached and no key number is given, the key 598e4b0a90eSBrooks Davisused for attaching the provider will be changed. 599e4b0a90eSBrooks DavisIf the provider is detached (or we are operating on a backup file) 600e4b0a90eSBrooks Davisand no key number is given, the first Master Key copy to be successfully 601e4b0a90eSBrooks Davisdecrypted with the provided User Key passphrase/keyfile will be changed. 602e4b0a90eSBrooks Davis.It Fl p 603e4b0a90eSBrooks DavisDo not use a passphrase as a component of the current User Key. 604e4b0a90eSBrooks DavisCannot be combined with the 605e4b0a90eSBrooks Davis.Fl j 606e4b0a90eSBrooks Davisoption. 607e4b0a90eSBrooks Davis.It Fl P 608e4b0a90eSBrooks DavisDo not use a passphrase as a component of the new User Key. 609e4b0a90eSBrooks DavisCannot be combined with the 610e4b0a90eSBrooks Davis.Fl J 611e4b0a90eSBrooks Davisoption. 612e4b0a90eSBrooks Davis.El 613e4b0a90eSBrooks Davis.It Cm delkey 614e4b0a90eSBrooks DavisDestroy (overwrite with random data) the selected Master Key copy. 615e4b0a90eSBrooks DavisIf one is destroying keys for an attached provider, the provider 616e4b0a90eSBrooks Daviswill not be detached even if all copies of the Master Key are destroyed. 617e4b0a90eSBrooks DavisIt can even be rescued with the 618e4b0a90eSBrooks Davis.Cm setkey 619e4b0a90eSBrooks Davissubcommand because the Master Key is still in memory. 620e4b0a90eSBrooks Davis.Pp 621e4b0a90eSBrooks DavisAdditional options include: 622e4b0a90eSBrooks Davis.Bl -tag -width ".Fl a Ar keyno" 623e4b0a90eSBrooks Davis.It Fl a 624e4b0a90eSBrooks DavisDestroy all copies of the Master Key (does not need 625e4b0a90eSBrooks Davis.Fl f 626e4b0a90eSBrooks Davisoption). 627e4b0a90eSBrooks Davis.It Fl f 628e4b0a90eSBrooks DavisForce key destruction. 629e4b0a90eSBrooks DavisThis option is needed to destroy the last copy of the Master Key. 630e4b0a90eSBrooks Davis.It Fl n Ar keyno 631e4b0a90eSBrooks DavisSpecifies the index number of the Master Key copy. 632e4b0a90eSBrooks DavisIf the provider is attached and no key number is given, the key 633e4b0a90eSBrooks Davisused for attaching the provider will be destroyed. 634e4b0a90eSBrooks DavisIf provider is detached (or we are operating on a backup file) the key number 635e4b0a90eSBrooks Davishas to be given. 636e4b0a90eSBrooks Davis.El 637e4b0a90eSBrooks Davis.It Cm kill 638e4b0a90eSBrooks DavisThis command should be used only in emergency situations. 639e4b0a90eSBrooks DavisIt will destroy all copies of the Master Key on a given provider and will 640e4b0a90eSBrooks Davisdetach it forcibly (if it is attached). 641e4b0a90eSBrooks DavisThis is absolutely a one-way command - if you do not have a metadata 642e4b0a90eSBrooks Davisbackup, your data is gone for good. 643e4b0a90eSBrooks DavisIn case the provider was attached with the 644e4b0a90eSBrooks Davis.Fl r 645e4b0a90eSBrooks Davisflag, the keys will not be destroyed, only the provider will be detached. 646e4b0a90eSBrooks Davis.Pp 647e4b0a90eSBrooks DavisAdditional options include: 648e4b0a90eSBrooks Davis.Bl -tag -width ".Fl a" 649e4b0a90eSBrooks Davis.It Fl a 650e4b0a90eSBrooks DavisIf specified, all currently attached providers will be killed. 651e4b0a90eSBrooks Davis.El 652e4b0a90eSBrooks Davis.It Cm backup 653e4b0a90eSBrooks DavisBackup metadata from the given provider to the given file. 654e4b0a90eSBrooks Davis.It Cm restore 655e4b0a90eSBrooks DavisRestore metadata from the given file to the given provider. 656e4b0a90eSBrooks Davis.Pp 657e4b0a90eSBrooks DavisAdditional options include: 658e4b0a90eSBrooks Davis.Bl -tag -width ".Fl f" 659e4b0a90eSBrooks Davis.It Fl f 660e4b0a90eSBrooks DavisMetadata contains the size of the provider to ensure that the correct 661e4b0a90eSBrooks Davispartition or slice is attached. 662e4b0a90eSBrooks DavisIf an attempt is made to restore metadata to a provider that has a different 663e4b0a90eSBrooks Davissize, 664e4b0a90eSBrooks Davis.Nm 665e4b0a90eSBrooks Daviswill refuse to restore the data unless the 666e4b0a90eSBrooks Davis.Fl f 667e4b0a90eSBrooks Davisswitch is used. 668e4b0a90eSBrooks DavisIf the partition or slice has been grown, the 669e4b0a90eSBrooks Davis.Cm resize 670e4b0a90eSBrooks Davissubcommand should be used rather than attempting to relocate the metadata 671e4b0a90eSBrooks Davisthrough 672e4b0a90eSBrooks Davis.Cm backup 673e4b0a90eSBrooks Davisand 674e4b0a90eSBrooks Davis.Cm restore . 675e4b0a90eSBrooks Davis.El 676e4b0a90eSBrooks Davis.It Cm suspend 677e4b0a90eSBrooks DavisSuspend device by waiting for all inflight requests to finish, clearing all 678217df2daSBen Woodssensitive information such as the Master Key and Data Keys from kernel memory, 679e4b0a90eSBrooks Davisand blocking all further I/O requests until the 680e4b0a90eSBrooks Davis.Cm resume 681e4b0a90eSBrooks Davissubcommand is executed. 682217df2daSBen WoodsThis functionality is useful for laptops. 683217df2daSBen WoodsSuspending a laptop should not leave an encrypted device attached. 684217df2daSBen WoodsThe 685e4b0a90eSBrooks Davis.Cm suspend 686217df2daSBen Woodssubcommand can be used rather than closing all files and directories from 687217df2daSBen Woodsfilesystems on the encrypted device, unmounting the filesystem, and 688217df2daSBen Woodsdetaching the device. 689e4b0a90eSBrooks DavisAny access to the encrypted device will be blocked until the Master Key is 690e4b0a90eSBrooks Davisreloaded through the 691e4b0a90eSBrooks Davis.Cm resume 692e4b0a90eSBrooks Davissubcommand. 693e4b0a90eSBrooks DavisThus there is no need to close nor unmount anything. 694e4b0a90eSBrooks DavisThe 695e4b0a90eSBrooks Davis.Cm suspend 696e4b0a90eSBrooks Davissubcommand does not work with devices created with the 697e4b0a90eSBrooks Davis.Cm onetime 698e4b0a90eSBrooks Davissubcommand. 699217df2daSBen WoodsPlease note that sensitive data might still be present in memory locations 700217df2daSBen Woodssuch as the filesystem cache after suspending an encrypted device. 701e4b0a90eSBrooks Davis.Pp 702e4b0a90eSBrooks DavisAdditional options include: 703e4b0a90eSBrooks Davis.Bl -tag -width ".Fl a" 704e4b0a90eSBrooks Davis.It Fl a 705e4b0a90eSBrooks DavisSuspend all 706e4b0a90eSBrooks Davis.Nm 707e4b0a90eSBrooks Davisdevices. 708e4b0a90eSBrooks Davis.El 709e4b0a90eSBrooks Davis.It Cm resume 710e4b0a90eSBrooks DavisResume previously suspended device. 711e4b0a90eSBrooks DavisThe caller must ensure that executing this subcommand does not access the 712e4b0a90eSBrooks Davissuspended device, leading to a deadlock. 713217df2daSBen WoodsFor example, suspending a device which contains the filesystem where the 714e4b0a90eSBrooks Davis.Nm 715217df2daSBen Woodsutility is stored is a bad idea. 716e4b0a90eSBrooks Davis.Pp 717e4b0a90eSBrooks DavisAdditional options include: 718e4b0a90eSBrooks Davis.Bl -tag -width ".Fl j Ar passfile" 719e4b0a90eSBrooks Davis.It Fl j Ar passfile 720217df2daSBen WoodsSpecifies a file which contains the passphrase component of the User Key, 721217df2daSBen Woodsor part of it. 722e4b0a90eSBrooks DavisFor more information see the description of the 723e4b0a90eSBrooks Davis.Fl J 724e4b0a90eSBrooks Davisoption for the 725e4b0a90eSBrooks Davis.Cm init 726e4b0a90eSBrooks Davissubcommand. 727e4b0a90eSBrooks Davis.It Fl k Ar keyfile 728217df2daSBen WoodsSpecifies a file which contains the keyfile component of the User Key, 729217df2daSBen Woodsor part of it. 730e4b0a90eSBrooks DavisFor more information see the description of the 731e4b0a90eSBrooks Davis.Fl K 732e4b0a90eSBrooks Davisoption for the 733e4b0a90eSBrooks Davis.Cm init 734e4b0a90eSBrooks Davissubcommand. 735e4b0a90eSBrooks Davis.It Fl p 736e4b0a90eSBrooks DavisDo not use a passphrase as a component of the User Key. 737e4b0a90eSBrooks DavisCannot be combined with the 738e4b0a90eSBrooks Davis.Fl j 739e4b0a90eSBrooks Davisoption. 740e4b0a90eSBrooks Davis.El 741e4b0a90eSBrooks Davis.It Cm resize 742e4b0a90eSBrooks DavisInform 743e4b0a90eSBrooks Davis.Nm 744e4b0a90eSBrooks Davisthat the provider has been resized. 745e4b0a90eSBrooks DavisThe old metadata block is relocated to the correct position at the end of the 746e4b0a90eSBrooks Davisprovider and the provider size is updated. 747e4b0a90eSBrooks Davis.Pp 748e4b0a90eSBrooks DavisAdditional options include: 749e4b0a90eSBrooks Davis.Bl -tag -width ".Fl s Ar oldsize" 750e4b0a90eSBrooks Davis.It Fl s Ar oldsize 751e4b0a90eSBrooks DavisThe size of the provider before it was resized. 752e4b0a90eSBrooks Davis.El 753e4b0a90eSBrooks Davis.It Cm version 754e4b0a90eSBrooks DavisIf no arguments are given, the 755e4b0a90eSBrooks Davis.Cm version 756e4b0a90eSBrooks Davissubcommand will print the version of 757e4b0a90eSBrooks Davis.Nm 758e4b0a90eSBrooks Davisuserland utility as well as the version of the 759e4b0a90eSBrooks Davis.Nm ELI 760e4b0a90eSBrooks DavisGEOM class. 761e4b0a90eSBrooks Davis.Pp 762e4b0a90eSBrooks DavisIf GEOM providers are specified, the 763e4b0a90eSBrooks Davis.Cm version 764e4b0a90eSBrooks Davissubcommand will print metadata version used by each of them. 765e4b0a90eSBrooks Davis.It Cm clear 766e4b0a90eSBrooks DavisClear metadata from the given providers. 767e4b0a90eSBrooks Davis.Em WARNING : 768e4b0a90eSBrooks DavisThis will erase with zeros the encrypted Master Key copies stored in the 769e4b0a90eSBrooks Davismetadata. 770e4b0a90eSBrooks Davis.It Cm dump 771e4b0a90eSBrooks DavisDump metadata stored on the given providers. 772e4b0a90eSBrooks Davis.It Cm list 773e4b0a90eSBrooks DavisSee 774e4b0a90eSBrooks Davis.Xr geom 8 . 775e4b0a90eSBrooks Davis.It Cm status 776e4b0a90eSBrooks DavisSee 777e4b0a90eSBrooks Davis.Xr geom 8 . 778e4b0a90eSBrooks Davis.It Cm load 779e4b0a90eSBrooks DavisSee 780e4b0a90eSBrooks Davis.Xr geom 8 . 781e4b0a90eSBrooks Davis.It Cm unload 782e4b0a90eSBrooks DavisSee 783e4b0a90eSBrooks Davis.Xr geom 8 . 784e4b0a90eSBrooks Davis.El 785e4b0a90eSBrooks Davis.Pp 786e4b0a90eSBrooks DavisAdditional options include: 787e4b0a90eSBrooks Davis.Bl -tag -width ".Fl v" 788e4b0a90eSBrooks Davis.It Fl v 789e4b0a90eSBrooks DavisBe more verbose. 790e4b0a90eSBrooks Davis.El 791e4b0a90eSBrooks Davis.Sh KEY SUMMARY 792e4b0a90eSBrooks Davis.Ss Master Key 793e4b0a90eSBrooks DavisUpon 794e4b0a90eSBrooks Davis.Cm init , 795e4b0a90eSBrooks Davisthe 796e4b0a90eSBrooks Davis.Nm 797e4b0a90eSBrooks Davisutility generates a random Master Key for the provider. 798e4b0a90eSBrooks DavisThe Master Key never changes during the lifetime of the provider. 799e4b0a90eSBrooks DavisEach copy of the provider metadata, active or backed up to a file, can store 800e4b0a90eSBrooks Davisup to two, independently-encrypted copies of the Master Key. 801e4b0a90eSBrooks Davis.Ss User Key 802e4b0a90eSBrooks DavisEach stored copy of the Master Key is encrypted with a User Key, which 803e4b0a90eSBrooks Davisis generated by the 804e4b0a90eSBrooks Davis.Nm 805e4b0a90eSBrooks Davisutility from a passphrase and/or a keyfile. 806e4b0a90eSBrooks DavisThe 807e4b0a90eSBrooks Davis.Nm 808e4b0a90eSBrooks Davisutility first reads all parts of the keyfile in the order specified on the 809e4b0a90eSBrooks Daviscommand line, then reads all parts of the stored passphrase in the order 810e4b0a90eSBrooks Davisspecified on the command line. 811e4b0a90eSBrooks DavisIf no passphrase parts are specified, the system prompts the user to enter 812e4b0a90eSBrooks Davisthe passphrase. 813e4b0a90eSBrooks DavisThe passphrase is optionally strengthened by PKCS#5v2. 814e4b0a90eSBrooks DavisThe User Key is a digest computed over the concatenated keyfile and passphrase. 815e4b0a90eSBrooks Davis.Ss Data Key 816e4b0a90eSBrooks DavisDuring operation, one or more Data Keys are deterministically derived by 817e4b0a90eSBrooks Davisthe kernel from the Master Key and cached in memory. 818e4b0a90eSBrooks DavisThe number of Data Keys used by a given provider, and the way they are 819e4b0a90eSBrooks Davisderived, depend on the GELI version and whether the provider is configured to 820e4b0a90eSBrooks Davisuse data authentication. 821e4b0a90eSBrooks Davis.Sh SYSCTL VARIABLES 822e4b0a90eSBrooks DavisThe following 823e4b0a90eSBrooks Davis.Xr sysctl 8 824e4b0a90eSBrooks Davisvariables can be used to control the behavior of the 825e4b0a90eSBrooks Davis.Nm ELI 826e4b0a90eSBrooks DavisGEOM class. 827e4b0a90eSBrooks DavisThe default value is shown next to each variable. 828e4b0a90eSBrooks DavisSome variables can also be set in 829e4b0a90eSBrooks Davis.Pa /boot/loader.conf . 830e4b0a90eSBrooks Davis.Bl -tag -width indent 831e4b0a90eSBrooks Davis.It Va kern.geom.eli.version 832e4b0a90eSBrooks DavisVersion number of the 833e4b0a90eSBrooks Davis.Nm ELI 834e4b0a90eSBrooks DavisGEOM class. 835e4b0a90eSBrooks Davis.It Va kern.geom.eli.debug : No 0 836e4b0a90eSBrooks DavisDebug level of the 837e4b0a90eSBrooks Davis.Nm ELI 838e4b0a90eSBrooks DavisGEOM class. 839e4b0a90eSBrooks DavisThis can be set to a number between 0 and 3 inclusive. 840e4b0a90eSBrooks DavisIf set to 0, minimal debug information is printed. 841e4b0a90eSBrooks DavisIf set to 3, the 842e4b0a90eSBrooks Davismaximum amount of debug information is printed. 843e4b0a90eSBrooks Davis.It Va kern.geom.eli.tries : No 3 844e4b0a90eSBrooks DavisNumber of times a user is asked for the passphrase. 845217df2daSBen WoodsThis is only used for providers which are attached on boot, 846217df2daSBen Woodsbefore the root filesystem is mounted. 847e4b0a90eSBrooks DavisIf set to 0, attaching providers on boot will be disabled. 848e4b0a90eSBrooks DavisThis variable should be set in 849e4b0a90eSBrooks Davis.Pa /boot/loader.conf . 850e4b0a90eSBrooks Davis.It Va kern.geom.eli.overwrites : No 5 851217df2daSBen WoodsSpecifies how many times the Master Key is overwritten 852e4b0a90eSBrooks Daviswith random values when it is destroyed. 853e4b0a90eSBrooks DavisAfter this operation it is filled with zeros. 854*4b794914SAlan Somers.It Va kern.geom.eli.use_uma_bytes 855*4b794914SAlan Somers.Nm 856*4b794914SAlan Somersmust allocate a buffer for every write operation, used when performing 857*4b794914SAlan Somersencryption. 858*4b794914SAlan SomersThis sysctl reports the maximum size in bytes for which geli will perform the 859*4b794914SAlan Somersallocation using 860*4b794914SAlan Somers.Xr UMA 9 , 861*4b794914SAlan Somersas opposed to 862*4b794914SAlan Somers.Xr malloc 9 . 863e4b0a90eSBrooks Davis.It Va kern.geom.eli.visible_passphrase : No 0 864217df2daSBen WoodsIf set to 1, the passphrase entered on boot will be visible. 865e4b0a90eSBrooks DavisThis alternative should be used with caution as the entered 866e4b0a90eSBrooks Davispassphrase can be logged and exposed via 867e4b0a90eSBrooks Davis.Xr dmesg 8 . 868e4b0a90eSBrooks DavisThis variable should be set in 869e4b0a90eSBrooks Davis.Pa /boot/loader.conf . 870e4b0a90eSBrooks Davis.It Va kern.geom.eli.threads : No 0 871e4b0a90eSBrooks DavisSpecifies how many kernel threads should be used for doing software 872e4b0a90eSBrooks Daviscryptography. 873e4b0a90eSBrooks DavisIts purpose is to increase performance on SMP systems. 874e4b0a90eSBrooks DavisIf set to 0, a CPU-pinned thread will be started for every active CPU. 875*4b794914SAlan SomersNote that this variable must be set prior to attaching 876*4b794914SAlan Somers.Nm 877*4b794914SAlan Somersto a disk. 878e4b0a90eSBrooks Davis.It Va kern.geom.eli.batch : No 0 879e4b0a90eSBrooks DavisWhen set to 1, can speed-up crypto operations by using batching. 880e4b0a90eSBrooks DavisBatching reduces the number of interrupts by responding to a group of 881e4b0a90eSBrooks Daviscrypto requests with one interrupt. 882c0f02dcdSAlan SomersThe crypto card and the driver have to support this feature. 883e4b0a90eSBrooks Davis.It Va kern.geom.eli.key_cache_limit : No 8192 884e4b0a90eSBrooks DavisSpecifies how many Data Keys to cache. 885e4b0a90eSBrooks DavisThe default limit 886e4b0a90eSBrooks Davis(8192 keys) will allow caching of all keys for a 4TB provider with 512 byte 887e4b0a90eSBrooks Davissectors and will take around 1MB of memory. 888e4b0a90eSBrooks Davis.It Va kern.geom.eli.key_cache_hits 889e4b0a90eSBrooks DavisReports how many times we were looking up a Data Key and it was already in 890e4b0a90eSBrooks Daviscache. 891e4b0a90eSBrooks DavisThis sysctl is not updated for providers that need fewer Data Keys than 892e4b0a90eSBrooks Davisthe limit specified in 893e4b0a90eSBrooks Davis.Va kern.geom.eli.key_cache_limit . 894e4b0a90eSBrooks Davis.It Va kern.geom.eli.key_cache_misses 895e4b0a90eSBrooks DavisReports how many times we were looking up a Data Key and it was not in cache. 896e4b0a90eSBrooks DavisThis sysctl is not updated for providers that need fewer Data Keys than the limit 897e4b0a90eSBrooks Davisspecified in 898e4b0a90eSBrooks Davis.Va kern.geom.eli.key_cache_limit . 899c0f02dcdSAlan Somers.It Va kern.geom.eli.unmapped_io 900081b4452SMark JohnstonEnable support for unmapped I/O buffers, currently implemented only on 64-bit 901081b4452SMark Johnstonplatforms. 902081b4452SMark JohnstonThis is an optimization which reduces the overhead of I/O processing. 903081b4452SMark JohnstonThis variable is intended for debugging purposes and must be set in 904081b4452SMark Johnston.Pa /boot/loader.conf . 905e4b0a90eSBrooks Davis.El 906*4b794914SAlan Somers.Sh PERFORMANCE CONSIDERATIONS 907*4b794914SAlan SomersThe default value of 908*4b794914SAlan Somers.Va kern.geom.eli.threads 909*4b794914SAlan Somersis usually good for a system with one SSD. 910*4b794914SAlan SomersHowever, it may need to be lowered on systems with many disks, 911*4b794914SAlan Somersso as to avoid creating too much thread-switching overhead. 912*4b794914SAlan SomersOn systems with more disks than CPUs, it's best to set this variable 913*4b794914SAlan Somersto 1. 914*4b794914SAlan Somers.Pp 915*4b794914SAlan Somers.Nm 916*4b794914SAlan Somersinternally uses 917*4b794914SAlan Somers.Xr malloc 9 918*4b794914SAlan Somersto allocate memory for operations larger than 919*4b794914SAlan Somers.Va kern.geom.eli.use_uma_bytes , 920*4b794914SAlan Somersbut malloc is slow for allocations larger than 921*4b794914SAlan Somers.Va vm.kmem_zmax . 922*4b794914SAlan SomersSo it's best to avoid writing more than 923*4b794914SAlan Somers.Ms MAX(kern.geom.eli.use_uma_bytes, vm.kmem_zmax) 924*4b794914SAlan Somersin a single write operation. 925*4b794914SAlan SomersOn systems that format 926*4b794914SAlan Somers.Xr zfs 4 927*4b794914SAlan Somerson top of 928*4b794914SAlan Somers.Nm , 929*4b794914SAlan Somersthe maximum write size can be controlled by 930*4b794914SAlan Somers.Va vfs.zfs.vdev.aggregation_limit 931*4b794914SAlan Somersand 932*4b794914SAlan Somers.Va vfs.zfs.vdev.aggregation_limit_non_rotating 933*4b794914SAlan Somersfor HDDs and SSDs, respectively. 934e4b0a90eSBrooks Davis.Sh EXIT STATUS 935e4b0a90eSBrooks DavisExit status is 0 on success, and 1 if the command fails. 936e4b0a90eSBrooks Davis.Sh EXAMPLES 937e4b0a90eSBrooks DavisInitialize a provider which is going to be encrypted with a 938e4b0a90eSBrooks Davispassphrase and random data from a file on the user's pen drive. 939e4b0a90eSBrooks DavisUse 4kB sector size. 940e4b0a90eSBrooks DavisAttach the provider, create a filesystem, and mount it. 941e4b0a90eSBrooks DavisDo the work. 942e4b0a90eSBrooks DavisUnmount the provider and detach it: 943e4b0a90eSBrooks Davis.Bd -literal -offset indent 944e4b0a90eSBrooks Davis# dd if=/dev/random of=/mnt/pendrive/da2.key bs=64 count=1 945e4b0a90eSBrooks Davis# geli init -s 4096 -K /mnt/pendrive/da2.key /dev/da2 946e4b0a90eSBrooks DavisEnter new passphrase: 947e4b0a90eSBrooks DavisReenter new passphrase: 948e4b0a90eSBrooks Davis# geli attach -k /mnt/pendrive/da2.key /dev/da2 949e4b0a90eSBrooks DavisEnter passphrase: 950e4b0a90eSBrooks Davis# dd if=/dev/random of=/dev/da2.eli bs=1m 951e4b0a90eSBrooks Davis# newfs /dev/da2.eli 952e4b0a90eSBrooks Davis# mount /dev/da2.eli /mnt/secret 953e4b0a90eSBrooks Davis\&... 954e4b0a90eSBrooks Davis# umount /mnt/secret 955e4b0a90eSBrooks Davis# geli detach da2.eli 956e4b0a90eSBrooks Davis.Ed 957e4b0a90eSBrooks Davis.Pp 958e4b0a90eSBrooks DavisCreate an encrypted provider, but use two User Keys: 959e4b0a90eSBrooks Davisone for your employee and one for you as the company's security officer 960e4b0a90eSBrooks Davis(so it is not a tragedy if the employee 961e4b0a90eSBrooks Davis.Qq accidentally 962e4b0a90eSBrooks Davisforgets his passphrase): 963e4b0a90eSBrooks Davis.Bd -literal -offset indent 964e4b0a90eSBrooks Davis# geli init /dev/da2 965e4b0a90eSBrooks DavisEnter new passphrase: (enter security officer's passphrase) 966e4b0a90eSBrooks DavisReenter new passphrase: 967e4b0a90eSBrooks Davis# geli setkey -n 1 /dev/da2 968e4b0a90eSBrooks DavisEnter passphrase: (enter security officer's passphrase) 969e4b0a90eSBrooks DavisEnter new passphrase: (let your employee enter his passphrase ...) 970e4b0a90eSBrooks DavisReenter new passphrase: (... twice) 971e4b0a90eSBrooks Davis.Ed 972e4b0a90eSBrooks Davis.Pp 973e4b0a90eSBrooks DavisYou are the security officer in your company. 974e4b0a90eSBrooks DavisCreate an encrypted provider for use by the user, but remember that users 975e4b0a90eSBrooks Davisforget their passphrases, so backup the Master Key with your own random key: 976e4b0a90eSBrooks Davis.Bd -literal -offset indent 977e4b0a90eSBrooks Davis# dd if=/dev/random of=/mnt/pendrive/keys/`hostname` bs=64 count=1 978e4b0a90eSBrooks Davis# geli init -P -K /mnt/pendrive/keys/`hostname` /dev/ada0s1e 979e4b0a90eSBrooks Davis# geli backup /dev/ada0s1e /mnt/pendrive/backups/`hostname` 980e4b0a90eSBrooks Davis(use key number 0, so the encrypted Master Key will be re-encrypted by this) 981e4b0a90eSBrooks Davis# geli setkey -n 0 -k /mnt/pendrive/keys/`hostname` /dev/ada0s1e 982e4b0a90eSBrooks Davis(allow the user to enter his passphrase) 983e4b0a90eSBrooks DavisEnter new passphrase: 984e4b0a90eSBrooks DavisReenter new passphrase: 985e4b0a90eSBrooks Davis.Ed 986e4b0a90eSBrooks Davis.Pp 987e4b0a90eSBrooks DavisEncrypted swap partition setup: 988e4b0a90eSBrooks Davis.Bd -literal -offset indent 989e4b0a90eSBrooks Davis# dd if=/dev/random of=/dev/ada0s1b bs=1m 990e2b99193SJohn Baldwin# geli onetime -d ada0s1b 991e4b0a90eSBrooks Davis# swapon /dev/ada0s1b.eli 992e4b0a90eSBrooks Davis.Ed 993e4b0a90eSBrooks Davis.Pp 994e4b0a90eSBrooks DavisThe example below shows how to configure two providers which will be attached 995217df2daSBen Woodson boot, before the root filesystem is mounted. 996e4b0a90eSBrooks DavisOne of them is using passphrase and three keyfile parts and the other is 997e4b0a90eSBrooks Davisusing only a keyfile in one part: 998e4b0a90eSBrooks Davis.Bd -literal -offset indent 999e4b0a90eSBrooks Davis# dd if=/dev/random of=/dev/da0 bs=1m 1000e4b0a90eSBrooks Davis# dd if=/dev/random of=/boot/keys/da0.key0 bs=32k count=1 1001e4b0a90eSBrooks Davis# dd if=/dev/random of=/boot/keys/da0.key1 bs=32k count=1 1002e4b0a90eSBrooks Davis# dd if=/dev/random of=/boot/keys/da0.key2 bs=32k count=1 1003e4b0a90eSBrooks Davis# geli init -b -K /boot/keys/da0.key0 -K /boot/keys/da0.key1 -K /boot/keys/da0.key2 da0 1004e4b0a90eSBrooks DavisEnter new passphrase: 1005e4b0a90eSBrooks DavisReenter new passphrase: 1006e4b0a90eSBrooks Davis# dd if=/dev/random of=/dev/da1s3a bs=1m 1007e4b0a90eSBrooks Davis# dd if=/dev/random of=/boot/keys/da1s3a.key bs=128k count=1 1008e4b0a90eSBrooks Davis# geli init -b -P -K /boot/keys/da1s3a.key da1s3a 1009e4b0a90eSBrooks Davis.Ed 1010e4b0a90eSBrooks Davis.Pp 1011e4b0a90eSBrooks DavisThe providers are initialized, now we have to add these lines to 1012e4b0a90eSBrooks Davis.Pa /boot/loader.conf : 1013e4b0a90eSBrooks Davis.Bd -literal -offset indent 1014e4b0a90eSBrooks Davisgeli_da0_keyfile0_load="YES" 1015e4b0a90eSBrooks Davisgeli_da0_keyfile0_type="da0:geli_keyfile0" 1016e4b0a90eSBrooks Davisgeli_da0_keyfile0_name="/boot/keys/da0.key0" 1017e4b0a90eSBrooks Davisgeli_da0_keyfile1_load="YES" 1018e4b0a90eSBrooks Davisgeli_da0_keyfile1_type="da0:geli_keyfile1" 1019e4b0a90eSBrooks Davisgeli_da0_keyfile1_name="/boot/keys/da0.key1" 1020e4b0a90eSBrooks Davisgeli_da0_keyfile2_load="YES" 1021e4b0a90eSBrooks Davisgeli_da0_keyfile2_type="da0:geli_keyfile2" 1022e4b0a90eSBrooks Davisgeli_da0_keyfile2_name="/boot/keys/da0.key2" 1023e4b0a90eSBrooks Davis 1024e4b0a90eSBrooks Davisgeli_da1s3a_keyfile0_load="YES" 1025e4b0a90eSBrooks Davisgeli_da1s3a_keyfile0_type="da1s3a:geli_keyfile0" 1026e4b0a90eSBrooks Davisgeli_da1s3a_keyfile0_name="/boot/keys/da1s3a.key" 1027e4b0a90eSBrooks Davis.Ed 1028e4b0a90eSBrooks Davis.Pp 1029e4b0a90eSBrooks DavisIf there is only one keyfile, the index might be omitted: 1030e4b0a90eSBrooks Davis.Bd -literal -offset indent 1031e4b0a90eSBrooks Davisgeli_da1s3a_keyfile_load="YES" 1032e4b0a90eSBrooks Davisgeli_da1s3a_keyfile_type="da1s3a:geli_keyfile" 1033e4b0a90eSBrooks Davisgeli_da1s3a_keyfile_name="/boot/keys/da1s3a.key" 1034e4b0a90eSBrooks Davis.Ed 1035e4b0a90eSBrooks Davis.Pp 10369168ef5bSMateusz PiotrowskiBy convention, these loader variables are called 10379168ef5bSMateusz Piotrowski.Sm off 10389168ef5bSMateusz Piotrowski.Va geli_ No < Ar device No > Va _load . 10399168ef5bSMateusz Piotrowski.Sm on 10409168ef5bSMateusz PiotrowskiHowever, the actual name prefix before 10419168ef5bSMateusz Piotrowski.Va _load , _type , 10429168ef5bSMateusz Piotrowskior 10439168ef5bSMateusz Piotrowski.Va _name 10449168ef5bSMateusz Piotrowskidoes not matter. 10459168ef5bSMateusz PiotrowskiAt boot time, the 10469168ef5bSMateusz Piotrowski.Nm 10479168ef5bSMateusz Piotrowskimodule searches through all 10489168ef5bSMateusz Piotrowski.Sm off 10499168ef5bSMateusz Piotrowski.No < Va prefix No > Va _type No -like 10509168ef5bSMateusz Piotrowski.Sm on 10519168ef5bSMateusz Piotrowskivariables that have a value of 10529168ef5bSMateusz Piotrowski.Sm off 10539168ef5bSMateusz Piotrowski.Dq < Ar device No > :geli_keyfile . 10549168ef5bSMateusz Piotrowski.Sm on 10559168ef5bSMateusz PiotrowskiThe paths to keyfiles are then extracted from 10569168ef5bSMateusz Piotrowski.Sm off 10579168ef5bSMateusz Piotrowski.No < Ar prefix No > Va _name 10589168ef5bSMateusz Piotrowski.Sm on 10599168ef5bSMateusz Piotrowskivariables. 10609168ef5bSMateusz PiotrowskiIn the example above, 10619168ef5bSMateusz Piotrowski.Ar prefix 10629168ef5bSMateusz Piotrowskiis 10639168ef5bSMateusz Piotrowski.Dq Li geli_da1s3a_keyfile . 10649168ef5bSMateusz Piotrowski.Pp 1065e4b0a90eSBrooks DavisNot only configure encryption, but also data integrity verification using 1066e4b0a90eSBrooks Davis.Nm HMAC/SHA256 . 1067e4b0a90eSBrooks Davis.Bd -literal -offset indent 1068e4b0a90eSBrooks Davis# geli init -a hmac/sha256 -s 4096 /dev/da0 1069e4b0a90eSBrooks DavisEnter new passphrase: 1070e4b0a90eSBrooks DavisReenter new passphrase: 1071e4b0a90eSBrooks Davis# geli attach /dev/da0 1072e4b0a90eSBrooks DavisEnter passphrase: 1073e4b0a90eSBrooks Davis# dd if=/dev/random of=/dev/da0.eli bs=1m 1074e4b0a90eSBrooks Davis# newfs /dev/da0.eli 1075e4b0a90eSBrooks Davis# mount /dev/da0.eli /mnt/secret 1076e4b0a90eSBrooks Davis.Ed 1077e4b0a90eSBrooks Davis.Pp 1078e4b0a90eSBrooks Davis.Cm geli 1079e4b0a90eSBrooks Daviswrites the metadata backup by default to the 1080e4b0a90eSBrooks Davis.Pa /var/backups/<prov>.eli 1081e4b0a90eSBrooks Davisfile. 1082e4b0a90eSBrooks DavisIf the metadata is lost in any way (e.g., by accidental overwrite), it can be restored. 1083e4b0a90eSBrooks DavisConsider the following situation: 1084e4b0a90eSBrooks Davis.Bd -literal -offset indent 1085e4b0a90eSBrooks Davis# geli init /dev/da0 1086e4b0a90eSBrooks DavisEnter new passphrase: 1087e4b0a90eSBrooks DavisReenter new passphrase: 1088e4b0a90eSBrooks Davis 1089e4b0a90eSBrooks DavisMetadata backup can be found in /var/backups/da0.eli and 1090e4b0a90eSBrooks Daviscan be restored with the following command: 1091e4b0a90eSBrooks Davis 1092e4b0a90eSBrooks Davis # geli restore /var/backups/da0.eli /dev/da0 1093e4b0a90eSBrooks Davis 1094e4b0a90eSBrooks Davis# geli clear /dev/da0 1095e4b0a90eSBrooks Davis# geli attach /dev/da0 1096e4b0a90eSBrooks Davisgeli: Cannot read metadata from /dev/da0: Invalid argument. 1097e4b0a90eSBrooks Davis# geli restore /var/backups/da0.eli /dev/da0 1098e4b0a90eSBrooks Davis# geli attach /dev/da0 1099e4b0a90eSBrooks DavisEnter passphrase: 1100e4b0a90eSBrooks Davis.Ed 1101e4b0a90eSBrooks Davis.Pp 1102e4b0a90eSBrooks DavisIf an encrypted filesystem is extended, it is necessary to relocate and 1103e4b0a90eSBrooks Davisupdate the metadata: 1104e4b0a90eSBrooks Davis.Bd -literal -offset indent 1105e4b0a90eSBrooks Davis# gpart create -s GPT ada0 1106e4b0a90eSBrooks Davis# gpart add -s 1g -t freebsd-ufs -i 1 ada0 1107e4b0a90eSBrooks Davis# geli init -K keyfile -P ada0p1 1108e4b0a90eSBrooks Davis# gpart resize -s 2g -i 1 ada0 1109e4b0a90eSBrooks Davis# geli resize -s 1g ada0p1 1110e4b0a90eSBrooks Davis# geli attach -k keyfile -p ada0p1 1111e4b0a90eSBrooks Davis.Ed 1112e4b0a90eSBrooks Davis.Pp 1113e4b0a90eSBrooks DavisInitialize provider with the passphrase split into two files. 1114e4b0a90eSBrooks DavisThe provider can be attached using those two files or by entering 1115e4b0a90eSBrooks Davis.Dq foobar 1116e4b0a90eSBrooks Davisas the passphrase at the 1117e4b0a90eSBrooks Davis.Nm 1118e4b0a90eSBrooks Davisprompt: 1119e4b0a90eSBrooks Davis.Bd -literal -offset indent 1120e4b0a90eSBrooks Davis# echo foo > da0.pass0 1121e4b0a90eSBrooks Davis# echo bar > da0.pass1 1122e4b0a90eSBrooks Davis# geli init -J da0.pass0 -J da0.pass1 da0 1123e4b0a90eSBrooks Davis# geli attach -j da0.pass0 -j da0.pass1 da0 1124e4b0a90eSBrooks Davis# geli detach da0 1125e4b0a90eSBrooks Davis# geli attach da0 1126e4b0a90eSBrooks DavisEnter passphrase: foobar 1127e4b0a90eSBrooks Davis.Ed 1128e4b0a90eSBrooks Davis.Pp 1129e4b0a90eSBrooks DavisSuspend all 1130e4b0a90eSBrooks Davis.Nm 1131e4b0a90eSBrooks Davisdevices on a laptop, suspend the laptop, then resume devices one by one after 1132e4b0a90eSBrooks Davisresuming the laptop: 1133e4b0a90eSBrooks Davis.Bd -literal -offset indent 1134e4b0a90eSBrooks Davis# geli suspend -a 1135e4b0a90eSBrooks Davis# zzz 1136e4b0a90eSBrooks Davis<resume your laptop> 1137e4b0a90eSBrooks Davis# geli resume -p -k keyfile gpt/secret 1138e4b0a90eSBrooks Davis# geli resume gpt/private 1139e4b0a90eSBrooks DavisEnter passphrase: 1140e4b0a90eSBrooks Davis.Ed 1141fcc9702fSGordon Bergling.Pp 1142fcc9702fSGordon BerglingTo create a 1143fcc9702fSGordon Bergling.Nm 1144fcc9702fSGordon Berglingencrypted filesystem with a file as storage device follow this example. 1145fcc9702fSGordon BerglingFirst a file named private0 is created in 1146fcc9702fSGordon Bergling.Pa /usr 1147fcc9702fSGordon Berglingand attached as a memory disk like 1148fcc9702fSGordon Bergling.Pa /dev/md0 1149fcc9702fSGordon Berglingfor example. 1150fcc9702fSGordon Bergling.Bd -literal -offset indent 1151fcc9702fSGordon Bergling# dd if=/dev/zero of=/usr/private0 bs=1m count=256 1152fcc9702fSGordon Bergling# chmod 0600 /usr/private0 1153fcc9702fSGordon Bergling# mdconfig -t vnode -f /usr/private0 1154fcc9702fSGordon Bergling.Ed 1155fcc9702fSGordon Bergling.Pp 1156fcc9702fSGordon BerglingIt is recommended to place the following line in 1157fcc9702fSGordon Bergling.Xr rc.conf 5 1158fcc9702fSGordon Berglingto have the memory disk automatically created during boot. 1159fcc9702fSGordon Bergling.Bd -literal -offset indent 1160fcc9702fSGordon Berglingmdconfig_md0="-t vnode -f /usr/private0" 1161fcc9702fSGordon Bergling.Ed 1162fcc9702fSGordon Bergling.Pp 1163fcc9702fSGordon BerglingAfter 1164fcc9702fSGordon Bergling.Pa /dev/md0 1165fcc9702fSGordon Berglingis created a random key has to be generated and stored in a secure location, 1166fcc9702fSGordon Berglinglike 1167fcc9702fSGordon Bergling.Pa /root 1168fcc9702fSGordon Berglingfor example. 1169fcc9702fSGordon BerglingThis key should be protected by a passphrase, which 1170fcc9702fSGordon Berglingis requested when geli init is called. 1171fcc9702fSGordon Bergling.Bd -literal -offset indent 1172fcc9702fSGordon Bergling# dd if=/dev/random of=/root/private0.key bs=64 count=1 1173fcc9702fSGordon Bergling# geli init -K /root/private0.key -s 4096 /dev/md0 1174fcc9702fSGordon BerglingEnter new passphrase: 1175fcc9702fSGordon BerglingReenter new passphrase: 11769af25ea3SGordon Bergling# geli attach -k /root/private0.key /dev/md0 11779af25ea3SGordon BerglingEnter passphrase: 1178fcc9702fSGordon Bergling# dd if=/dev/random of=/dev/md0.eli bs=1m 1179fcc9702fSGordon Bergling.Ed 1180fcc9702fSGordon Bergling.Pp 1181fcc9702fSGordon BerglingOnce the initialization of the 1182fcc9702fSGordon Bergling.Pa /dev/md0.eli 1183fcc9702fSGordon Berglingdevice is ready create a UFS filesystem and mount it for example in 1184fcc9702fSGordon Bergling.Pa /private . 1185fcc9702fSGordon Bergling.Bd -literal -offset indent 1186fcc9702fSGordon Bergling# newfs /dev/md0.eli 1187fcc9702fSGordon Bergling# mount /dev/md0.eli /private 1188fcc9702fSGordon Bergling.Ed 1189fcc9702fSGordon Bergling.Pp 1190fcc9702fSGordon BerglingAfter a system reboot the 1191fcc9702fSGordon Bergling.Nm 1192fcc9702fSGordon Berglingdevice can be mounted again with the following commands. 1193fcc9702fSGordon BerglingThe call of geli attach will ask for the passphrase. 1194fcc9702fSGordon BerglingIt is recommended to do this procedure after the boot, because otherwise 1195fcc9702fSGordon Berglingthe boot process would be waiting for the passphrase input. 1196fcc9702fSGordon Bergling.Bd -literal -offset indent 1197fcc9702fSGordon Bergling# geli attach -k /root/private0.key /dev/md0 11989af25ea3SGordon BerglingEnter passphrase: 1199fcc9702fSGordon Bergling# mount /dev/md0.eli /private 1200fcc9702fSGordon Bergling.Ed 1201e4b0a90eSBrooks Davis.Sh ENCRYPTION MODES 1202e4b0a90eSBrooks Davis.Nm 1203e4b0a90eSBrooks Davissupports two encryption modes: 1204e4b0a90eSBrooks Davis.Nm XTS , 1205e4b0a90eSBrooks Daviswhich was standardized as 1206e4b0a90eSBrooks Davis.Nm IEEE P1619 1207e4b0a90eSBrooks Davisand 1208e4b0a90eSBrooks Davis.Nm CBC 1209e4b0a90eSBrooks Daviswith unpredictable IV. 1210e4b0a90eSBrooks DavisThe 1211e4b0a90eSBrooks Davis.Nm CBC 1212e4b0a90eSBrooks Davismode used by 1213e4b0a90eSBrooks Davis.Nm 1214e4b0a90eSBrooks Davisis very similar to the mode 1215e4b0a90eSBrooks Davis.Nm ESSIV . 1216e4b0a90eSBrooks Davis.Sh DATA AUTHENTICATION 1217e4b0a90eSBrooks Davis.Nm 1218e4b0a90eSBrooks Daviscan verify data integrity when an authentication algorithm is specified. 1219e4b0a90eSBrooks DavisWhen data corruption/modification is detected, 1220e4b0a90eSBrooks Davis.Nm 1221e4b0a90eSBrooks Daviswill not return any data, but instead will return an error 1222e4b0a90eSBrooks Davis.Pq Er EINVAL . 1223e4b0a90eSBrooks DavisThe offset and size of the corrupted data will be printed on the console. 1224e4b0a90eSBrooks DavisIt is important to know against which attacks 1225e4b0a90eSBrooks Davis.Nm 1226e4b0a90eSBrooks Davisprovides protection for your data. 1227e4b0a90eSBrooks DavisIf data is modified in-place or copied from one place on the disk 1228e4b0a90eSBrooks Davisto another even without modification, 1229e4b0a90eSBrooks Davis.Nm 1230e4b0a90eSBrooks Davisshould be able to detect such a change. 1231e4b0a90eSBrooks DavisIf an attacker can remember the encrypted data, he can overwrite any future 1232e4b0a90eSBrooks Davischanges with the data he owns without it being noticed. 1233e4b0a90eSBrooks DavisIn other words 1234e4b0a90eSBrooks Davis.Nm 1235e4b0a90eSBrooks Daviswill not protect your data against replay attacks. 1236e4b0a90eSBrooks Davis.Pp 1237e4b0a90eSBrooks DavisIt is recommended to write to the whole provider before first use, 1238e4b0a90eSBrooks Davisin order to make sure that all sectors and their corresponding 1239e4b0a90eSBrooks Davischecksums are properly initialized into a consistent state. 1240e4b0a90eSBrooks DavisOne can safely ignore data authentication errors that occur immediately 1241e4b0a90eSBrooks Davisafter the first time a provider is attached and before it is 1242e4b0a90eSBrooks Davisinitialized in this way. 1243e4b0a90eSBrooks Davis.Sh SEE ALSO 1244e4b0a90eSBrooks Davis.Xr crypto 4 , 1245e4b0a90eSBrooks Davis.Xr geom 4 , 1246e4b0a90eSBrooks Davis.Xr loader.conf 5 , 1247e4b0a90eSBrooks Davis.Xr geom 8 , 1248e4b0a90eSBrooks Davis.Xr crypto 9 1249e4b0a90eSBrooks Davis.Sh HISTORY 1250e4b0a90eSBrooks DavisThe 1251e4b0a90eSBrooks Davis.Nm 1252e4b0a90eSBrooks Davisutility appeared in 1253e4b0a90eSBrooks Davis.Fx 6.0 . 1254e4b0a90eSBrooks DavisSupport for the 1255e4b0a90eSBrooks Davis.Nm Camellia 12565c420aaeSJohn Baldwinblock cipher was implemented by Yoshisato Yanagisawa in 1257e4b0a90eSBrooks Davis.Fx 7.0 . 1258e4b0a90eSBrooks Davis.Pp 1259e4b0a90eSBrooks DavisHighest 1260e4b0a90eSBrooks Davis.Nm GELI 1261fcc9702fSGordon Berglingmetadata version supported by the given 1262fcc9702fSGordon Bergling.Fx 1263fcc9702fSGordon Berglingversion: 1264e4b0a90eSBrooks Davis.Bl -column -offset indent ".Sy FreeBSD" ".Sy version" 1265e4b0a90eSBrooks Davis.It Sy FreeBSD Ta Sy GELI 1266e4b0a90eSBrooks Davis.It Sy version Ta Sy version 1267e4b0a90eSBrooks Davis.Pp 1268e4b0a90eSBrooks Davis.It Li 6.0 Ta 0 1269e4b0a90eSBrooks Davis.It Li 6.1 Ta 0 1270e4b0a90eSBrooks Davis.It Li 6.2 Ta 3 1271e4b0a90eSBrooks Davis.It Li 6.3 Ta 3 1272e4b0a90eSBrooks Davis.It Li 6.4 Ta 3 1273e4b0a90eSBrooks Davis.Pp 1274e4b0a90eSBrooks Davis.It Li 7.0 Ta 3 1275e4b0a90eSBrooks Davis.It Li 7.1 Ta 3 1276e4b0a90eSBrooks Davis.It Li 7.2 Ta 3 1277e4b0a90eSBrooks Davis.It Li 7.3 Ta 3 1278e4b0a90eSBrooks Davis.It Li 7.4 Ta 3 1279e4b0a90eSBrooks Davis.Pp 1280e4b0a90eSBrooks Davis.It Li 8.0 Ta 3 1281e4b0a90eSBrooks Davis.It Li 8.1 Ta 3 1282e4b0a90eSBrooks Davis.It Li 8.2 Ta 5 1283e4b0a90eSBrooks Davis.Pp 1284e4b0a90eSBrooks Davis.It Li 9.0 Ta 6 1285e4b0a90eSBrooks Davis.Pp 1286e4b0a90eSBrooks Davis.It Li 10.0 Ta 7 1287e4b0a90eSBrooks Davis.El 1288e4b0a90eSBrooks Davis.Sh AUTHORS 1289e4b0a90eSBrooks Davis.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org 1290