]>
Commit | Line | Data |
---|---|---|
45ae1a05 LP |
1 | <?xml version="1.0"?> |
2 | <!--*-nxml-*--> | |
3a54a157 ZJS |
3 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
4 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
45ae1a05 | 5 | <!-- |
db9ecf05 | 6 | SPDX-License-Identifier: LGPL-2.1-or-later |
572eb058 | 7 | |
45ae1a05 LP |
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 <mitr@redhat.com>. | |
45ae1a05 | 12 | --> |
c2d54475 | 13 | <refentry id="crypttab" conditional='HAVE_LIBCRYPTSETUP' xmlns:xi="http://www.w3.org/2001/XInclude"> |
45ae1a05 | 14 | |
798d3a52 ZJS |
15 | <refentryinfo> |
16 | <title>crypttab</title> | |
17 | <productname>systemd</productname> | |
798d3a52 ZJS |
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 | |
ed3657d5 | 42 | encrypted block device. Fields are delimited by white space.</para> |
b2a1a5c7 | 43 | |
6e41f4dd | 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> |
b2a1a5c7 | 45 | The first two fields are mandatory, the remaining two are |
798d3a52 ZJS |
46 | optional.</para> |
47 | ||
48 | <para>Setting up encrypted block devices using this file supports | |
49 | three encryption modes: LUKS, TrueCrypt and plain. See | |
3ba3a79d | 50 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
51 | for more information about each mode. When no mode is specified in |
52 | the options field and the block device contains a LUKS signature, | |
53 | it is opened as a LUKS device; otherwise, it is assumed to be in | |
54 | raw dm-crypt (plain mode) format.</para> | |
55 | ||
6e41f4dd LP |
56 | <para>The first field contains the name of the resulting encrypted volume; its block device is set up |
57 | below <filename>/dev/mapper/</filename>.</para> | |
798d3a52 ZJS |
58 | |
59 | <para>The second field contains a path to the underlying block | |
60 | device or file, or a specification of a block device via | |
61 | <literal>UUID=</literal> followed by the UUID.</para> | |
62 | ||
b12bd993 | 63 | <para>The third field specifies an absolute path to a file with the encryption key. Optionally, |
f1a20afa | 64 | the path may be followed by <literal>:</literal> and an fstab device specification (e.g. starting with |
b12bd993 ZJS |
65 | <literal>LABEL=</literal> or similar); in which case the path is taken relative to the device file system |
66 | root. If the field is not present or is <literal>none</literal> or <literal>-</literal>, a key file | |
f1a20afa VP |
67 | named after the volume to unlock (i.e. the first column of the line), suffixed with |
68 | <filename>.key</filename> is automatically loaded from the <filename>/etc/cryptsetup-keys.d/</filename> | |
69 | and <filename>/run/cryptsetup-keys.d/</filename> directories, if present. Otherwise, the password has to | |
70 | be manually entered during system boot. For swap encryption, <filename>/dev/urandom</filename> may be | |
71 | used as key file.</para> | |
798d3a52 ZJS |
72 | |
73 | <para>The fourth field, if present, is a comma-delimited list of | |
74 | options. The following options are recognized:</para> | |
75 | ||
76 | <variablelist class='fstab-options'> | |
77 | ||
798d3a52 ZJS |
78 | <varlistentry> |
79 | <term><option>cipher=</option></term> | |
80 | ||
b12bd993 ZJS |
81 | <listitem><para>Specifies the cipher to use. See <citerefentry |
82 | project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
83 | for possible values and the default value of this option. A cipher with unpredictable IV values, such | |
84 | as <literal>aes-cbc-essiv:sha256</literal>, is recommended. Embedded commas in the cipher | |
85 | specification need to be escaped by preceding them with a backslash, see example below.</para> | |
86 | </listitem> | |
798d3a52 ZJS |
87 | </varlistentry> |
88 | ||
ed3657d5 ZJS |
89 | <varlistentry> |
90 | <term><option>discard</option></term> | |
91 | ||
92 | <listitem><para>Allow discard requests to be passed through the encrypted block | |
93 | device. This improves performance on SSD storage but has security implications. | |
94 | </para></listitem> | |
95 | </varlistentry> | |
96 | ||
798d3a52 ZJS |
97 | <varlistentry> |
98 | <term><option>hash=</option></term> | |
99 | ||
100 | <listitem><para>Specifies the hash to use for password | |
101 | hashing. See | |
3ba3a79d | 102 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
103 | for possible values and the default value of this |
104 | option.</para></listitem> | |
105 | </varlistentry> | |
106 | ||
107 | <varlistentry> | |
108 | <term><option>header=</option></term> | |
109 | ||
110 | <listitem><para>Use a detached (separated) metadata device or | |
111 | file where the LUKS header is stored. This option is only | |
112 | relevant for LUKS devices. See | |
3ba3a79d | 113 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 | 114 | for possible values and the default value of this |
13445d97 OK |
115 | option.</para> |
116 | ||
117 | <para>Optionally, the path may be followed by <literal>:</literal> and an fstab device specification | |
118 | (e.g. starting with <literal>UUID=</literal> or similar); in which case, the path is relative to the | |
119 | device file system root. The device gets mounted automatically for LUKS device activation duration only. | |
120 | </para></listitem> | |
798d3a52 ZJS |
121 | </varlistentry> |
122 | ||
123 | <varlistentry> | |
124 | <term><option>keyfile-offset=</option></term> | |
125 | ||
126 | <listitem><para>Specifies the number of bytes to skip at the | |
127 | start of the key file. See | |
3ba3a79d | 128 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
129 | for possible values and the default value of this |
130 | option.</para></listitem> | |
131 | </varlistentry> | |
132 | ||
133 | <varlistentry> | |
134 | <term><option>keyfile-size=</option></term> | |
135 | ||
136 | <listitem><para>Specifies the maximum number of bytes to read | |
137 | from the key file. See | |
3ba3a79d | 138 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
139 | for possible values and the default value of this option. This |
140 | option is ignored in plain encryption mode, as the key file | |
141 | size is then given by the key size.</para></listitem> | |
142 | </varlistentry> | |
143 | ||
6e41f4dd LP |
144 | <varlistentry> |
145 | <term><option>keyfile-erase</option></term> | |
146 | ||
147 | <listitem><para>If enabled, the specified key file is erased after the volume is activated or when | |
148 | activation fails. This is in particular useful when the key file is only acquired transiently before | |
149 | activation (e.g. via a file in <filename>/run/</filename>, generated by a service running before | |
150 | activation), and shall be removed after use. Defaults to off.</para></listitem> | |
151 | </varlistentry> | |
152 | ||
798d3a52 ZJS |
153 | <varlistentry> |
154 | <term><option>key-slot=</option></term> | |
155 | ||
156 | <listitem><para>Specifies the key slot to compare the | |
157 | passphrase or key against. If the key slot does not match the | |
158 | given passphrase or key, but another would, the setup of the | |
159 | device will fail regardless. This option implies | |
160 | <option>luks</option>. See | |
3ba3a79d | 161 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
162 | for possible values. The default is to try all key slots in |
163 | sequential order.</para></listitem> | |
164 | </varlistentry> | |
165 | ||
4e133451 | 166 | <varlistentry> |
167 | <term><option>keyfile-timeout=</option></term> | |
168 | ||
169 | <listitem><para> Specifies the timeout for the device on | |
170 | which the key file resides and falls back to a password if | |
171 | it could not be mounted. See | |
172 | <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
173 | for key files on external devices. | |
174 | </para></listitem> | |
175 | </varlistentry> | |
176 | ||
798d3a52 ZJS |
177 | <varlistentry> |
178 | <term><option>luks</option></term> | |
179 | ||
180 | <listitem><para>Force LUKS mode. When this mode is used, the | |
181 | following options are ignored since they are provided by the | |
182 | LUKS header on the device: <option>cipher=</option>, | |
183 | <option>hash=</option>, | |
184 | <option>size=</option>.</para></listitem> | |
185 | </varlistentry> | |
186 | ||
6cc27c29 MF |
187 | <varlistentry> |
188 | <term><option>bitlk</option></term> | |
189 | ||
190 | <listitem><para>Decrypt Bitlocker drive. Encryption parameters | |
191 | are deduced by cryptsetup from Bitlocker header.</para></listitem> | |
192 | </varlistentry> | |
193 | ||
b001ad61 ZJS |
194 | <varlistentry> |
195 | <term><option>_netdev</option></term> | |
196 | ||
197 | <listitem><para>Marks this cryptsetup device as requiring network. It will be | |
198 | started after the network is available, similarly to | |
199 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
200 | units marked with <option>_netdev</option>. The service unit to set up this device | |
a0dd2097 | 201 | will be ordered between <filename>remote-fs-pre.target</filename> and |
b001ad61 ZJS |
202 | <filename>remote-cryptsetup.target</filename>, instead of |
203 | <filename>cryptsetup-pre.target</filename> and | |
288c2616 ZJS |
204 | <filename>cryptsetup.target</filename>.</para> |
205 | ||
206 | <para>Hint: if this device is used for a mount point that is specified in | |
207 | <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
208 | the <option>_netdev</option> option should also be used for the mount | |
209 | point. Otherwise, a dependency loop might be created where the mount point | |
210 | will be pulled in by <filename>local-fs.target</filename>, while the | |
211 | service to configure the network is usually only started <emphasis>after</emphasis> | |
212 | the local file system has been mounted.</para> | |
213 | </listitem> | |
b001ad61 ZJS |
214 | </varlistentry> |
215 | ||
798d3a52 ZJS |
216 | <varlistentry> |
217 | <term><option>noauto</option></term> | |
218 | ||
5d0e4851 ZJS |
219 | <listitem><para>This device will not be added to <filename>cryptsetup.target</filename>. |
220 | This means that it will not be automatically unlocked on boot, unless something else pulls | |
221 | it in. In particular, if the device is used for a mount point, it'll be unlocked | |
222 | automatically during boot, unless the mount point itself is also disabled with | |
223 | <option>noauto</option>.</para></listitem> | |
798d3a52 ZJS |
224 | </varlistentry> |
225 | ||
226 | <varlistentry> | |
227 | <term><option>nofail</option></term> | |
228 | ||
5d0e4851 | 229 | <listitem><para>This device will not be a hard dependency of |
7792d9cd | 230 | <filename>cryptsetup.target</filename>. It'll still be pulled in and started, but the system |
5d0e4851 ZJS |
231 | will not wait for the device to show up and be unlocked, and boot will not fail if this is |
232 | unsuccessful. Note that other units that depend on the unlocked device may still fail. In | |
7792d9cd AZ |
233 | particular, if the device is used for a mount point, the mount point itself also needs to |
234 | have the <option>nofail</option> option, or the boot will fail if the device is not unlocked | |
5d0e4851 | 235 | successfully.</para></listitem> |
798d3a52 ZJS |
236 | </varlistentry> |
237 | ||
ed3657d5 ZJS |
238 | <varlistentry> |
239 | <term><option>offset=</option></term> | |
240 | ||
241 | <listitem><para>Start offset in the backend device, in 512-byte sectors. This | |
242 | option is only relevant for plain devices.</para></listitem> | |
243 | </varlistentry> | |
244 | ||
798d3a52 ZJS |
245 | <varlistentry> |
246 | <term><option>plain</option></term> | |
247 | ||
248 | <listitem><para>Force plain encryption mode.</para></listitem> | |
249 | </varlistentry> | |
250 | ||
251 | <varlistentry> | |
252 | <term><option>read-only</option></term><term><option>readonly</option></term> | |
253 | ||
254 | <listitem><para>Set up the encrypted block device in read-only | |
255 | mode.</para></listitem> | |
256 | </varlistentry> | |
257 | ||
2c65512e YW |
258 | <varlistentry> |
259 | <term><option>same-cpu-crypt</option></term> | |
260 | ||
261 | <listitem><para>Perform encryption using the same cpu that IO was submitted on. The default is to use | |
262 | an unbound workqueue so that encryption work is automatically balanced between available CPUs.</para> | |
e9dd6984 | 263 | |
2c65512e YW |
264 | <para>This requires kernel 4.0 or newer.</para> |
265 | </listitem> | |
266 | </varlistentry> | |
267 | ||
268 | <varlistentry> | |
269 | <term><option>submit-from-crypt-cpus</option></term> | |
270 | ||
271 | <listitem><para>Disable offloading writes to a separate thread after encryption. There are some | |
e9dd6984 ZJS |
272 | situations where offloading write requests from the encryption threads to a dedicated thread degrades |
273 | performance significantly. The default is to offload write requests to a dedicated thread because it | |
274 | benefits the CFQ scheduler to have writes submitted using the same context.</para> | |
275 | ||
2c65512e YW |
276 | <para>This requires kernel 4.0 or newer.</para> |
277 | </listitem> | |
278 | </varlistentry> | |
279 | ||
ed3657d5 ZJS |
280 | <varlistentry> |
281 | <term><option>skip=</option></term> | |
282 | ||
283 | <listitem><para>How many 512-byte sectors of the encrypted data to skip at the | |
284 | beginning. This is different from the <option>offset=</option> option with respect | |
285 | to the sector numbers used in initialization vector (IV) calculation. Using | |
286 | <option>offset=</option> will shift the IV calculation by the same negative | |
287 | amount. Hence, if <option>offset=<replaceable>n</replaceable></option> is given, | |
288 | sector <replaceable>n</replaceable> will get a sector number of 0 for the IV | |
289 | calculation. Using <option>skip=</option> causes sector | |
290 | <replaceable>n</replaceable> to also be the first sector of the mapped device, but | |
291 | with its number for IV generation being <replaceable>n</replaceable>.</para> | |
292 | ||
293 | <para>This option is only relevant for plain devices.</para> | |
294 | </listitem> | |
295 | </varlistentry> | |
296 | ||
798d3a52 ZJS |
297 | <varlistentry> |
298 | <term><option>size=</option></term> | |
299 | ||
300 | <listitem><para>Specifies the key size in bits. See | |
3ba3a79d | 301 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
302 | for possible values and the default value of this |
303 | option.</para></listitem> | |
304 | </varlistentry> | |
305 | ||
a9fc6406 DJL |
306 | <varlistentry> |
307 | <term><option>sector-size=</option></term> | |
308 | ||
309 | <listitem><para>Specifies the sector size in bytes. See | |
310 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
311 | for possible values and the default value of this | |
312 | option.</para></listitem> | |
313 | </varlistentry> | |
314 | ||
798d3a52 ZJS |
315 | <varlistentry> |
316 | <term><option>swap</option></term> | |
317 | ||
318 | <listitem><para>The encrypted block device will be used as a | |
319 | swap device, and will be formatted accordingly after setting | |
320 | up the encrypted block device, with | |
321 | <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
322 | This option implies <option>plain</option>.</para> | |
323 | ||
324 | <para>WARNING: Using the <option>swap</option> option will | |
325 | destroy the contents of the named partition during every boot, | |
326 | so make sure the underlying block device is specified | |
327 | correctly.</para></listitem> | |
328 | </varlistentry> | |
329 | ||
330 | <varlistentry> | |
331 | <term><option>tcrypt</option></term> | |
332 | ||
333 | <listitem><para>Use TrueCrypt encryption mode. When this mode | |
334 | is used, the following options are ignored since they are | |
335 | provided by the TrueCrypt header on the device or do not | |
336 | apply: | |
337 | <option>cipher=</option>, | |
338 | <option>hash=</option>, | |
339 | <option>keyfile-offset=</option>, | |
340 | <option>keyfile-size=</option>, | |
341 | <option>size=</option>.</para> | |
342 | ||
343 | <para>When this mode is used, the passphrase is read from the | |
344 | key file given in the third field. Only the first line of this | |
345 | file is read, excluding the new line character.</para> | |
346 | ||
347 | <para>Note that the TrueCrypt format uses both passphrase and | |
348 | key files to derive a password for the volume. Therefore, the | |
349 | passphrase and all key files need to be provided. Use | |
350 | <option>tcrypt-keyfile=</option> to provide the absolute path | |
351 | to all key files. When using an empty passphrase in | |
352 | combination with one or more key files, use | |
353 | <literal>/dev/null</literal> as the password file in the third | |
354 | field.</para></listitem> | |
355 | </varlistentry> | |
356 | ||
357 | <varlistentry> | |
358 | <term><option>tcrypt-hidden</option></term> | |
359 | ||
360 | <listitem><para>Use the hidden TrueCrypt volume. This option | |
361 | implies <option>tcrypt</option>.</para> | |
362 | ||
363 | <para>This will map the hidden volume that is inside of the | |
364 | volume provided in the second field. Please note that there is | |
365 | no protection for the hidden volume if the outer volume is | |
366 | mounted instead. See | |
3ba3a79d | 367 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
368 | for more information on this limitation.</para></listitem> |
369 | </varlistentry> | |
370 | ||
371 | <varlistentry> | |
372 | <term><option>tcrypt-keyfile=</option></term> | |
373 | ||
374 | <listitem><para>Specifies the absolute path to a key file to | |
375 | use for a TrueCrypt volume. This implies | |
376 | <option>tcrypt</option> and can be used more than once to | |
377 | provide several key files.</para> | |
378 | ||
379 | <para>See the entry for <option>tcrypt</option> on the | |
380 | behavior of the passphrase and key files when using TrueCrypt | |
381 | encryption mode.</para></listitem> | |
382 | </varlistentry> | |
383 | ||
384 | <varlistentry> | |
385 | <term><option>tcrypt-system</option></term> | |
386 | ||
387 | <listitem><para>Use TrueCrypt in system encryption mode. This | |
388 | option implies <option>tcrypt</option>.</para></listitem> | |
389 | </varlistentry> | |
390 | ||
52028838 GH |
391 | <varlistentry> |
392 | <term><option>tcrypt-veracrypt</option></term> | |
393 | ||
394 | <listitem><para>Check for a VeraCrypt volume. VeraCrypt is a fork of | |
395 | TrueCrypt that is mostly compatible, but uses different, stronger key | |
396 | derivation algorithms that cannot be detected without this flag. | |
397 | Enabling this option could substantially slow down unlocking, because | |
398 | VeraCrypt's key derivation takes much longer than TrueCrypt's. This | |
399 | option implies <option>tcrypt</option>.</para></listitem> | |
400 | </varlistentry> | |
401 | ||
798d3a52 ZJS |
402 | <varlistentry> |
403 | <term><option>timeout=</option></term> | |
404 | ||
405 | <listitem><para>Specifies the timeout for querying for a | |
406 | password. If no unit is specified, seconds is used. Supported | |
407 | units are s, ms, us, min, h, d. A timeout of 0 waits | |
408 | indefinitely (which is the default).</para></listitem> | |
409 | </varlistentry> | |
410 | ||
798d3a52 | 411 | <varlistentry> |
53ac130b | 412 | <term><option>tmp=</option></term> |
798d3a52 | 413 | |
53ac130b LP |
414 | <listitem><para>The encrypted block device will be prepared for using it as |
415 | <filename>/tmp/</filename>; it will be formatted using <citerefentry | |
416 | project='man-pages'><refentrytitle>mkfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>. Takes | |
417 | a file system type as argument, such as <literal>ext4</literal>, <literal>xfs</literal> or | |
418 | <literal>btrfs</literal>. If no argument is specified defaults to <literal>ext4</literal>. This | |
419 | option implies <option>plain</option>.</para> | |
798d3a52 | 420 | |
53ac130b LP |
421 | <para>WARNING: Using the <option>tmp</option> option will destroy the contents of the named partition |
422 | during every boot, so make sure the underlying block device is specified correctly.</para></listitem> | |
798d3a52 ZJS |
423 | </varlistentry> |
424 | ||
425 | <varlistentry> | |
426 | <term><option>tries=</option></term> | |
427 | ||
428 | <listitem><para>Specifies the maximum number of times the user | |
429 | is queried for a password. The default is 3. If set to 0, the | |
430 | user is queried for a password indefinitely.</para></listitem> | |
431 | </varlistentry> | |
432 | ||
433 | <varlistentry> | |
434 | <term><option>verify</option></term> | |
435 | ||
c2d54475 LP |
436 | <listitem><para>If the encryption password is read from console, it has to be entered twice to |
437 | prevent typos.</para></listitem> | |
438 | </varlistentry> | |
439 | ||
440 | <varlistentry> | |
441 | <term><option>pkcs11-uri=</option></term> | |
442 | ||
443 | <listitem><para>Takes a <ulink url="https://tools.ietf.org/html/rfc7512">RFC7512 PKCS#11 URI</ulink> | |
444 | pointing to a private RSA key which is used to decrypt the key specified in the third column of the | |
445 | line. This is useful for unlocking encrypted volumes through security tokens or smartcards. See below | |
446 | for an example how to set up this mechanism for unlocking a LUKS volume with a YubiKey security | |
447 | token. The specified URI can refer directly to a private RSA key stored on a token or alternatively | |
2ccf0ff6 LP |
448 | just to a slot or token, in which case a search for a suitable private RSA key will be performed. In |
449 | this case if multiple suitable objects are found the token is refused. The key configured in the | |
450 | third column is passed as is to RSA decryption. The resulting decrypted key is then base64 encoded | |
451 | before it is used to unlock the LUKS volume.</para></listitem> | |
798d3a52 ZJS |
452 | </varlistentry> |
453 | ||
6e41f4dd LP |
454 | <varlistentry> |
455 | <term><option>try-empty-password=</option></term> | |
456 | ||
457 | <listitem><para>Takes a boolean argument. If enabled, right before asking the user for a password it | |
458 | is first attempted to unlock the volume with an empty password. This is useful for systems that are | |
459 | initialized with an encrypted volume with only an empty password set, which shall be replaced with a | |
460 | suitable password during first boot, but after activation.</para></listitem> | |
461 | </varlistentry> | |
462 | ||
ed3657d5 ZJS |
463 | <varlistentry> |
464 | <term><option>x-systemd.device-timeout=</option></term> | |
465 | ||
466 | <listitem><para>Specifies how long systemd should wait for a device to show up | |
467 | before giving up on the entry. The argument is a time in seconds or explicitly | |
468 | specified units of | |
469 | <literal>s</literal>, | |
470 | <literal>min</literal>, | |
471 | <literal>h</literal>, | |
472 | <literal>ms</literal>. | |
473 | </para></listitem> | |
474 | </varlistentry> | |
475 | ||
1dc85eff FB |
476 | <varlistentry> |
477 | <term><option>x-initrd.attach</option></term> | |
478 | ||
479 | <listitem><para>Setup this encrypted block device in the initramfs, similarly to | |
480 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
481 | units marked with <option>x-initrd.mount</option>.</para> | |
482 | ||
483 | <para>Although it's not necessary to mark the mount entry for the root file system with | |
484 | <option>x-initrd.mount</option>, <option>x-initrd.attach</option> is still recommended with | |
485 | the encrypted block device containing the root file system as otherwise systemd will | |
486 | attempt to detach the device during the regular system shutdown while it's still in | |
487 | use. With this option the device will still be detached but later after the root file | |
488 | system is unmounted.</para> | |
489 | ||
490 | <para>All other encrypted block devices that contain file systems mounted in the initramfs | |
491 | should use this option.</para> | |
492 | </listitem> | |
493 | </varlistentry> | |
494 | ||
798d3a52 ZJS |
495 | </variablelist> |
496 | ||
497 | <para>At early boot and when the system manager configuration is | |
498 | reloaded, this file is translated into native systemd units by | |
499 | <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para> | |
500 | </refsect1> | |
501 | ||
502 | <refsect1> | |
c2d54475 | 503 | <title>Examples</title> |
798d3a52 ZJS |
504 | <example> |
505 | <title>/etc/crypttab example</title> | |
b12bd993 ZJS |
506 | <para>Set up four encrypted block devices. One using LUKS for normal storage, another one for usage as |
507 | a swap device and two TrueCrypt volumes. For the fourth device, the option string is interpreted as two | |
508 | options <literal>cipher=xchacha12,aes-adiantum-plain64</literal>, | |
509 | <literal>keyfile-timeout=10s</literal>.</para> | |
798d3a52 ZJS |
510 | |
511 | <programlisting>luks UUID=2505567a-9e27-4efe-a4d5-15ad146c258b | |
512 | swap /dev/sda7 /dev/urandom swap | |
8cf3ca80 | 513 | truecrypt /dev/sda2 /etc/container_password tcrypt |
4e133451 | 514 | hidden /mnt/tc_hidden /dev/null tcrypt-hidden,tcrypt-keyfile=/etc/keyfile |
b12bd993 ZJS |
515 | external /dev/sda3 keyfile:LABEL=keydev keyfile-timeout=10s,cipher=xchacha12\,aes-adiantum-plain64 |
516 | </programlisting> | |
798d3a52 | 517 | </example> |
c2d54475 LP |
518 | |
519 | <example> | |
520 | <title>Yubikey-based Volume Unlocking Example</title> | |
521 | ||
522 | <para>The PKCS#11 logic allows hooking up any compatible security token that is capable of storing RSA | |
2ccf0ff6 | 523 | decryption keys. Here's an example how to set up a Yubikey security token for this purpose, using |
e9dd6984 ZJS |
524 | <citerefentry project='debian'><refentrytitle>ykmap</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
525 | from the yubikey-manager project:</para> | |
c2d54475 LP |
526 | |
527 | <programlisting><xi:include href="yubikey-crypttab.sh" parse="text" /></programlisting> | |
528 | ||
529 | <para>A few notes on the above:</para> | |
530 | ||
531 | <itemizedlist> | |
532 | <listitem><para>We use RSA (and not ECC), since Yubikeys support PKCS#11 Decrypt() only for RSA keys</para></listitem> | |
533 | <listitem><para>We use RSA2048, which is the longest key size current Yubikeys support</para></listitem> | |
534 | <listitem><para>LUKS key size must be shorter than 2048bit due to RSA padding, hence we use 128 bytes</para></listitem> | |
535 | <listitem><para>We use Yubikey key slot 9d, since that's apparently the keyslot to use for decryption purposes, | |
536 | <ulink url="https://developers.yubico.com/PIV/Introduction/Certificate_slots.html">see | |
537 | documentation</ulink>.</para></listitem> | |
538 | </itemizedlist> | |
539 | ||
540 | </example> | |
798d3a52 ZJS |
541 | </refsect1> |
542 | ||
543 | <refsect1> | |
544 | <title>See Also</title> | |
545 | <para> | |
546 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
547 | <citerefentry><refentrytitle>systemd-cryptsetup@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
548 | <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
288c2616 | 549 | <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
3ba3a79d | 550 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
798d3a52 ZJS |
551 | <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
552 | <citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
553 | </para> | |
554 | </refsect1> | |
45ae1a05 LP |
555 | |
556 | </refentry> |