| 1 |
<?xml version="1.0"?> |
| 2 |
<!--*-nxml-*--> |
| 3 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 4 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 5 |
<!-- |
| 6 |
SPDX-License-Identifier: LGPL-2.1-or-later |
| 7 |
|
| 8 |
This is based on crypttab(5) from Fedora's initscripts package, which in |
| 9 |
turn is based on Debian's version. |
| 10 |
|
| 11 |
The Red Hat version has been written by Miloslav Trmac <[email protected]>. |
| 12 |
--> |
| 13 |
<refentry id="crypttab" conditional='HAVE_LIBCRYPTSETUP' xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 14 |
|
| 15 |
<refentryinfo> |
| 16 |
<title>crypttab</title> |
| 17 |
<productname>systemd</productname> |
| 18 |
</refentryinfo> |
| 19 |
|
| 20 |
<refmeta> |
| 21 |
<refentrytitle>crypttab</refentrytitle> |
| 22 |
<manvolnum>5</manvolnum> |
| 23 |
</refmeta> |
| 24 |
|
| 25 |
<refnamediv> |
| 26 |
<refname>crypttab</refname> |
| 27 |
<refpurpose>Configuration for encrypted block devices</refpurpose> |
| 28 |
</refnamediv> |
| 29 |
|
| 30 |
<refsynopsisdiv> |
| 31 |
<para><filename>/etc/crypttab</filename></para> |
| 32 |
</refsynopsisdiv> |
| 33 |
|
| 34 |
<refsect1> |
| 35 |
<title>Description</title> |
| 36 |
|
| 37 |
<para>The <filename>/etc/crypttab</filename> file describes |
| 38 |
encrypted block devices that are set up during system boot.</para> |
| 39 |
|
| 40 |
<para>Empty lines and lines starting with the <literal>#</literal> |
| 41 |
character are ignored. Each of the remaining lines describes one |
| 42 |
encrypted block device. Fields are delimited by white space.</para> |
| 43 |
|
| 44 |
<para>Each line is in the form<programlisting><replaceable>volume-name</replaceable> <replaceable>encrypted-device</replaceable> <replaceable>key-file</replaceable> <replaceable>options</replaceable></programlisting> |
| 45 |
The first two fields are mandatory, the remaining two are |
| 46 |
optional.</para> |
| 47 |
|
| 48 |
<para>Setting up encrypted block devices using this file supports four encryption modes: LUKS, TrueCrypt, |
| 49 |
BitLocker and plain. See <citerefentry |
| 50 |
project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> for |
| 51 |
more information about each mode. When no mode is specified in the options field and the block device |
| 52 |
contains a LUKS signature, it is opened as a LUKS device; otherwise, it is assumed to be in raw dm-crypt |
| 53 |
(plain mode) format.</para> |
| 54 |
|
| 55 |
<para>The four fields of <filename>/etc/crypttab</filename> are defined as follows:</para> |
| 56 |
|
| 57 |
<orderedlist> |
| 58 |
|
| 59 |
<listitem><para>The first field contains the name of the resulting volume with decrypted data; its |
| 60 |
block device is set up below <filename>/dev/mapper/</filename>.</para></listitem> |
| 61 |
|
| 62 |
<listitem><para>The second field contains a path to the underlying block |
| 63 |
device or file, or a specification of a block device via |
| 64 |
<literal>UUID=</literal> followed by the UUID.</para></listitem> |
| 65 |
|
| 66 |
<listitem><para>The third field specifies an absolute path to a file with the encryption |
| 67 |
key. Optionally, the path may be followed by <literal>:</literal> and an |
| 68 |
<filename>/etc/fstab</filename> style device specification (e.g. starting with |
| 69 |
<literal>LABEL=</literal> or similar); in which case the path is taken relative to the specified |
| 70 |
device's file system root. If the field is not present or is <literal>none</literal> or |
| 71 |
<literal>-</literal>, a key file named after the volume to unlock (i.e. the first column of the line), |
| 72 |
suffixed with <filename>.key</filename> is automatically loaded from the |
| 73 |
<filename>/etc/cryptsetup-keys.d/</filename> and <filename>/run/cryptsetup-keys.d/</filename> |
| 74 |
directories, if present. Otherwise, the password has to be manually entered during system boot. For |
| 75 |
swap encryption, <filename>/dev/urandom</filename> may be used as key file, resulting in a randomized |
| 76 |
key.</para> |
| 77 |
|
| 78 |
<para>If the specified key file path refers to an <constant>AF_UNIX</constant> stream socket in the |
| 79 |
file system, the key is acquired by connecting to the socket and reading it from the connection. This |
| 80 |
allows the implementation of a service to provide key information dynamically, at the moment when it is |
| 81 |
needed. For details see below.</para></listitem> |
| 82 |
|
| 83 |
<listitem><para>The fourth field, if present, is a comma-delimited list of options. The supported |
| 84 |
options are listed below.</para></listitem> |
| 85 |
</orderedlist> |
| 86 |
</refsect1> |
| 87 |
|
| 88 |
<refsect1> |
| 89 |
<title>Key Acquisition</title> |
| 90 |
|
| 91 |
<para>Six different mechanisms for acquiring the decryption key or passphrase unlocking the encrypted |
| 92 |
volume are supported. Specifically:</para> |
| 93 |
|
| 94 |
<orderedlist> |
| 95 |
|
| 96 |
<listitem><para>Most prominently, the user may be queried interactively during volume activation |
| 97 |
(i.e. typically at boot), asking them to type in the necessary passphrases.</para></listitem> |
| 98 |
|
| 99 |
<listitem><para>The (unencrypted) key may be read from a file on disk, possibly on removable media. The third field |
| 100 |
of each line encodes the location, for details see above.</para></listitem> |
| 101 |
|
| 102 |
<listitem><para>The (unencrypted) key may be requested from another service, by specifying an |
| 103 |
<constant>AF_UNIX</constant> file system socket in place of a key file in the third field. For details |
| 104 |
see above and below.</para></listitem> |
| 105 |
|
| 106 |
<listitem><para>The key may be acquired via a PKCS#11 compatible hardware security token or |
| 107 |
smartcard. In this case, a saved key used in unlock process is stored on disk/removable media, acquired via |
| 108 |
<constant>AF_UNIX</constant>, or stored in the LUKS2 JSON token metadata header. For RSA, the saved key |
| 109 |
is an encrypted volume key. The encrypted volume key is then decrypted by the PKCS#11 token with an RSA |
| 110 |
private key stored on it, and used to unlock the encrypted volume. For elliptic-curve (EC) cryptography, |
| 111 |
the saved key is the public key generated in enrollment process. The public key is then used to derive |
| 112 |
a shared secret with a private key stored in the PKCS#11 token. The derived shared secret is then used |
| 113 |
to unlock the volume. Use the <option>pkcs11-uri=</option> option described below to use this mechanism. |
| 114 |
</para></listitem> |
| 115 |
|
| 116 |
<listitem><para>Similarly, the key may be acquired via a FIDO2 compatible hardware security token |
| 117 |
(which must implement the "hmac-secret" extension). In this case, a key generated randomly during |
| 118 |
enrollment is stored on disk/removable media, acquired via <constant>AF_UNIX</constant>, or stored in |
| 119 |
the LUKS2 JSON token metadata header. The random key is hashed via a keyed hash function (HMAC) on the |
| 120 |
FIDO2 token, using a secret key stored on the token that never leaves it. The resulting hash value is |
| 121 |
then used as key to unlock the encrypted volume. Use the <option>fido2-device=</option> option |
| 122 |
described below to use this mechanism.</para></listitem> |
| 123 |
|
| 124 |
<listitem><para>Similarly, the key may be acquired via a TPM2 security chip. In this case, a (during |
| 125 |
enrollment) randomly generated key — encrypted by an asymmetric key derived from the TPM2 chip's seed |
| 126 |
key — is stored on disk/removable media, acquired via <constant>AF_UNIX</constant>, or stored in the |
| 127 |
LUKS2 JSON token metadata header. Use the <option>tpm2-device=</option> option described below to use |
| 128 |
this mechanism.</para></listitem> |
| 129 |
</orderedlist> |
| 130 |
|
| 131 |
<para>For the latter five mechanisms the source for the key material used for unlocking the volume is |
| 132 |
primarily configured in the third field of each <filename>/etc/crypttab</filename> line, but may also |
| 133 |
be configured in <filename>/etc/cryptsetup-keys.d/</filename> and |
| 134 |
<filename>/run/cryptsetup-keys.d/</filename> (see above) or in the LUKS2 JSON token header (in case of |
| 135 |
the latter three). Use the |
| 136 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 137 |
tool to enroll PKCS#11, FIDO2 and TPM2 devices in LUKS2 volumes.</para> |
| 138 |
</refsect1> |
| 139 |
|
| 140 |
<refsect1> |
| 141 |
<title>Supported Options</title> |
| 142 |
|
| 143 |
<para>The following options may be used in the fourth field of each line:</para> |
| 144 |
|
| 145 |
<variablelist class='fstab-options'> |
| 146 |
|
| 147 |
<varlistentry> |
| 148 |
<term><option>cipher=</option></term> |
| 149 |
|
| 150 |
<listitem><para>Specifies the cipher to use. See <citerefentry |
| 151 |
project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 152 |
for possible values and the default value of this option. A cipher with unpredictable IV values, such |
| 153 |
as <literal>aes-cbc-essiv:sha256</literal>, is recommended. Embedded commas in the cipher |
| 154 |
specification need to be escaped by preceding them with a backslash, see example below.</para> |
| 155 |
|
| 156 |
<xi:include href="version-info.xml" xpointer="v186"/> |
| 157 |
</listitem> |
| 158 |
</varlistentry> |
| 159 |
|
| 160 |
<varlistentry> |
| 161 |
<term><option>discard</option></term> |
| 162 |
|
| 163 |
<listitem><para>Allow discard requests to be passed through the encrypted block |
| 164 |
device. This improves performance on SSD storage but has security implications. |
| 165 |
</para> |
| 166 |
|
| 167 |
<xi:include href="version-info.xml" xpointer="v207"/></listitem> |
| 168 |
</varlistentry> |
| 169 |
|
| 170 |
<varlistentry> |
| 171 |
<term><option>hash=</option></term> |
| 172 |
|
| 173 |
<listitem><para>Specifies the hash to use for password |
| 174 |
hashing. See |
| 175 |
<citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 176 |
for possible values and the default value of this |
| 177 |
option.</para> |
| 178 |
|
| 179 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 180 |
</varlistentry> |
| 181 |
|
| 182 |
<varlistentry> |
| 183 |
<term><option>header=</option></term> |
| 184 |
|
| 185 |
<listitem><para>Use a detached (separated) metadata device or file |
| 186 |
where the header containing the master key(s) is stored. This |
| 187 |
option is only relevant for LUKS and TrueCrypt/VeraCrypt devices. See |
| 188 |
<citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 189 |
for possible values and the default value of this option.</para> |
| 190 |
|
| 191 |
<para>Optionally, the path may be followed by <literal>:</literal> and an |
| 192 |
<filename>/etc/fstab</filename> device specification (e.g. starting with <literal>UUID=</literal> or |
| 193 |
similar); in which case, the path is relative to the device file system root. The device gets mounted |
| 194 |
automatically for LUKS device activation duration only.</para> |
| 195 |
|
| 196 |
<xi:include href="version-info.xml" xpointer="v219"/></listitem> |
| 197 |
</varlistentry> |
| 198 |
|
| 199 |
<varlistentry> |
| 200 |
<term><option>keyfile-offset=</option></term> |
| 201 |
|
| 202 |
<listitem><para>Specifies the number of bytes to skip at the |
| 203 |
start of the key file. See |
| 204 |
<citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 205 |
for possible values and the default value of this |
| 206 |
option.</para> |
| 207 |
|
| 208 |
<xi:include href="version-info.xml" xpointer="v187"/></listitem> |
| 209 |
</varlistentry> |
| 210 |
|
| 211 |
<varlistentry> |
| 212 |
<term><option>keyfile-size=</option></term> |
| 213 |
|
| 214 |
<listitem><para>Specifies the maximum number of bytes to read |
| 215 |
from the key file. See |
| 216 |
<citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 217 |
for possible values and the default value of this option. This |
| 218 |
option is ignored in plain encryption mode, where the key file |
| 219 |
size is determined by the key size. It is also ignored when |
| 220 |
the key file is used as a salt file for a FIDO2 token, as the |
| 221 |
salt size in that case is defined by the FIDO2 specification |
| 222 |
to be exactly 32 bytes.</para> |
| 223 |
|
| 224 |
<xi:include href="version-info.xml" xpointer="v188"/></listitem> |
| 225 |
</varlistentry> |
| 226 |
|
| 227 |
<varlistentry> |
| 228 |
<term><option>keyfile-erase</option></term> |
| 229 |
|
| 230 |
<listitem><para>If enabled, the specified key file is erased after the volume is activated or when |
| 231 |
activation fails. This is in particular useful when the key file is only acquired transiently before |
| 232 |
activation (e.g. via a file in <filename>/run/</filename>, generated by a service running before |
| 233 |
activation), and shall be removed after use. Defaults to off.</para> |
| 234 |
|
| 235 |
<para>Note that this option only applies to a key file explicitly configured in the third field, and |
| 236 |
has no effect on key files that are automatically discovered in |
| 237 |
<filename>/etc/cryptsetup-keys.d/</filename> and <filename>/run/cryptsetup-keys.d/</filename>. The |
| 238 |
latter are considered shared resources that are not owned by an individual volume, and hence are never |
| 239 |
erased. To erase an automatically discovered key file, configure its path explicitly in the third |
| 240 |
field.</para> |
| 241 |
|
| 242 |
<xi:include href="version-info.xml" xpointer="v246"/></listitem> |
| 243 |
</varlistentry> |
| 244 |
|
| 245 |
<varlistentry> |
| 246 |
<term><option>key-slot=</option></term> |
| 247 |
|
| 248 |
<listitem><para>Specifies the key slot to compare the |
| 249 |
passphrase or key against. If the key slot does not match the |
| 250 |
given passphrase or key, but another would, the setup of the |
| 251 |
device will fail regardless. This option implies |
| 252 |
<option>luks</option>. See |
| 253 |
<citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 254 |
for possible values. The default is to try all key slots in |
| 255 |
sequential order.</para> |
| 256 |
|
| 257 |
<xi:include href="version-info.xml" xpointer="v209"/></listitem> |
| 258 |
</varlistentry> |
| 259 |
|
| 260 |
<varlistentry> |
| 261 |
<term><option>keyfile-timeout=</option></term> |
| 262 |
|
| 263 |
<listitem><para> Specifies the timeout for the device on |
| 264 |
which the key file resides or the device used as the key file, |
| 265 |
and falls back to a password if it could not be accessed. See |
| 266 |
<citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 267 |
for key files on external devices. |
| 268 |
</para> |
| 269 |
|
| 270 |
<xi:include href="version-info.xml" xpointer="v243"/></listitem> |
| 271 |
</varlistentry> |
| 272 |
|
| 273 |
<varlistentry> |
| 274 |
<term><option>link-volume-key=</option></term> |
| 275 |
|
| 276 |
<listitem><para>Specifies the kernel keyring and key description |
| 277 |
(see <citerefentry project='man-pages'><refentrytitle>keyrings</refentrytitle><manvolnum>7</manvolnum></citerefentry>) |
| 278 |
where LUKS2 volume key gets linked during device activation. The kernel keyring |
| 279 |
description and key description must be separated by <literal>::</literal>.</para> |
| 280 |
|
| 281 |
<para>The kernel keyring part can be a string description or a predefined |
| 282 |
kernel keyring prefixed with <literal>@</literal> (e.g.: to use <literal>@s</literal> session or |
| 283 |
<literal>@u</literal> user keyring directly). The type prefix text in the kernel keyring description |
| 284 |
is not required. The specified kernel keyring must already exist at the time of device activation.</para> |
| 285 |
|
| 286 |
<para>The key part is a string description optionally prefixed by a <literal>%key_type:</literal>. |
| 287 |
If no type is specified, the <literal>user</literal> type key is linked by default. See |
| 288 |
<citerefentry project='man-pages'><refentrytitle>keyctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 289 |
for more information on key descriptions (KEY IDENTIFIERS section).</para> |
| 290 |
|
| 291 |
<para>Note that the linked volume key is not cleaned up automatically when the device is detached.</para> |
| 292 |
|
| 293 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 294 |
</varlistentry> |
| 295 |
|
| 296 |
<varlistentry> |
| 297 |
<term><option>luks</option></term> |
| 298 |
|
| 299 |
<listitem><para>Force LUKS mode. When this mode is used, the |
| 300 |
following options are ignored since they are provided by the |
| 301 |
LUKS header on the device: <option>cipher=</option>, |
| 302 |
<option>hash=</option>, |
| 303 |
<option>size=</option>.</para> |
| 304 |
|
| 305 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 306 |
</varlistentry> |
| 307 |
|
| 308 |
<varlistentry> |
| 309 |
<term><option>bitlk</option></term> |
| 310 |
|
| 311 |
<listitem><para>Decrypt BitLocker drive. Encryption parameters |
| 312 |
are deduced by cryptsetup from BitLocker header.</para> |
| 313 |
|
| 314 |
<xi:include href="version-info.xml" xpointer="v246"/></listitem> |
| 315 |
</varlistentry> |
| 316 |
|
| 317 |
<varlistentry> |
| 318 |
<term><option>_netdev</option></term> |
| 319 |
|
| 320 |
<listitem><para>Marks this cryptsetup device as requiring network. It will be |
| 321 |
started after the network is available, similarly to |
| 322 |
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 323 |
units marked with <option>_netdev</option>. The service unit to set up this device |
| 324 |
will be ordered between <filename>remote-fs-pre.target</filename> and |
| 325 |
<filename>remote-cryptsetup.target</filename>, instead of |
| 326 |
<filename>cryptsetup-pre.target</filename> and |
| 327 |
<filename>cryptsetup.target</filename>.</para> |
| 328 |
|
| 329 |
<para>Hint: if this device is used for a mount point that is specified in |
| 330 |
<citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
| 331 |
the <option>_netdev</option> option should also be used for the mount |
| 332 |
point. Otherwise, a dependency loop might be created where the mount point |
| 333 |
will be pulled in by <filename>local-fs.target</filename>, while the |
| 334 |
service to configure the network is usually only started <emphasis>after</emphasis> |
| 335 |
the local file system has been mounted.</para> |
| 336 |
|
| 337 |
<xi:include href="version-info.xml" xpointer="v235"/> |
| 338 |
</listitem> |
| 339 |
</varlistentry> |
| 340 |
|
| 341 |
<varlistentry> |
| 342 |
<term><option>noauto</option></term> |
| 343 |
|
| 344 |
<listitem><para>This device will not be added to <filename>cryptsetup.target</filename>. |
| 345 |
This means that it will not be automatically unlocked on boot, unless something else pulls |
| 346 |
it in. In particular, if the device is used for a mount point, it'll be unlocked |
| 347 |
automatically during boot, unless the mount point itself is also disabled with |
| 348 |
<option>noauto</option>.</para> |
| 349 |
|
| 350 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 351 |
</varlistentry> |
| 352 |
|
| 353 |
<varlistentry> |
| 354 |
<term><option>nofail</option></term> |
| 355 |
|
| 356 |
<listitem><para>This device will not be a hard dependency of |
| 357 |
<filename>cryptsetup.target</filename>. It'll still be pulled in and started, but the system |
| 358 |
will not wait for the device to show up and be unlocked, and boot will not fail if this is |
| 359 |
unsuccessful. Note that other units that depend on the unlocked device may still fail. In |
| 360 |
particular, if the device is used for a mount point, the mount point itself also needs to |
| 361 |
have the <option>nofail</option> option, or the boot will fail if the device is not unlocked |
| 362 |
successfully. If a keyfile and/or a <option>header</option> are specified, the dependencies on |
| 363 |
their respective directories will also not be fatal, so that unmounting said directories will |
| 364 |
not cause the generated cryptset unit to be deactivated.</para> |
| 365 |
|
| 366 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 367 |
</varlistentry> |
| 368 |
|
| 369 |
<varlistentry> |
| 370 |
<term><option>offset=</option></term> |
| 371 |
|
| 372 |
<listitem><para>Start offset in the backend device, in 512-byte sectors. This |
| 373 |
option is only relevant for plain devices.</para> |
| 374 |
|
| 375 |
<xi:include href="version-info.xml" xpointer="v220"/></listitem> |
| 376 |
</varlistentry> |
| 377 |
|
| 378 |
<varlistentry> |
| 379 |
<term><option>plain</option></term> |
| 380 |
|
| 381 |
<listitem><para>Force plain encryption mode.</para> |
| 382 |
|
| 383 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 384 |
</varlistentry> |
| 385 |
|
| 386 |
<varlistentry> |
| 387 |
<term><option>read-only</option></term><term><option>readonly</option></term> |
| 388 |
|
| 389 |
<listitem><para>Set up the encrypted block device in read-only |
| 390 |
mode.</para> |
| 391 |
|
| 392 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 393 |
</varlistentry> |
| 394 |
|
| 395 |
<varlistentry> |
| 396 |
<term><option>same-cpu-crypt</option></term> |
| 397 |
|
| 398 |
<listitem><para>Perform encryption using the same CPU that IO was submitted on. The default is to use |
| 399 |
an unbound workqueue so that encryption work is automatically balanced between available CPUs.</para> |
| 400 |
|
| 401 |
<para>This requires kernel 4.0 or newer.</para> |
| 402 |
|
| 403 |
<xi:include href="version-info.xml" xpointer="v242"/> |
| 404 |
</listitem> |
| 405 |
</varlistentry> |
| 406 |
|
| 407 |
<varlistentry> |
| 408 |
<term><option>submit-from-crypt-cpus</option></term> |
| 409 |
|
| 410 |
<listitem><para>Disable offloading writes to a separate thread after encryption. There are some |
| 411 |
situations where offloading write requests from the encryption threads to a dedicated thread degrades |
| 412 |
performance significantly. The default is to offload write requests to a dedicated thread because it |
| 413 |
benefits the CFQ scheduler to have writes submitted using the same context.</para> |
| 414 |
|
| 415 |
<para>This requires kernel 4.0 or newer.</para> |
| 416 |
|
| 417 |
<xi:include href="version-info.xml" xpointer="v242"/> |
| 418 |
</listitem> |
| 419 |
</varlistentry> |
| 420 |
|
| 421 |
<varlistentry> |
| 422 |
<term><option>no-read-workqueue</option></term> |
| 423 |
|
| 424 |
<listitem><para>Bypass dm-crypt internal workqueue and process read requests synchronously. The |
| 425 |
default is to queue these requests and process them asynchronously.</para> |
| 426 |
|
| 427 |
<para>This requires kernel 5.9 or newer.</para> |
| 428 |
|
| 429 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 430 |
</listitem> |
| 431 |
</varlistentry> |
| 432 |
<varlistentry> |
| 433 |
<term><option>no-write-workqueue</option></term> |
| 434 |
|
| 435 |
<listitem><para>Bypass dm-crypt internal workqueue and process write requests synchronously. The |
| 436 |
default is to queue these requests and process them asynchronously.</para> |
| 437 |
|
| 438 |
<para>This requires kernel 5.9 or newer.</para> |
| 439 |
|
| 440 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 441 |
</listitem> |
| 442 |
</varlistentry> |
| 443 |
|
| 444 |
<varlistentry> |
| 445 |
<term><option>skip=</option></term> |
| 446 |
|
| 447 |
<listitem><para>How many 512-byte sectors of the encrypted data to skip at the |
| 448 |
beginning. This is different from the <option>offset=</option> option with respect |
| 449 |
to the sector numbers used in initialization vector (IV) calculation. Using |
| 450 |
<option>offset=</option> will shift the IV calculation by the same negative |
| 451 |
amount. Hence, if <option>offset=<replaceable>n</replaceable></option> is given, |
| 452 |
sector <replaceable>n</replaceable> will get a sector number of 0 for the IV |
| 453 |
calculation. Using <option>skip=</option> causes sector |
| 454 |
<replaceable>n</replaceable> to also be the first sector of the mapped device, but |
| 455 |
with its number for IV generation being <replaceable>n</replaceable>.</para> |
| 456 |
|
| 457 |
<para>This option is only relevant for plain devices.</para> |
| 458 |
|
| 459 |
<xi:include href="version-info.xml" xpointer="v220"/> |
| 460 |
</listitem> |
| 461 |
</varlistentry> |
| 462 |
|
| 463 |
<varlistentry> |
| 464 |
<term><option>size=</option></term> |
| 465 |
|
| 466 |
<listitem><para>Specifies the key size in bits. See |
| 467 |
<citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 468 |
for possible values and the default value of this |
| 469 |
option.</para> |
| 470 |
|
| 471 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 472 |
</varlistentry> |
| 473 |
|
| 474 |
<varlistentry> |
| 475 |
<term><option>sector-size=</option></term> |
| 476 |
|
| 477 |
<listitem><para>Specifies the sector size in bytes. See |
| 478 |
<citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 479 |
for possible values and the default value of this |
| 480 |
option.</para> |
| 481 |
|
| 482 |
<xi:include href="version-info.xml" xpointer="v240"/></listitem> |
| 483 |
</varlistentry> |
| 484 |
|
| 485 |
<varlistentry> |
| 486 |
<term><option>swap</option></term> |
| 487 |
|
| 488 |
<listitem><para>The encrypted block device will be used as a |
| 489 |
swap device, and will be formatted accordingly after setting |
| 490 |
up the encrypted block device, with |
| 491 |
<citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 492 |
This option implies <option>plain</option>.</para> |
| 493 |
|
| 494 |
<warning> |
| 495 |
<para>Using the <option>swap</option> option will |
| 496 |
destroy the contents of the named partition during every boot, |
| 497 |
so make sure the underlying block device is specified |
| 498 |
correctly.</para> |
| 499 |
</warning> |
| 500 |
|
| 501 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 502 |
</varlistentry> |
| 503 |
|
| 504 |
<varlistentry> |
| 505 |
<term><option>tcrypt</option></term> |
| 506 |
|
| 507 |
<listitem><para>Use TrueCrypt encryption mode. When this mode |
| 508 |
is used, the following options are ignored since they are |
| 509 |
provided by the TrueCrypt header on the device or do not |
| 510 |
apply: |
| 511 |
<option>cipher=</option>, |
| 512 |
<option>hash=</option>, |
| 513 |
<option>keyfile-offset=</option>, |
| 514 |
<option>keyfile-size=</option>, |
| 515 |
<option>size=</option>.</para> |
| 516 |
|
| 517 |
<para>When this mode is used, the passphrase is read from the |
| 518 |
key file given in the third field. Only the first line of this |
| 519 |
file is read, excluding the new line character.</para> |
| 520 |
|
| 521 |
<para>Note that the TrueCrypt format uses both passphrase and |
| 522 |
key files to derive a password for the volume. Therefore, the |
| 523 |
passphrase and all key files need to be provided. Use |
| 524 |
<option>tcrypt-keyfile=</option> to provide the absolute path |
| 525 |
to all key files. When using an empty passphrase in |
| 526 |
combination with one or more key files, use |
| 527 |
<literal>/dev/null</literal> as the password file in the third |
| 528 |
field.</para> |
| 529 |
|
| 530 |
<xi:include href="version-info.xml" xpointer="v206"/></listitem> |
| 531 |
</varlistentry> |
| 532 |
|
| 533 |
<varlistentry> |
| 534 |
<term><option>tcrypt-hidden</option></term> |
| 535 |
|
| 536 |
<listitem><para>Use the hidden TrueCrypt volume. This option |
| 537 |
implies <option>tcrypt</option>.</para> |
| 538 |
|
| 539 |
<para>This will map the hidden volume that is inside of the |
| 540 |
volume provided in the second field. Please note that there is |
| 541 |
no protection for the hidden volume if the outer volume is |
| 542 |
mounted instead. See |
| 543 |
<citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 544 |
for more information on this limitation.</para> |
| 545 |
|
| 546 |
<xi:include href="version-info.xml" xpointer="v206"/></listitem> |
| 547 |
</varlistentry> |
| 548 |
|
| 549 |
<varlistentry> |
| 550 |
<term><option>tcrypt-keyfile=</option></term> |
| 551 |
|
| 552 |
<listitem><para>Specifies the absolute path to a key file to |
| 553 |
use for a TrueCrypt volume. This implies |
| 554 |
<option>tcrypt</option> and can be used more than once to |
| 555 |
provide several key files.</para> |
| 556 |
|
| 557 |
<para>See the entry for <option>tcrypt</option> on the |
| 558 |
behavior of the passphrase and key files when using TrueCrypt |
| 559 |
encryption mode.</para> |
| 560 |
|
| 561 |
<xi:include href="version-info.xml" xpointer="v206"/></listitem> |
| 562 |
</varlistentry> |
| 563 |
|
| 564 |
<varlistentry> |
| 565 |
<term><option>tcrypt-system</option></term> |
| 566 |
|
| 567 |
<listitem><para>Use TrueCrypt in system encryption mode. This |
| 568 |
option implies <option>tcrypt</option>.</para> |
| 569 |
|
| 570 |
<xi:include href="version-info.xml" xpointer="v206"/></listitem> |
| 571 |
</varlistentry> |
| 572 |
|
| 573 |
<varlistentry> |
| 574 |
<term><option>tcrypt-veracrypt</option></term> |
| 575 |
|
| 576 |
<listitem><para>Check for a VeraCrypt volume. VeraCrypt is a fork of |
| 577 |
TrueCrypt that is mostly compatible, but uses different, stronger key |
| 578 |
derivation algorithms that cannot be detected without this flag. |
| 579 |
Enabling this option could substantially slow down unlocking, because |
| 580 |
VeraCrypt's key derivation takes much longer than TrueCrypt's. This |
| 581 |
option implies <option>tcrypt</option>.</para> |
| 582 |
|
| 583 |
<xi:include href="version-info.xml" xpointer="v232"/></listitem> |
| 584 |
</varlistentry> |
| 585 |
|
| 586 |
<varlistentry> |
| 587 |
<term><option>veracrypt-pim=</option></term> |
| 588 |
|
| 589 |
<listitem><para>Specifies a custom Personal Iteration Multiplier (PIM) |
| 590 |
value, which can range from 0..2147468 for standard veracrypt volumes |
| 591 |
and 0..65535 for veracrypt system volumes. A value of 0 will imply the |
| 592 |
VeraCrypt default. |
| 593 |
|
| 594 |
This option is only effective when <option>tcrypt-veracrypt</option> is |
| 595 |
set.</para> |
| 596 |
|
| 597 |
<para>Note that VeraCrypt enforces a minimal allowed PIM value depending on the |
| 598 |
password strength and the hash algorithm used for key derivation, however |
| 599 |
<option>veracrypt-pim=</option> is not checked against these bounds. |
| 600 |
See |
| 601 |
<ulink url="https://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20%28PIM%29.html">Veracrypt Personal Iterations Multiplier</ulink> |
| 602 |
documentation for more information.</para> |
| 603 |
|
| 604 |
<xi:include href="version-info.xml" xpointer="v254"/> |
| 605 |
</listitem> |
| 606 |
</varlistentry> |
| 607 |
|
| 608 |
<varlistentry> |
| 609 |
<term><option>timeout=</option></term> |
| 610 |
|
| 611 |
<listitem><para>Specifies the timeout for querying for a |
| 612 |
password. If no unit is specified, seconds is used. Supported |
| 613 |
units are s, ms, us, min, h, d. A timeout of 0 waits |
| 614 |
indefinitely (which is the default).</para> |
| 615 |
|
| 616 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 617 |
</varlistentry> |
| 618 |
|
| 619 |
<varlistentry> |
| 620 |
<term><option>tmp=</option></term> |
| 621 |
|
| 622 |
<listitem><para>The encrypted block device will be prepared for using it as |
| 623 |
<filename>/tmp/</filename>; it will be formatted using <citerefentry |
| 624 |
project='man-pages'><refentrytitle>mkfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>. Takes |
| 625 |
a file system type as argument, such as <literal>ext4</literal>, <literal>xfs</literal> or |
| 626 |
<literal>btrfs</literal>. If no argument is specified defaults to <literal>ext4</literal>. This |
| 627 |
option implies <option>plain</option>.</para> |
| 628 |
|
| 629 |
<warning> |
| 630 |
<para>Using the <option>tmp</option> option will destroy the contents of the named partition |
| 631 |
during every boot, so make sure the underlying block device is specified correctly.</para> |
| 632 |
</warning> |
| 633 |
|
| 634 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 635 |
</varlistentry> |
| 636 |
|
| 637 |
<varlistentry> |
| 638 |
<term><option>tries=</option></term> |
| 639 |
|
| 640 |
<listitem><para>Specifies the maximum number of times the user |
| 641 |
is queried for a password. The default is 3. If set to 0, the |
| 642 |
user is queried for a password indefinitely.</para> |
| 643 |
|
| 644 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 645 |
</varlistentry> |
| 646 |
|
| 647 |
<varlistentry> |
| 648 |
<term><option>headless=</option></term> |
| 649 |
|
| 650 |
<listitem><para>Takes a boolean argument, defaults to false. If true, never query interactively |
| 651 |
for the password/PIN. Useful for headless systems.</para> |
| 652 |
|
| 653 |
<xi:include href="version-info.xml" xpointer="v249"/></listitem> |
| 654 |
</varlistentry> |
| 655 |
|
| 656 |
<varlistentry> |
| 657 |
<term><option>verify</option></term> |
| 658 |
|
| 659 |
<listitem><para>If the encryption password is read from console, it has to be entered twice to |
| 660 |
prevent typos.</para> |
| 661 |
|
| 662 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 663 |
</varlistentry> |
| 664 |
|
| 665 |
<varlistentry> |
| 666 |
<term><option>password-echo=yes|no|masked</option></term> |
| 667 |
|
| 668 |
<listitem><para>Controls whether to echo passwords or security token PINs |
| 669 |
that are read from console. Takes a boolean or the special string <literal>masked</literal>. |
| 670 |
The default is <option>password-echo=masked</option>.</para> |
| 671 |
|
| 672 |
<para>If enabled, the typed characters are echoed literally. If disabled, |
| 673 |
the typed characters are not echoed in any form, the user will not get |
| 674 |
feedback on their input. If set to <literal>masked</literal>, an asterisk |
| 675 |
(<literal>*</literal>) is echoed for each character typed. Regardless of |
| 676 |
which mode is chosen, if the user hits the tabulator key (<literal>↹</literal>) |
| 677 |
at any time, or the backspace key (<literal>⌫</literal>) before any other |
| 678 |
data has been entered, then echo is turned off.</para> |
| 679 |
|
| 680 |
<xi:include href="version-info.xml" xpointer="v249"/></listitem> |
| 681 |
</varlistentry> |
| 682 |
|
| 683 |
<varlistentry> |
| 684 |
<term><option>password-cache=yes|no|read-only</option></term> |
| 685 |
|
| 686 |
<listitem><para>Controls whether to use cache for passwords or security token PINs. |
| 687 |
Takes a boolean or the special string <literal>read-only</literal>. Defaults to |
| 688 |
<literal>yes</literal>.</para> |
| 689 |
|
| 690 |
<para>If set to <literal>read-only</literal>, the kernel keyring is checked for a |
| 691 |
password/PIN before requesting one interactively. If set to <literal>yes</literal>, |
| 692 |
in addition to checking the keyring, any password/PIN entered interactively is cached |
| 693 |
in the keyring with a 2.5-minute timeout before being purged.</para> |
| 694 |
|
| 695 |
<para>Note that this option is not permitted for PKCS#11 security tokens. The reasoning |
| 696 |
behind this is that PKCS#11 security tokens are usually configured to lock after being |
| 697 |
supplied an invalid PIN multiple times, so using the cache might inadvertently lock the |
| 698 |
token.</para> |
| 699 |
|
| 700 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 701 |
</varlistentry> |
| 702 |
|
| 703 |
<varlistentry> |
| 704 |
<term><option>pkcs11-uri=</option></term> |
| 705 |
|
| 706 |
<listitem><para>Takes either the special value <literal>auto</literal> or an <ulink |
| 707 |
url="https://tools.ietf.org/html/rfc7512">RFC7512 PKCS#11 URI</ulink> pointing to a private key |
| 708 |
which is used to decrypt the encrypted key specified in the third column of the line. This is useful |
| 709 |
for unlocking encrypted volumes through PKCS#11 compatible security tokens or smartcards. See below |
| 710 |
for an example how to set up this mechanism for unlocking a LUKS2 volume with a YubiKey security |
| 711 |
token.</para> |
| 712 |
|
| 713 |
<para>If specified as <literal>auto</literal> the volume must be of type LUKS2 and must carry PKCS#11 |
| 714 |
security token metadata in its LUKS2 JSON token section. In this mode the URI and the encrypted key |
| 715 |
are automatically read from the LUKS2 JSON token header. Use |
| 716 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 717 |
as a simple tool for enrolling PKCS#11 security tokens or smartcards in a way compatible with |
| 718 |
<literal>auto</literal>. In this mode the third column of the line should remain empty (that is, |
| 719 |
specified as <literal>-</literal>).</para> |
| 720 |
|
| 721 |
<para>The specified URI can refer directly to a private key stored on a token or alternatively |
| 722 |
just to a slot or token, in which case a search for a suitable private key will be performed. In |
| 723 |
this case, if multiple suitable objects are found, the token is refused. The keyfile configured |
| 724 |
in the third column of the line is used as is (i.e. in binary form, unprocessed). The resulting |
| 725 |
decrypted key (for RSA) or derived shared secret (for ECC) is then Base64 encoded before it is used |
| 726 |
to unlock the LUKS volume.</para> |
| 727 |
|
| 728 |
<para>Use <command>systemd-cryptenroll --pkcs11-token-uri=list</command> to list all suitable PKCS#11 |
| 729 |
security tokens currently plugged in, along with their URIs.</para> |
| 730 |
|
| 731 |
<para>Note that many newer security tokens that may be used as PKCS#11 security token typically also |
| 732 |
implement the newer and simpler FIDO2 standard. Consider using <option>fido2-device=</option> |
| 733 |
(described below) to enroll it via FIDO2 instead. Note that a security token enrolled via PKCS#11 |
| 734 |
cannot be used to unlock the volume via FIDO2, unless also enrolled via FIDO2, and vice |
| 735 |
versa.</para> |
| 736 |
|
| 737 |
<xi:include href="version-info.xml" xpointer="v245"/></listitem> |
| 738 |
</varlistentry> |
| 739 |
|
| 740 |
<varlistentry> |
| 741 |
<term><option>fido2-device=</option></term> |
| 742 |
|
| 743 |
<listitem><para>Takes either the special value <literal>auto</literal> or the path to a |
| 744 |
<literal>hidraw</literal> device node (e.g. <filename>/dev/hidraw1</filename>) referring to a FIDO2 |
| 745 |
security token that implements the <literal>hmac-secret</literal> extension (most current hardware |
| 746 |
security tokens do). See below for an example how to set up this mechanism for unlocking an encrypted |
| 747 |
volume with a FIDO2 security token.</para> |
| 748 |
|
| 749 |
<para>If specified as <literal>auto</literal> the FIDO2 token device is automatically discovered, as |
| 750 |
it is plugged in.</para> |
| 751 |
|
| 752 |
<para>FIDO2 volume unlocking requires a client ID hash (CID) to be configured via |
| 753 |
<option>fido2-cid=</option> (see below) and a key to pass to the security token's HMAC functionality |
| 754 |
(configured in the line's third column) to operate. If not configured and the volume is of type |
| 755 |
LUKS2, the CID and the key are read from LUKS2 JSON token metadata instead. Use |
| 756 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 757 |
as simple tool for enrolling FIDO2 security tokens for LUKS2 volumes.</para> |
| 758 |
|
| 759 |
<para>Use <command>systemd-cryptenroll --fido2-device=list</command> to list all suitable FIDO2 |
| 760 |
security tokens currently plugged in, along with their device nodes.</para> |
| 761 |
|
| 762 |
<para>This option implements the following mechanism: the configured key is hashed via they HMAC |
| 763 |
keyed hash function the FIDO2 device implements, keyed by a secret key embedded on the device. The |
| 764 |
resulting hash value is Base64 encoded and used to unlock the LUKS2 volume. As it should not be |
| 765 |
possible to extract the secret from the hardware token, it should not be possible to retrieve the |
| 766 |
hashed key given the configured key — without possessing the hardware token.</para> |
| 767 |
|
| 768 |
<para>Note that many security tokens that implement FIDO2 also implement PKCS#11, suitable for |
| 769 |
unlocking volumes via the <option>pkcs11-uri=</option> option described above. Typically the newer, |
| 770 |
simpler FIDO2 standard is preferable.</para> |
| 771 |
|
| 772 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 773 |
</varlistentry> |
| 774 |
|
| 775 |
<varlistentry> |
| 776 |
<term><option>fido2-cid=</option></term> |
| 777 |
|
| 778 |
<listitem><para>Takes a Base64 encoded FIDO2 client ID to use for the FIDO2 unlock operation. If |
| 779 |
specified, but <option>fido2-device=</option> is not, <option>fido2-device=auto</option> is |
| 780 |
implied. If <option>fido2-device=</option> is used but <option>fido2-cid=</option> is not, the volume |
| 781 |
must be of LUKS2 type, and the CID is read from the LUKS2 JSON token header. Use |
| 782 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 783 |
for enrolling a FIDO2 token in the LUKS2 header compatible with this automatic |
| 784 |
mode.</para> |
| 785 |
|
| 786 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 787 |
</varlistentry> |
| 788 |
|
| 789 |
<varlistentry> |
| 790 |
<term><option>fido2-rp=</option></term> |
| 791 |
|
| 792 |
<listitem><para>Takes a string, configuring the FIDO2 Relying Party (rp) for the FIDO2 unlock |
| 793 |
operation. If not specified, <literal>io.systemd.cryptsetup</literal> is used, except if the LUKS2 |
| 794 |
JSON token header contains a different value. It should normally not be necessary to override |
| 795 |
this.</para> |
| 796 |
|
| 797 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 798 |
</varlistentry> |
| 799 |
|
| 800 |
<varlistentry> |
| 801 |
<term><option>fido2-pin=</option></term> |
| 802 |
|
| 803 |
<listitem><para>Controls whether to require the user to enter a PIN when unlocking the volume (the |
| 804 |
FIDO2 <literal>clientPin</literal> feature). This option only applies when in manual mode, i.e. |
| 805 |
when <option>fido2-cid=</option> option is set. Defaults to neither true or false, but rather to |
| 806 |
<constant>v248</constant> behavior, that is: try with no PIN first, but if token reports that PIN |
| 807 |
is required, try again asking for PIN.</para> |
| 808 |
|
| 809 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 810 |
</varlistentry> |
| 811 |
|
| 812 |
<varlistentry> |
| 813 |
<term><option>fido2-up=</option></term> |
| 814 |
|
| 815 |
<listitem><para>Controls whether to require the user to verify presence (tap the token, the FIDO2 |
| 816 |
<literal>up</literal> feature) when unlocking the volume. This option only applies when in manual |
| 817 |
mode, i.e. when <option>fido2-cid=</option> option is set. Defaults to neither true or false, |
| 818 |
but rather to <constant>v248</constant> behavior, that is: try with no UP first, but if token reports |
| 819 |
that UP is required, try again with UP enabled.</para> |
| 820 |
|
| 821 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 822 |
</varlistentry> |
| 823 |
|
| 824 |
<varlistentry> |
| 825 |
<term><option>fido2-uv=</option></term> |
| 826 |
|
| 827 |
<listitem><para>Controls whether to require user verification (the FIDO2 <literal>uv</literal> feature) |
| 828 |
when unlocking the volume. This option only applies when in manual mode, i.e. when |
| 829 |
<option>fido2-cid=</option> option is set. Defaults to neither true or false, but rather to |
| 830 |
<constant>v248</constant> behavior, that is: omit configuring UV whatsoever.</para> |
| 831 |
|
| 832 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 833 |
</varlistentry> |
| 834 |
|
| 835 |
<varlistentry> |
| 836 |
<term><option>tpm2-device=</option></term> |
| 837 |
|
| 838 |
<listitem><para>Takes either the special value <literal>auto</literal> or the path to a device node |
| 839 |
(e.g. <filename>/dev/tpmrm0</filename>) referring to a TPM2 security chip. See below for an example |
| 840 |
how to set up this mechanism for unlocking an encrypted volume with a TPM2 chip.</para> |
| 841 |
|
| 842 |
<para>Use <option>tpm2-pcrs=</option> (see below) to configure the set of TPM2 PCRs to bind the |
| 843 |
volume unlocking to. Use |
| 844 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 845 |
as simple tool for enrolling TPM2 security chips in LUKS2 volumes.</para> |
| 846 |
|
| 847 |
<para>If specified as <literal>auto</literal> the TPM2 device is automatically discovered. Use |
| 848 |
<command>systemd-cryptenroll --tpm2-device=list</command> to list all suitable TPM2 devices currently |
| 849 |
available, along with their device nodes.</para> |
| 850 |
|
| 851 |
<para>This option implements the following mechanism: when enrolling a TPM2 device via |
| 852 |
<command>systemd-cryptenroll</command> on a LUKS2 volume, a randomized key unlocking the volume is |
| 853 |
generated on the host and loaded into the TPM2 chip where it is encrypted with an asymmetric |
| 854 |
"primary" key pair derived from the TPM2's internal "seed" key. Neither the seed key nor the primary |
| 855 |
key are permitted to ever leave the TPM2 chip — however, the now encrypted randomized key may. It is |
| 856 |
saved in the LUKS2 volume JSON token header. When unlocking the encrypted volume, the primary key |
| 857 |
pair is generated on the TPM2 chip again (which works as long as the chip's seed key is correctly |
| 858 |
maintained by the TPM2 chip), which is then used to decrypt (on the TPM2 chip) the encrypted key from |
| 859 |
the LUKS2 volume JSON token header saved there during enrollment. The resulting decrypted key is then |
| 860 |
used to unlock the volume. When the randomized key is encrypted the current values of the selected |
| 861 |
PCRs (see below) are included in the operation, so that different PCR state results in different |
| 862 |
encrypted keys and the decrypted key can only be recovered if the same PCR state is |
| 863 |
reproduced.</para> |
| 864 |
|
| 865 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 866 |
</varlistentry> |
| 867 |
|
| 868 |
<varlistentry> |
| 869 |
<term><option>tpm2-pcrs=</option></term> |
| 870 |
|
| 871 |
<listitem><para>Takes a <literal>+</literal> separated list of numeric TPM2 PCR (i.e. "Platform |
| 872 |
Configuration Register") indexes to bind the TPM2 volume unlocking to. This option is only useful |
| 873 |
when TPM2 enrollment metadata is not available in the LUKS2 JSON token header already, the way |
| 874 |
<command>systemd-cryptenroll</command> writes it there. If not used (and no metadata in the LUKS2 |
| 875 |
JSON token header defines it), defaults to a list of a single entry: PCR 7. Assign an empty string to |
| 876 |
encode a policy that binds the key to no PCRs, making the key accessible to local programs regardless |
| 877 |
of the current PCR state.</para> |
| 878 |
|
| 879 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 880 |
</varlistentry> |
| 881 |
|
| 882 |
<varlistentry> |
| 883 |
<term><option>tpm2-pin=</option></term> |
| 884 |
|
| 885 |
<listitem><para>Takes a boolean argument, defaults to <literal>false</literal>. Controls whether |
| 886 |
TPM2 volume unlocking is bound to a PIN in addition to PCRs. Similarly, this option is only useful |
| 887 |
when TPM2 enrollment metadata is not available.</para> |
| 888 |
|
| 889 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 890 |
</varlistentry> |
| 891 |
|
| 892 |
<varlistentry> |
| 893 |
<term><option>tpm2-signature=</option></term> |
| 894 |
|
| 895 |
<listitem><para>Takes an absolute path to a TPM2 PCR JSON signature file, as produced by the |
| 896 |
<citerefentry><refentrytitle>systemd-measure</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 897 |
tool. This permits locking LUKS2 volumes to any PCR values for which a valid signature matching a |
| 898 |
public key specified at key enrollment time can be provided. See |
| 899 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 900 |
for details on enrolling TPM2 PCR public keys. If this option is not specified but it is attempted to |
| 901 |
unlock a LUKS2 volume with a signed TPM2 PCR enrollment, a suitable signature file |
| 902 |
<filename>tpm2-pcr-signature.json</filename> is searched for in <filename>/etc/systemd/</filename>, |
| 903 |
<filename>/run/systemd/</filename>, <filename>/usr/lib/systemd/</filename> (in this |
| 904 |
order).</para> |
| 905 |
|
| 906 |
<xi:include href="version-info.xml" xpointer="v252"/></listitem> |
| 907 |
</varlistentry> |
| 908 |
|
| 909 |
<varlistentry> |
| 910 |
<term><option>tpm2-pcrlock=</option></term> |
| 911 |
|
| 912 |
<listitem><para>Takes an absolute path to a TPM2 pcrlock policy file, as produced by the |
| 913 |
<citerefentry><refentrytitle>systemd-pcrlock</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 914 |
tool. This permits locking LUKS2 volumes to a local policy of allowed PCR values with |
| 915 |
variants. See |
| 916 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 917 |
for details on enrolling TPM2 pcrlock policies. If this option is not specified but it is attempted |
| 918 |
to unlock a LUKS2 volume with a TPM2 pcrlock enrollment, a suitable signature file |
| 919 |
<filename>pcrlock.json</filename> is searched for in <filename>/run/systemd/</filename> and |
| 920 |
<filename>/var/lib/systemd/</filename> (in this order).</para> |
| 921 |
|
| 922 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 923 |
</varlistentry> |
| 924 |
|
| 925 |
<varlistentry> |
| 926 |
<term><option>tpm2-measure-pcr=</option></term> |
| 927 |
|
| 928 |
<listitem><para>Controls whether to measure the volume key of the encrypted volume to a TPM2 PCR. If |
| 929 |
set to "no" (which is the default) no PCR extension is done. If set to "yes" the volume key is |
| 930 |
measured into PCR 15. If set to a decimal integer in the range 0…23 the volume key is measured into |
| 931 |
the specified PCR. The volume key is measured along with the activated volume name and its UUID. This |
| 932 |
functionality is particularly useful for the encrypted volume backing the root file system, as it |
| 933 |
then allows later TPM objects to be securely bound to the root file system and hence the specific |
| 934 |
installation.</para> |
| 935 |
|
| 936 |
<xi:include href="version-info.xml" xpointer="v253"/></listitem> |
| 937 |
</varlistentry> |
| 938 |
|
| 939 |
<varlistentry> |
| 940 |
<term><option>tpm2-measure-bank=</option></term> |
| 941 |
|
| 942 |
<listitem><para>Selects one or more TPM2 PCR banks to measure the volume key into, as configured with |
| 943 |
<option>tpm2-measure-pcr=</option> above. Multiple banks may be specified, separated by a colon |
| 944 |
character. If not specified, automatically determines available and used banks. Expects a message |
| 945 |
digest name (e.g. <literal>sha1</literal>, <literal>sha256</literal>, …) as argument, to identify the |
| 946 |
bank.</para> |
| 947 |
|
| 948 |
<xi:include href="version-info.xml" xpointer="v253"/></listitem> |
| 949 |
</varlistentry> |
| 950 |
|
| 951 |
<varlistentry> |
| 952 |
<term><option>tpm2-measure-keyslot-nvpcr=</option></term> |
| 953 |
|
| 954 |
<listitem><para>Controls whether to measure information about the used LUKS unlock keyslot to a TPM2 |
| 955 |
non-volatile index (nvindex in PCR mode). Takes a boolean argument, or an NvPCR name. If set to false |
| 956 |
or an empty string (which is the default) no TPM2 nvindex extension is done, otherwise keyslot |
| 957 |
information is measured to an nvindex of the specified name, which is allocated if needed. If set to |
| 958 |
true the recommended default of <literal>cryptsetup</literal> is selected as NvPCR. The slot index |
| 959 |
and the used unlock mechanism (i.e. <literal>tpm2</literal>, <literal>fido2</literal>, |
| 960 |
<literal>pkcs11</literal>) are measured along with the activated volume name and its UUID.</para> |
| 961 |
|
| 962 |
<xi:include href="version-info.xml" xpointer="v259"/></listitem> |
| 963 |
</varlistentry> |
| 964 |
|
| 965 |
<varlistentry> |
| 966 |
<term><option>token-timeout=</option></term> |
| 967 |
|
| 968 |
<listitem><para>Specifies how long to wait at most for configured security devices (i.e. FIDO2, |
| 969 |
PKCS#11, TPM2) to show up. Takes a time value in seconds (but other time units may be specified too, |
| 970 |
see <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 971 |
for supported formats). Defaults to 30s. Once the specified timeout elapsed authentication via |
| 972 |
password is attempted. Note that this timeout applies to waiting for the security device to show up — |
| 973 |
it does not apply to the PIN prompt for the device (should one be needed) or similar. Pass 0 to turn |
| 974 |
off the timeout and wait forever.</para> |
| 975 |
|
| 976 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 977 |
</varlistentry> |
| 978 |
|
| 979 |
<varlistentry> |
| 980 |
<term><option>try-empty-password=</option></term> |
| 981 |
|
| 982 |
<listitem><para>Takes a boolean argument. If enabled, right before asking the user for a password it |
| 983 |
is first attempted to unlock the volume with an empty password. This is useful for systems that are |
| 984 |
initialized with an encrypted volume with only an empty password set, which shall be replaced with a |
| 985 |
suitable password during first boot, but after activation.</para> |
| 986 |
|
| 987 |
<xi:include href="version-info.xml" xpointer="v246"/></listitem> |
| 988 |
</varlistentry> |
| 989 |
|
| 990 |
<varlistentry> |
| 991 |
<term><option>x-systemd.device-timeout=</option></term> |
| 992 |
|
| 993 |
<listitem><para>Specifies how long systemd should wait for a block device to show up before |
| 994 |
giving up on the entry. The argument is a time in seconds or explicitly specified units of |
| 995 |
<literal>s</literal>, <literal>min</literal>, <literal>h</literal>, <literal>ms</literal>. |
| 996 |
</para> |
| 997 |
|
| 998 |
<xi:include href="version-info.xml" xpointer="v216"/></listitem> |
| 999 |
</varlistentry> |
| 1000 |
|
| 1001 |
<varlistentry> |
| 1002 |
<term><option>x-initrd.attach</option></term> |
| 1003 |
|
| 1004 |
<listitem><para>Setup this encrypted block device in the initrd, similarly to |
| 1005 |
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 1006 |
units marked with <option>x-initrd.mount</option>.</para> |
| 1007 |
|
| 1008 |
<para>Although it is not necessary to mark the mount entry for the root file system with |
| 1009 |
<option>x-initrd.mount</option>, <option>x-initrd.attach</option> is still recommended with |
| 1010 |
the encrypted block device containing the root file system as otherwise systemd will |
| 1011 |
attempt to detach the device during the regular system shutdown while it is still in |
| 1012 |
use. With this option the device will still be detached but later after the root file |
| 1013 |
system is unmounted.</para> |
| 1014 |
|
| 1015 |
<para>All other encrypted block devices that contain file systems mounted in the initrd should use |
| 1016 |
this option.</para> |
| 1017 |
|
| 1018 |
<xi:include href="version-info.xml" xpointer="v245"/> |
| 1019 |
</listitem> |
| 1020 |
</varlistentry> |
| 1021 |
|
| 1022 |
<varlistentry> |
| 1023 |
<term><option>fixate-volume-key=</option></term> |
| 1024 |
|
| 1025 |
<listitem><para>Pin the expected hash of the volume key.</para> |
| 1026 |
|
| 1027 |
<para>In certain cases, e.g. for LUKS volumes where the key is sealed to the TPM2, this may be required |
| 1028 |
to provide a guarantee that the volume being attached is the volume which was previously created. |
| 1029 |
<option>fixate-volume-key=</option> can be used to set the expected volume key hash and refuse to attach the volume |
| 1030 |
if it has a different one. The expected hash matches the digest which is measured to the sha256 PCR bank of the |
| 1031 |
TPM2 when <option>tpm2-measure-pcr=</option> is used.</para> |
| 1032 |
|
| 1033 |
<para>For newly created LUKS volumes, the expected hash can be generated by |
| 1034 |
<citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 1035 |
For additional details, see the <option>EncryptedVolume=</option> description at |
| 1036 |
<citerefentry><refentrytitle>repart.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> |
| 1037 |
|
| 1038 |
<xi:include href="version-info.xml" xpointer="v260"/> |
| 1039 |
</listitem> |
| 1040 |
</varlistentry> |
| 1041 |
|
| 1042 |
</variablelist> |
| 1043 |
|
| 1044 |
<para>At early boot and when the system manager configuration is |
| 1045 |
reloaded, this file is translated into native systemd units by |
| 1046 |
<citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para> |
| 1047 |
</refsect1> |
| 1048 |
|
| 1049 |
<refsect1> |
| 1050 |
<title><constant>AF_UNIX</constant> Key Files</title> |
| 1051 |
|
| 1052 |
<para>If the key file path (as specified in the third column of <filename>/etc/crypttab</filename> |
| 1053 |
entries, see above) refers to an <constant>AF_UNIX</constant> stream socket in the file system, the key |
| 1054 |
is acquired by connecting to the socket and reading the key from the connection. The connection is made |
| 1055 |
from an <constant>AF_UNIX</constant> socket name in the abstract namespace, see <citerefentry |
| 1056 |
project='man-pages'><refentrytitle>unix</refentrytitle><manvolnum>7</manvolnum></citerefentry> for |
| 1057 |
details. The source socket name is chosen according to the following format:</para> |
| 1058 |
|
| 1059 |
<programlisting><constant>NUL</constant> <replaceable>RANDOM</replaceable> /cryptsetup/ <replaceable>VOLUME</replaceable></programlisting> |
| 1060 |
|
| 1061 |
<para>In other words: a <constant>NUL</constant> byte (as required for abstract namespace sockets), |
| 1062 |
followed by a random string (consisting of alphanumeric characters only), followed by the literal |
| 1063 |
string <literal>/cryptsetup/</literal>, followed by the name of the volume to acquire they key |
| 1064 |
for. For example, for the volume <literal>myvol</literal>:</para> |
| 1065 |
|
| 1066 |
<programlisting>\0d7067f78d9827418/cryptsetup/myvol</programlisting> |
| 1067 |
|
| 1068 |
<para>Services listening on the <constant>AF_UNIX</constant> stream socket may query the source socket |
| 1069 |
name with <citerefentry |
| 1070 |
project='man-pages'><refentrytitle>getpeername</refentrytitle><manvolnum>2</manvolnum></citerefentry>, |
| 1071 |
and use this to determine which key to send, allowing a single listening socket to serve keys for |
| 1072 |
multiple volumes. If the PKCS#11 logic is used (see above), the socket source name is picked in similar |
| 1073 |
fashion, except that the literal string <literal>/cryptsetup-pkcs11/</literal> is used. And similarly for |
| 1074 |
FIDO2 (<literal>/cryptsetup-fido2-salt/</literal>) and TPM2 (<literal>/cryptsetup-tpm2/</literal>). |
| 1075 |
A different path component is used so that services providing key material know that the secret key was |
| 1076 |
not requested directly, but instead an encrypted key that will be decrypted via the PKCS#11/FIDO2/TPM2 |
| 1077 |
logic to acquire the final secret key.</para> |
| 1078 |
</refsect1> |
| 1079 |
|
| 1080 |
<refsect1> |
| 1081 |
<title>Examples</title> |
| 1082 |
<example> |
| 1083 |
<title>/etc/crypttab example</title> |
| 1084 |
<para>Set up four encrypted block devices. One using LUKS for normal storage, another one for usage as |
| 1085 |
a swap device and two TrueCrypt volumes. For the fourth device, the option string is interpreted as two |
| 1086 |
options <literal>cipher=xchacha12,aes-adiantum-plain64</literal>, |
| 1087 |
<literal>keyfile-timeout=10s</literal>.</para> |
| 1088 |
|
| 1089 |
<programlisting>luks UUID=2505567a-9e27-4efe-a4d5-15ad146c258b |
| 1090 |
swap /dev/sda7 /dev/urandom swap |
| 1091 |
truecrypt /dev/sda2 /etc/container_password tcrypt |
| 1092 |
hidden /mnt/tc_hidden /dev/null tcrypt-hidden,tcrypt-keyfile=/etc/keyfile |
| 1093 |
external /dev/sda3 keyfile:LABEL=keydev keyfile-timeout=10s,cipher=xchacha12\,aes-adiantum-plain64 |
| 1094 |
</programlisting> |
| 1095 |
</example> |
| 1096 |
|
| 1097 |
<example> |
| 1098 |
<title>Yubikey-based PKCS#11 Volume Unlocking Example</title> |
| 1099 |
|
| 1100 |
<para>The PKCS#11 logic allows hooking up any compatible security token that is capable of storing RSA |
| 1101 |
or EC cryptographic keys for unlocking an encrypted volume. Here's an example how to set up a Yubikey |
| 1102 |
security token for this purpose on a LUKS2 volume, using <citerefentry |
| 1103 |
project='debian'><refentrytitle>ykmap</refentrytitle><manvolnum>1</manvolnum></citerefentry> from the |
| 1104 |
yubikey-manager project to initialize the token and |
| 1105 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 1106 |
to add it in the LUKS2 volume:</para> |
| 1107 |
|
| 1108 |
<programlisting><xi:include href="yubikey-crypttab.sh" parse="text" /></programlisting> |
| 1109 |
|
| 1110 |
<para>A few notes on the above:</para> |
| 1111 |
|
| 1112 |
<itemizedlist> |
| 1113 |
<listitem><para>We use RSA2048, which is the longest key size current Yubikeys support</para></listitem> |
| 1114 |
<listitem><para>We use Yubikey key slot 9d, since that's apparently the keyslot to use for decryption purposes, |
| 1115 |
see |
| 1116 |
<ulink url="https://developers.yubico.com/PIV/Introduction/Certificate_slots.html">Yubico PIV certificate slots</ulink>. |
| 1117 |
</para></listitem> |
| 1118 |
</itemizedlist> |
| 1119 |
</example> |
| 1120 |
|
| 1121 |
<example> |
| 1122 |
<title>FIDO2 Volume Unlocking Example</title> |
| 1123 |
|
| 1124 |
<para>The FIDO2 logic allows using any compatible FIDO2 security token that implements the |
| 1125 |
<literal>hmac-secret</literal> extension for unlocking an encrypted volume. Here's an example how to |
| 1126 |
set up a FIDO2 security token for this purpose for a LUKS2 volume, using |
| 1127 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry>:</para> |
| 1128 |
|
| 1129 |
<programlisting><xi:include href="fido2-crypttab.sh" parse="text" /></programlisting> |
| 1130 |
</example> |
| 1131 |
|
| 1132 |
<example> |
| 1133 |
<title>TPM2 Volume Unlocking Example</title> |
| 1134 |
|
| 1135 |
<para>The TPM2 logic allows using any TPM2 chip supported by the Linux kernel for unlocking an |
| 1136 |
encrypted volume. Here's an example how to set up a TPM2 chip for this purpose for a LUKS2 volume, |
| 1137 |
using |
| 1138 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry>:</para> |
| 1139 |
|
| 1140 |
<programlisting><xi:include href="tpm2-crypttab.sh" parse="text" /></programlisting> |
| 1141 |
</example> |
| 1142 |
</refsect1> |
| 1143 |
|
| 1144 |
<refsect1> |
| 1145 |
<title>See Also</title> |
| 1146 |
<para><simplelist type="inline"> |
| 1147 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 1148 |
<member><citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 1149 |
<member><citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 1150 |
<member><citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 1151 |
<member><citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 1152 |
<member><citerefentry><refentrytitle>repart.d</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 1153 |
<member><citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 1154 |
<member><citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 1155 |
<member><citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 1156 |
<member><citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 1157 |
</simplelist></para> |
| 1158 |
</refsect1> |
| 1159 |
|
| 1160 |
</refentry> |