]>
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 | <!-- |
572eb058 ZJS |
6 | SPDX-License-Identifier: LGPL-2.1+ |
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 | --> |
56ba3c78 | 13 | <refentry id="crypttab" conditional='HAVE_LIBCRYPTSETUP'> |
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 ZJS |
43 | |
44 | <para>Each line is in the form<programlisting><replaceable>name</replaceable> <replaceable>encrypted-device</replaceable> <replaceable>password</replaceable> <replaceable>options</replaceable></programlisting> | |
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 | ||
56 | <para>The first field contains the name of the resulting encrypted | |
57 | block device; the device is set up within | |
58 | <filename>/dev/mapper/</filename>.</para> | |
59 | ||
60 | <para>The second field contains a path to the underlying block | |
61 | device or file, or a specification of a block device via | |
62 | <literal>UUID=</literal> followed by the UUID.</para> | |
63 | ||
64 | <para>The third field specifies the encryption password. If the | |
65 | field is not present or the password is set to | |
66 | <literal>none</literal> or <literal>-</literal>, the password has | |
67 | to be manually entered during system boot. Otherwise, the field is | |
037a3ded | 68 | interpreted as an absolute path to a file containing the encryption |
798d3a52 ZJS |
69 | password. For swap encryption, <filename>/dev/urandom</filename> |
70 | or the hardware device <filename>/dev/hw_random</filename> can be | |
71 | used as the password file; using <filename>/dev/random</filename> | |
72 | may prevent boot completion if the system does not have enough | |
73 | entropy to generate a truly random encryption key.</para> | |
74 | ||
75 | <para>The fourth field, if present, is a comma-delimited list of | |
76 | options. The following options are recognized:</para> | |
77 | ||
78 | <variablelist class='fstab-options'> | |
79 | ||
798d3a52 ZJS |
80 | <varlistentry> |
81 | <term><option>cipher=</option></term> | |
82 | ||
83 | <listitem><para>Specifies the cipher to use. See | |
3ba3a79d | 84 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
85 | for possible values and the default value of this option. A |
86 | cipher with unpredictable IV values, such as | |
87 | <literal>aes-cbc-essiv:sha256</literal>, is | |
88 | recommended.</para></listitem> | |
89 | </varlistentry> | |
90 | ||
ed3657d5 ZJS |
91 | <varlistentry> |
92 | <term><option>discard</option></term> | |
93 | ||
94 | <listitem><para>Allow discard requests to be passed through the encrypted block | |
95 | device. This improves performance on SSD storage but has security implications. | |
96 | </para></listitem> | |
97 | </varlistentry> | |
98 | ||
798d3a52 ZJS |
99 | <varlistentry> |
100 | <term><option>hash=</option></term> | |
101 | ||
102 | <listitem><para>Specifies the hash to use for password | |
103 | hashing. See | |
3ba3a79d | 104 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
105 | for possible values and the default value of this |
106 | option.</para></listitem> | |
107 | </varlistentry> | |
108 | ||
109 | <varlistentry> | |
110 | <term><option>header=</option></term> | |
111 | ||
112 | <listitem><para>Use a detached (separated) metadata device or | |
113 | file where the LUKS header is stored. This option is only | |
114 | relevant for LUKS devices. See | |
3ba3a79d | 115 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
116 | for possible values and the default value of this |
117 | option.</para></listitem> | |
118 | </varlistentry> | |
119 | ||
120 | <varlistentry> | |
121 | <term><option>keyfile-offset=</option></term> | |
122 | ||
123 | <listitem><para>Specifies the number of bytes to skip at the | |
124 | start of the key file. See | |
3ba3a79d | 125 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
126 | for possible values and the default value of this |
127 | option.</para></listitem> | |
128 | </varlistentry> | |
129 | ||
130 | <varlistentry> | |
131 | <term><option>keyfile-size=</option></term> | |
132 | ||
133 | <listitem><para>Specifies the maximum number of bytes to read | |
134 | from the key file. See | |
3ba3a79d | 135 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
136 | for possible values and the default value of this option. This |
137 | option is ignored in plain encryption mode, as the key file | |
138 | size is then given by the key size.</para></listitem> | |
139 | </varlistentry> | |
140 | ||
141 | <varlistentry> | |
142 | <term><option>key-slot=</option></term> | |
143 | ||
144 | <listitem><para>Specifies the key slot to compare the | |
145 | passphrase or key against. If the key slot does not match the | |
146 | given passphrase or key, but another would, the setup of the | |
147 | device will fail regardless. This option implies | |
148 | <option>luks</option>. See | |
3ba3a79d | 149 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
150 | for possible values. The default is to try all key slots in |
151 | sequential order.</para></listitem> | |
152 | </varlistentry> | |
153 | ||
4e133451 | 154 | <varlistentry> |
155 | <term><option>keyfile-timeout=</option></term> | |
156 | ||
157 | <listitem><para> Specifies the timeout for the device on | |
158 | which the key file resides and falls back to a password if | |
159 | it could not be mounted. See | |
160 | <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
161 | for key files on external devices. | |
162 | </para></listitem> | |
163 | </varlistentry> | |
164 | ||
798d3a52 ZJS |
165 | <varlistentry> |
166 | <term><option>luks</option></term> | |
167 | ||
168 | <listitem><para>Force LUKS mode. When this mode is used, the | |
169 | following options are ignored since they are provided by the | |
170 | LUKS header on the device: <option>cipher=</option>, | |
171 | <option>hash=</option>, | |
172 | <option>size=</option>.</para></listitem> | |
173 | </varlistentry> | |
174 | ||
b001ad61 ZJS |
175 | <varlistentry> |
176 | <term><option>_netdev</option></term> | |
177 | ||
178 | <listitem><para>Marks this cryptsetup device as requiring network. It will be | |
179 | started after the network is available, similarly to | |
180 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
181 | units marked with <option>_netdev</option>. The service unit to set up this device | |
a0dd2097 | 182 | will be ordered between <filename>remote-fs-pre.target</filename> and |
b001ad61 ZJS |
183 | <filename>remote-cryptsetup.target</filename>, instead of |
184 | <filename>cryptsetup-pre.target</filename> and | |
288c2616 ZJS |
185 | <filename>cryptsetup.target</filename>.</para> |
186 | ||
187 | <para>Hint: if this device is used for a mount point that is specified in | |
188 | <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
189 | the <option>_netdev</option> option should also be used for the mount | |
190 | point. Otherwise, a dependency loop might be created where the mount point | |
191 | will be pulled in by <filename>local-fs.target</filename>, while the | |
192 | service to configure the network is usually only started <emphasis>after</emphasis> | |
193 | the local file system has been mounted.</para> | |
194 | </listitem> | |
b001ad61 ZJS |
195 | </varlistentry> |
196 | ||
798d3a52 ZJS |
197 | <varlistentry> |
198 | <term><option>noauto</option></term> | |
199 | ||
5d0e4851 ZJS |
200 | <listitem><para>This device will not be added to <filename>cryptsetup.target</filename>. |
201 | This means that it will not be automatically unlocked on boot, unless something else pulls | |
202 | it in. In particular, if the device is used for a mount point, it'll be unlocked | |
203 | automatically during boot, unless the mount point itself is also disabled with | |
204 | <option>noauto</option>.</para></listitem> | |
798d3a52 ZJS |
205 | </varlistentry> |
206 | ||
207 | <varlistentry> | |
208 | <term><option>nofail</option></term> | |
209 | ||
5d0e4851 ZJS |
210 | <listitem><para>This device will not be a hard dependency of |
211 | <filename>cryptsetup.target</filename>. It'll be still pulled in and started, but the system | |
212 | will not wait for the device to show up and be unlocked, and boot will not fail if this is | |
213 | unsuccessful. Note that other units that depend on the unlocked device may still fail. In | |
214 | particular, if the device is used for a mount point, the mount point itself is also needs to | |
215 | have <option>noauto</option> option, or the boot will fail if the device is not unlocked | |
216 | successfully.</para></listitem> | |
798d3a52 ZJS |
217 | </varlistentry> |
218 | ||
ed3657d5 ZJS |
219 | <varlistentry> |
220 | <term><option>offset=</option></term> | |
221 | ||
222 | <listitem><para>Start offset in the backend device, in 512-byte sectors. This | |
223 | option is only relevant for plain devices.</para></listitem> | |
224 | </varlistentry> | |
225 | ||
798d3a52 ZJS |
226 | <varlistentry> |
227 | <term><option>plain</option></term> | |
228 | ||
229 | <listitem><para>Force plain encryption mode.</para></listitem> | |
230 | </varlistentry> | |
231 | ||
232 | <varlistentry> | |
233 | <term><option>read-only</option></term><term><option>readonly</option></term> | |
234 | ||
235 | <listitem><para>Set up the encrypted block device in read-only | |
236 | mode.</para></listitem> | |
237 | </varlistentry> | |
238 | ||
2c65512e YW |
239 | <varlistentry> |
240 | <term><option>same-cpu-crypt</option></term> | |
241 | ||
242 | <listitem><para>Perform encryption using the same cpu that IO was submitted on. The default is to use | |
243 | an unbound workqueue so that encryption work is automatically balanced between available CPUs.</para> | |
244 | <para>This requires kernel 4.0 or newer.</para> | |
245 | </listitem> | |
246 | </varlistentry> | |
247 | ||
248 | <varlistentry> | |
249 | <term><option>submit-from-crypt-cpus</option></term> | |
250 | ||
251 | <listitem><para>Disable offloading writes to a separate thread after encryption. There are some | |
252 | situations where offloading write bios from the encryption threads to a single thread degrades | |
253 | performance significantly. The default is to offload write bios to the same thread because it benefits | |
254 | CFQ to have writes submitted using the same context.</para> | |
255 | <para>This requires kernel 4.0 or newer.</para> | |
256 | </listitem> | |
257 | </varlistentry> | |
258 | ||
ed3657d5 ZJS |
259 | <varlistentry> |
260 | <term><option>skip=</option></term> | |
261 | ||
262 | <listitem><para>How many 512-byte sectors of the encrypted data to skip at the | |
263 | beginning. This is different from the <option>offset=</option> option with respect | |
264 | to the sector numbers used in initialization vector (IV) calculation. Using | |
265 | <option>offset=</option> will shift the IV calculation by the same negative | |
266 | amount. Hence, if <option>offset=<replaceable>n</replaceable></option> is given, | |
267 | sector <replaceable>n</replaceable> will get a sector number of 0 for the IV | |
268 | calculation. Using <option>skip=</option> causes sector | |
269 | <replaceable>n</replaceable> to also be the first sector of the mapped device, but | |
270 | with its number for IV generation being <replaceable>n</replaceable>.</para> | |
271 | ||
272 | <para>This option is only relevant for plain devices.</para> | |
273 | </listitem> | |
274 | </varlistentry> | |
275 | ||
798d3a52 ZJS |
276 | <varlistentry> |
277 | <term><option>size=</option></term> | |
278 | ||
279 | <listitem><para>Specifies the key size in bits. See | |
3ba3a79d | 280 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
281 | for possible values and the default value of this |
282 | option.</para></listitem> | |
283 | </varlistentry> | |
284 | ||
a9fc6406 DJL |
285 | <varlistentry> |
286 | <term><option>sector-size=</option></term> | |
287 | ||
288 | <listitem><para>Specifies the sector size in bytes. See | |
289 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
290 | for possible values and the default value of this | |
291 | option.</para></listitem> | |
292 | </varlistentry> | |
293 | ||
798d3a52 ZJS |
294 | <varlistentry> |
295 | <term><option>swap</option></term> | |
296 | ||
297 | <listitem><para>The encrypted block device will be used as a | |
298 | swap device, and will be formatted accordingly after setting | |
299 | up the encrypted block device, with | |
300 | <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
301 | This option implies <option>plain</option>.</para> | |
302 | ||
303 | <para>WARNING: Using the <option>swap</option> option will | |
304 | destroy the contents of the named partition during every boot, | |
305 | so make sure the underlying block device is specified | |
306 | correctly.</para></listitem> | |
307 | </varlistentry> | |
308 | ||
309 | <varlistentry> | |
310 | <term><option>tcrypt</option></term> | |
311 | ||
312 | <listitem><para>Use TrueCrypt encryption mode. When this mode | |
313 | is used, the following options are ignored since they are | |
314 | provided by the TrueCrypt header on the device or do not | |
315 | apply: | |
316 | <option>cipher=</option>, | |
317 | <option>hash=</option>, | |
318 | <option>keyfile-offset=</option>, | |
319 | <option>keyfile-size=</option>, | |
320 | <option>size=</option>.</para> | |
321 | ||
322 | <para>When this mode is used, the passphrase is read from the | |
323 | key file given in the third field. Only the first line of this | |
324 | file is read, excluding the new line character.</para> | |
325 | ||
326 | <para>Note that the TrueCrypt format uses both passphrase and | |
327 | key files to derive a password for the volume. Therefore, the | |
328 | passphrase and all key files need to be provided. Use | |
329 | <option>tcrypt-keyfile=</option> to provide the absolute path | |
330 | to all key files. When using an empty passphrase in | |
331 | combination with one or more key files, use | |
332 | <literal>/dev/null</literal> as the password file in the third | |
333 | field.</para></listitem> | |
334 | </varlistentry> | |
335 | ||
336 | <varlistentry> | |
337 | <term><option>tcrypt-hidden</option></term> | |
338 | ||
339 | <listitem><para>Use the hidden TrueCrypt volume. This option | |
340 | implies <option>tcrypt</option>.</para> | |
341 | ||
342 | <para>This will map the hidden volume that is inside of the | |
343 | volume provided in the second field. Please note that there is | |
344 | no protection for the hidden volume if the outer volume is | |
345 | mounted instead. See | |
3ba3a79d | 346 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
347 | for more information on this limitation.</para></listitem> |
348 | </varlistentry> | |
349 | ||
350 | <varlistentry> | |
351 | <term><option>tcrypt-keyfile=</option></term> | |
352 | ||
353 | <listitem><para>Specifies the absolute path to a key file to | |
354 | use for a TrueCrypt volume. This implies | |
355 | <option>tcrypt</option> and can be used more than once to | |
356 | provide several key files.</para> | |
357 | ||
358 | <para>See the entry for <option>tcrypt</option> on the | |
359 | behavior of the passphrase and key files when using TrueCrypt | |
360 | encryption mode.</para></listitem> | |
361 | </varlistentry> | |
362 | ||
363 | <varlistentry> | |
364 | <term><option>tcrypt-system</option></term> | |
365 | ||
366 | <listitem><para>Use TrueCrypt in system encryption mode. This | |
367 | option implies <option>tcrypt</option>.</para></listitem> | |
368 | </varlistentry> | |
369 | ||
52028838 GH |
370 | <varlistentry> |
371 | <term><option>tcrypt-veracrypt</option></term> | |
372 | ||
373 | <listitem><para>Check for a VeraCrypt volume. VeraCrypt is a fork of | |
374 | TrueCrypt that is mostly compatible, but uses different, stronger key | |
375 | derivation algorithms that cannot be detected without this flag. | |
376 | Enabling this option could substantially slow down unlocking, because | |
377 | VeraCrypt's key derivation takes much longer than TrueCrypt's. This | |
378 | option implies <option>tcrypt</option>.</para></listitem> | |
379 | </varlistentry> | |
380 | ||
798d3a52 ZJS |
381 | <varlistentry> |
382 | <term><option>timeout=</option></term> | |
383 | ||
384 | <listitem><para>Specifies the timeout for querying for a | |
385 | password. If no unit is specified, seconds is used. Supported | |
386 | units are s, ms, us, min, h, d. A timeout of 0 waits | |
387 | indefinitely (which is the default).</para></listitem> | |
388 | </varlistentry> | |
389 | ||
798d3a52 ZJS |
390 | <varlistentry> |
391 | <term><option>tmp</option></term> | |
392 | ||
393 | <listitem><para>The encrypted block device will be prepared | |
394 | for using it as <filename>/tmp</filename>; it will be | |
395 | formatted using | |
396 | <citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
397 | This option implies <option>plain</option>.</para> | |
398 | ||
399 | <para>WARNING: Using the <option>tmp</option> option will | |
400 | destroy the contents of the named partition during every boot, | |
401 | so make sure the underlying block device is specified | |
402 | correctly.</para></listitem> | |
403 | </varlistentry> | |
404 | ||
405 | <varlistentry> | |
406 | <term><option>tries=</option></term> | |
407 | ||
408 | <listitem><para>Specifies the maximum number of times the user | |
409 | is queried for a password. The default is 3. If set to 0, the | |
410 | user is queried for a password indefinitely.</para></listitem> | |
411 | </varlistentry> | |
412 | ||
413 | <varlistentry> | |
414 | <term><option>verify</option></term> | |
415 | ||
416 | <listitem><para> If the encryption password is read from | |
417 | console, it has to be entered twice to prevent | |
418 | typos.</para></listitem> | |
419 | </varlistentry> | |
420 | ||
ed3657d5 ZJS |
421 | <varlistentry> |
422 | <term><option>x-systemd.device-timeout=</option></term> | |
423 | ||
424 | <listitem><para>Specifies how long systemd should wait for a device to show up | |
425 | before giving up on the entry. The argument is a time in seconds or explicitly | |
426 | specified units of | |
427 | <literal>s</literal>, | |
428 | <literal>min</literal>, | |
429 | <literal>h</literal>, | |
430 | <literal>ms</literal>. | |
431 | </para></listitem> | |
432 | </varlistentry> | |
433 | ||
798d3a52 ZJS |
434 | </variablelist> |
435 | ||
436 | <para>At early boot and when the system manager configuration is | |
437 | reloaded, this file is translated into native systemd units by | |
438 | <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para> | |
439 | </refsect1> | |
440 | ||
441 | <refsect1> | |
442 | <title>Example</title> | |
443 | <example> | |
444 | <title>/etc/crypttab example</title> | |
445 | <para>Set up four encrypted block devices. One using LUKS for | |
446 | normal storage, another one for usage as a swap device and two | |
447 | TrueCrypt volumes.</para> | |
448 | ||
449 | <programlisting>luks UUID=2505567a-9e27-4efe-a4d5-15ad146c258b | |
450 | swap /dev/sda7 /dev/urandom swap | |
8cf3ca80 | 451 | truecrypt /dev/sda2 /etc/container_password tcrypt |
4e133451 | 452 | hidden /mnt/tc_hidden /dev/null tcrypt-hidden,tcrypt-keyfile=/etc/keyfile |
453 | external /dev/sda3 keyfile:LABEL=keydev keyfile-timeout=10s</programlisting> | |
798d3a52 ZJS |
454 | </example> |
455 | </refsect1> | |
456 | ||
457 | <refsect1> | |
458 | <title>See Also</title> | |
459 | <para> | |
460 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
461 | <citerefentry><refentrytitle>systemd-cryptsetup@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
462 | <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
288c2616 | 463 | <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
3ba3a79d | 464 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
798d3a52 ZJS |
465 | <citerefentry project='man-pages'><refentrytitle>mkswap</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
466 | <citerefentry project='man-pages'><refentrytitle>mke2fs</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
467 | </para> | |
468 | </refsect1> | |
45ae1a05 LP |
469 | |
470 | </refentry> |