]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-pcrphase.service.xml
tree-wide: Drop gnu-efi
[thirdparty/systemd.git] / man / systemd-pcrphase.service.xml
CommitLineData
708d7524
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
dfca5587 6<refentry id="systemd-pcrphase.service" conditional='ENABLE_BOOTLOADER'
708d7524
LP
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-pcrphase.service</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-pcrphase.service</refentrytitle>
16 <manvolnum>8</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-pcrphase.service</refname>
047273e6 21 <refname>systemd-pcrphase-sysinit.service</refname>
708d7524 22 <refname>systemd-pcrphase-initrd.service</refname>
2bd33c90
LP
23 <refname>systemd-pcrmachine.service</refname>
24 <refname>systemd-pcrfs-root.service</refname>
25 <refname>systemd-pcrfs@.service</refname>
708d7524 26 <refname>systemd-pcrphase</refname>
2bd33c90 27 <refpurpose>Measure boot phase into TPM2 PCR 11, machine ID and file system identity into PCR 15</refpurpose>
708d7524
LP
28 </refnamediv>
29
30 <refsynopsisdiv>
31 <para><filename>systemd-pcrphase.service</filename></para>
15f9a152 32 <para><filename>systemd-pcrphase-sysinit.service</filename></para>
708d7524 33 <para><filename>systemd-pcrphase-initrd.service</filename></para>
2bd33c90
LP
34 <para><filename>systemd-pcrmachine.service</filename></para>
35 <para><filename>systemd-pcrfs-root.service</filename></para>
36 <para><filename>systemd-pcrfs@.service</filename></para>
45ab6f2a 37 <para><filename>/usr/lib/systemd/systemd-pcrphase</filename> <optional><replaceable>STRING</replaceable></optional></para>
708d7524
LP
38 </refsynopsisdiv>
39
40 <refsect1>
41 <title>Description</title>
42
047273e6 43 <para><filename>systemd-pcrphase.service</filename>,
86a06615 44 <filename>systemd-pcrphase-sysinit.service</filename>, and
708d7524 45 <filename>systemd-pcrphase-initrd.service</filename> are system services that measure specific strings
047273e6 46 into TPM2 PCR 11 during boot at various milestones of the boot process.</para>
708d7524 47
2bd33c90
LP
48 <para><filename>systemd-pcrmachine.service</filename> is a system service that measures the machine ID
49 (see <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>) into
50 PCR 15.</para>
51
52 <para><filename>systemd-pcrfs-root.service</filename> and <filename>systemd-pcrfs@.service</filename> are
53 services that measure file system identity information (i.e. mount point, file system type, label and
54 UUID, partition label and UUID) into PCR 15. <filename>systemd-pcrfs-root.service</filename> does so for
55 the root file system, <filename>systemd-pcrfs@.service</filename> is a template unit that measures the
56 file system indicated by its instance identifier instead.</para>
57
708d7524
LP
58 <para>These services require
59 <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> to be
8b9f0921
ZJS
60 used in a unified kernel image (UKI). They execute no operation when the stub has not been used to invoke
61 the kernel. The stub will measure the invoked kernel and associated vendor resources into PCR 11 before
86a06615 62 handing control to it; once userspace is invoked these services then will extend TPM2 PCR 11 with certain
2bd33c90
LP
63 literal strings indicating phases of the boot process. During a regular boot process PCR 11 is extended
64 with the following strings:</para>
708d7524
LP
65
66 <orderedlist>
86a06615
ZJS
67 <listitem><para><literal>enter-initrd</literal> — early when the initrd initializes, before activating
68 system extension images for the initrd. It acts as a barrier between the time where the kernel
69 initializes and where the initrd starts operating and enables system extension images, i.e. code
70 shipped outside of the UKI. (This extension happens when
71 <filename>systemd-pcrphase-initrd.service</filename> is started.)</para></listitem>
72
73 <listitem><para><literal>leave-initrd</literal> — when the initrd is about to transition into the host
74 file system. It acts as barrier between initrd code and host OS code. (This extension happens when
75 <filename>systemd-pcrphase-initrd.service</filename> is stopped.)</para></listitem>
76
77 <listitem><para><literal>sysinit</literal> — when basic system initialization is complete (which
78 includes local file systems having been mounted), and the system begins starting regular system
79 services. (This extension happens when <filename>systemd-pcrphase-sysinit.service</filename> is
80 started.)</para></listitem>
81
82 <listitem><para><literal>ready</literal> — during later boot-up, after remote file systems have been
83 activated (i.e. after <filename>remote-fs.target</filename>), but before users are permitted to log in
84 (i.e. before <filename>systemd-user-sessions.service</filename>). It acts as barrier between the time
85 where unprivileged regular users are still prohibited to log in and where they are allowed to log in.
86 (This extension happens when <filename>systemd-pcrphase.service</filename> is started.)
87 </para></listitem>
88
89 <listitem><para><literal>shutdown</literal> — when the system shutdown begins. It acts as barrier
90 between the time the system is fully up and running and where it is about to shut down. (This extension
91 happens when <filename>systemd-pcrphase.service</filename> is stopped.)</para></listitem>
92
93 <listitem><para><literal>final</literal> — at the end of system shutdown. It acts as barrier between
94 the time the service manager still runs and when it transitions into the final shutdown phase where
95 service management is not available anymore. (This extension happens when
96 <filename>systemd-pcrphase-sysinit.service</filename> is stopped.)</para></listitem>
708d7524
LP
97 </orderedlist>
98
86a06615
ZJS
99 <para>During a regular system lifecycle, PCR 11 is extended with the strings
100 <literal>enter-initrd</literal>, <literal>leave-initrd</literal>, <literal>sysinit</literal>,
101 <literal>ready</literal>, <literal>shutdown</literal>, and <literal>final</literal>.</para>
708d7524
LP
102
103 <para>Specific phases of the boot process may be referenced via the series of strings measured, separated
86a06615 104 by colons (the "phase path"). For example, the phase path for the regular system runtime is
047273e6 105 <literal>enter-initrd:leave-initrd:sysinit:ready</literal>, while the one for the initrd is just
86a06615
ZJS
106 <literal>enter-initrd</literal>. The phase path for the boot phase before the initrd is an empty string;
107 because that's hard to pass around a single colon (<literal>:</literal>) may be used instead. Note that
108 the aforementioned six strings are just the default strings and individual systems might measure other
109 strings at other times, and thus implement different and more fine-grained boot phases to bind policy
110 to.</para>
708d7524 111
86a06615
ZJS
112 <para>By binding policy of TPM2 objects to a specific phase path it is possible to restrict access to
113 them to specific phases of the boot process, for example making it impossible to access the root file
114 system's encryption key after the system transitioned from the initrd into the host root file system.
115 </para>
708d7524
LP
116
117 <para>Use
118 <citerefentry><refentrytitle>systemd-measure</refentrytitle><manvolnum>1</manvolnum></citerefentry> to
86a06615
ZJS
119 pre-calculate expected PCR 11 values for specific boot phases (via the <option>--phase=</option> switch).
120 </para>
2bd33c90
LP
121
122 <para><filename>systemd-pcrfs-root.service</filename> and <filename>systemd-pcrfs@.service</filename> are
123 automatically pulled into the initial transaction by
f37f0f35 124 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
2bd33c90
LP
125 for the root and <filename>/var/</filename> file
126 systems. <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
127 will do this for all mounts with the <option>x-systemd.pcrfs</option> mount option in
128 <filename>/etc/fstab</filename>.</para>
708d7524
LP
129 </refsect1>
130
131 <refsect1>
132 <title>Options</title>
133
134 <para>The <filename>/usr/lib/systemd/system-pcrphase</filename> executable may also be invoked from the
135 command line, where it expects the word to extend into PCR 11, as well as the following switches:</para>
136
137 <variablelist>
138 <varlistentry>
139 <term><option>--bank=</option></term>
140
141 <listitem><para>Takes the PCR banks to extend the specified word into. If not specified the tool
142 automatically determines all enabled PCR banks and measures the word into all of
143 them.</para></listitem>
144 </varlistentry>
145
146 <varlistentry>
147 <term><option>--tpm2-device=</option><replaceable>PATH</replaceable></term>
148
149 <listitem><para>Controls which TPM2 device to use. Expects a device node path referring to the TPM2
150 chip (e.g. <filename>/dev/tpmrm0</filename>). Alternatively the special value <literal>auto</literal>
151 may be specified, in order to automatically determine the device node of a suitable TPM2 device (of
152 which there must be exactly one). The special value <literal>list</literal> may be used to enumerate
153 all suitable TPM2 devices currently discovered.</para></listitem>
154 </varlistentry>
155
0318d545
LP
156 <varlistentry>
157 <term><option>--graceful</option></term>
158
159 <listitem><para>If no TPM2 firmware, kernel subsystem, kernel driver or device support is found, exit
160 with exit status 0 (i.e. indicate success). If this is not specified any attempt to measure without a
161 TPM2 device will cause the invocation to fail.</para></listitem>
162 </varlistentry>
163
2bd33c90
LP
164 <varlistentry>
165 <term><option>--machine-id</option></term>
166
167 <listitem><para>Instead of measuring a word specified on the command line into PCR 11, measure the
168 host's machine ID into PCR 15.</para></listitem>
169 </varlistentry>
170
171 <varlistentry>
172 <term><option>--file-system=</option></term>
173
174 <listitem><para>Instead of measuring a word specified on the command line into PCR 11, measure
175 identity information of the specified file system into PCR 15. The parameter must be the path to the
176 established mount point of the file system to measure.</para></listitem>
177 </varlistentry>
178
708d7524
LP
179 <xi:include href="standard-options.xml" xpointer="help" />
180 <xi:include href="standard-options.xml" xpointer="version" />
181
182 </variablelist>
183 </refsect1>
184
185 <refsect1>
186 <title>See Also</title>
187 <para>
188 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
189 <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
2bd33c90 190 <citerefentry><refentrytitle>systemd-measure</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
f37f0f35 191 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
2bd33c90 192 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
708d7524
LP
193 </para>
194 </refsect1>
195
196</refentry>