Debian Codegraph @

man/systemd-cryptsetup.xml

raw
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 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id="systemd-cryptsetup" conditional='HAVE_LIBCRYPTSETUP' xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>systemd-cryptsetup</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>systemd-cryptsetup</refentrytitle>
15 <manvolnum>8</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>systemd-cryptsetup</refname>
20 <refname>[email protected]</refname>
21 <!-- <refname>system-systemd\x2dcryptsetup.slice</refname> — this causes meson to go haywire because it
22 thinks this is a (windows) path. Let's just not create the alias for this name, and only include it
23 in the synopsis. -->
24 <refpurpose>Full disk decryption logic</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <cmdsynopsis>
29 <command>systemd-cryptsetup</command>
30 <arg choice="opt" rep="repeat">OPTIONS</arg>
31 <arg choice="plain">attach</arg>
32 <arg choice="plain">VOLUME</arg>
33 <arg choice="plain">SOURCE-DEVICE</arg>
34 <arg choice="opt">KEY-FILE</arg>
35 <arg choice="opt">CRYPTTAB-OPTIONS</arg>
36 </cmdsynopsis>
37
38 <cmdsynopsis>
39 <command>systemd-cryptsetup</command>
40 <arg choice="opt" rep="repeat">OPTIONS</arg>
41 <arg choice="plain">detach</arg>
42 <arg choice="plain">VOLUME</arg>
43 </cmdsynopsis>
44
45 <para><filename>[email protected]</filename></para>
46 <para><filename>system-systemd\x2dcryptsetup.slice</filename></para>
47 </refsynopsisdiv>
48
49 <refsect1>
50 <title>Description</title>
51
52 <para><command>systemd-cryptsetup</command> is used to set up (with <command>attach</command>) and tear
53 down (with <command>detach</command>) access to an encrypted block device. It is primarily used via
54 <filename>[email protected]</filename> during early boot, but may also be called manually.
55 The positional arguments <parameter>VOLUME</parameter>, <parameter>SOURCE-DEVICE</parameter>,
56 <parameter>KEY-FILE</parameter>, and <parameter>CRYPTTAB-OPTIONS</parameter> have the same meaning as the
57 fields in <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
58 </para>
59
60 <para><filename>[email protected]</filename> is a service responsible for providing access to
61 encrypted block devices. It is instantiated for each device that requires decryption.</para>
62
63 <para><filename>[email protected]</filename> instances are part of the
64 <filename>system-systemd\x2dcryptsetup.slice</filename> slice, which is destroyed only very late in the
65 shutdown procedure. This allows the encrypted devices to remain up until filesystems have been unmounted.
66 </para>
67
68 <para><filename>[email protected]</filename> will ask
69 for hard disk passwords via the <ulink
70 url="https://systemd.io/PASSWORD_AGENTS/">password agent logic</ulink>, in
71 order to query the user for the password using the right mechanism at boot
72 and during runtime.</para>
73
74 <para>At early boot and when the system manager configuration is reloaded, <filename>/etc/crypttab</filename> is
75 translated into <filename>[email protected]</filename> units by
76 <citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
77
78 <para>In order to unlock a volume a password or binary key is required.
79 <filename>[email protected]</filename> tries to acquire a suitable password or binary key via
80 the following mechanisms, tried in order:</para>
81
82 <orderedlist>
83 <listitem><para>If a key file is explicitly configured (via the third column in
84 <filename>/etc/crypttab</filename>), a key read from it is used. If a PKCS#11 token, FIDO2 token or
85 TPM2 device is configured (using the <varname>pkcs11-uri=</varname>, <varname>fido2-device=</varname>,
86 <varname>tpm2-device=</varname> options) the key is decrypted before use.</para></listitem>
87
88 <listitem><para>If no key file is configured explicitly this way, a key file is automatically loaded
89 from <filename>/etc/cryptsetup-keys.d/<replaceable>volume</replaceable>.key</filename> and
90 <filename>/run/cryptsetup-keys.d/<replaceable>volume</replaceable>.key</filename>, if present. Here
91 too, if a PKCS#11/FIDO2/TPM2 token/device is configured, any key found this way is decrypted before
92 use.</para></listitem>
93
94 <listitem><para>If the <varname>try-empty-password</varname> option is specified then unlocking the
95 volume with an empty password is attempted.</para></listitem>
96
97 <listitem><para>If the <varname>password-cache=</varname> option is set to <literal>yes</literal> or
98 <literal>read-only</literal>, the kernel keyring is then checked for a suitable cached password from
99 previous attempts.</para></listitem>
100
101 <listitem><para>Finally, the user is queried for a password, possibly multiple times, unless
102 the <varname>headless</varname> option is set.</para></listitem>
103 </orderedlist>
104
105 <para>If no suitable key may be acquired via any of the mechanisms describes above, volume activation fails.</para>
106 </refsect1>
107
108 <refsect1>
109 <title>Credentials</title>
110
111 <para><command>systemd-cryptsetup</command> supports the service credentials logic as implemented by
112 <varname>ImportCredential=</varname>/<varname>LoadCredential=</varname>/<varname>SetCredential=</varname>
113 (see <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
114 details). The following credentials are used by <literal>[email protected]</literal>
115 (generated by <command>systemd-gpt-auto-generator</command>) when passed in:</para>
116
117 <variablelist class='system-credentials'>
118 <varlistentry>
119 <term><varname>cryptsetup.passphrase</varname></term>
120
121 <listitem><para>This credential specifies the passphrase of the LUKS volume.</para>
122
123 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
124 </varlistentry>
125
126 <varlistentry>
127 <term><varname>cryptsetup.tpm2-pin</varname></term>
128
129 <listitem><para>This credential specifies the TPM pin.</para>
130
131 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
132 </varlistentry>
133
134 <varlistentry>
135 <term><varname>cryptsetup.fido2-pin</varname></term>
136
137 <listitem><para>This credential specifies the FIDO2 token pin.</para>
138
139 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
140 </varlistentry>
141
142 <varlistentry>
143 <term><varname>cryptsetup.pkcs11-pin</varname></term>
144
145 <listitem><para>This credential specifies the PKCS11 token pin.</para>
146
147 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
148 </varlistentry>
149
150 <varlistentry>
151 <term><varname>cryptsetup.luks2-pin</varname></term>
152
153 <listitem><para>This credential specifies the pin requested by generic LUKS2 token modules.</para>
154
155 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
156 </varlistentry>
157 </variablelist>
158 </refsect1>
159
160 <refsect1>
161 <title>See Also</title>
162 <para><simplelist type="inline">
163 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
164 <member><citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
165 <member><citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
166 <member><citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
167 <member><citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
168 <member><ulink url="https://systemd.io/TPM2_PCR_MEASUREMENTS">TPM2 PCR Measurements Made by systemd</ulink></member>
169 </simplelist></para>
170 </refsect1>
171
172 </refentry>