| 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-pcrlock" conditional='ENABLE_BOOTLOADER HAVE_OPENSSL HAVE_TPM2' |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-pcrlock</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-pcrlock</refentrytitle> |
| 16 |
<manvolnum>8</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-pcrlock</refname> |
| 21 |
<refname>systemd-pcrlock-file-system.service</refname> |
| 22 |
<refname>systemd-pcrlock-firmware-code.service</refname> |
| 23 |
<refname>systemd-pcrlock-firmware-config.service</refname> |
| 24 |
<refname>systemd-pcrlock-machine-id.service</refname> |
| 25 |
<refname>systemd-pcrlock-make-policy.service</refname> |
| 26 |
<refname>systemd-pcrlock-secureboot-authority.service</refname> |
| 27 |
<refname>systemd-pcrlock-secureboot-policy.service</refname> |
| 28 |
<refpurpose>Analyze and predict TPM2 PCR states and generate an access policy from the prediction</refpurpose> |
| 29 |
</refnamediv> |
| 30 |
|
| 31 |
<refsynopsisdiv> |
| 32 |
<cmdsynopsis> |
| 33 |
<command>/usr/lib/systemd/systemd-pcrlock</command> <arg choice="opt" rep="repeat">OPTIONS</arg> |
| 34 |
</cmdsynopsis> |
| 35 |
</refsynopsisdiv> |
| 36 |
|
| 37 |
<refsect1> |
| 38 |
<title>Description</title> |
| 39 |
|
| 40 |
<para>Note: this command is experimental for now. While it is likely to become a regular component of |
| 41 |
systemd, it might still change in behaviour and interface.</para> |
| 42 |
|
| 43 |
<para><command>systemd-pcrlock</command> is a tool that may be used to analyze and predict TPM2 PCR |
| 44 |
measurements, and generate TPM2 access policies from the prediction which it stores in a TPM2 NV index |
| 45 |
(i.e. in the TPM2 non-volatile memory). This may then be used to restrict access to TPM2 objects (such as |
| 46 |
disk encryption keys) to system boot-ups in which only specific, trusted components are used.</para> |
| 47 |
|
| 48 |
<para><command>systemd-pcrlock</command> uses as input for its analysis and prediction:</para> |
| 49 |
|
| 50 |
<itemizedlist> |
| 51 |
<listitem><para>The UEFI firmware TPM2 event log |
| 52 |
(i.e. <filename>/sys/kernel/security/tpm0/binary_bios_measurements</filename>) of the current |
| 53 |
boot.</para></listitem> |
| 54 |
|
| 55 |
<listitem><para>The userspace TPM2 event log |
| 56 |
(i.e. <filename>/run/log/systemd/tpm2-measure.log</filename>) of the current |
| 57 |
boot.</para></listitem> |
| 58 |
|
| 59 |
<listitem><para>The current PCR state of the TPM2 chip.</para></listitem> |
| 60 |
|
| 61 |
<listitem><para>Boot component definition files (<filename>*.pcrlock</filename> and |
| 62 |
<filename>*.pcrlock.d/*.pcrlock</filename>, see |
| 63 |
<citerefentry><refentrytitle>systemd.pcrlock</refentrytitle><manvolnum>5</manvolnum></citerefentry>) |
| 64 |
that each define expected measurements for one component of the boot process, permitting alternative |
| 65 |
variants for each. (Variants may be used to bless multiple kernel versions or boot loader versions |
| 66 |
at the same time.)</para></listitem> |
| 67 |
</itemizedlist> |
| 68 |
|
| 69 |
<para>It uses these inputs to generate a combined event log, validating it against the PCR states. It |
| 70 |
then attempts to recognize event log records and matches them against the defined components. For each PCR |
| 71 |
where this can be done comprehensively (i.e. where all listed records and all defined components have |
| 72 |
been matched) this may then be used to predict future PCR measurements, taking the alternative variants |
| 73 |
defined for each component into account. This prediction may then be converted into a TPM2 access policy |
| 74 |
(consisting of TPM2 <function>PolicyPCR</function> and <function>PolicyOR</function> items), which is |
| 75 |
then stored in an NV index in the TPM2. This may be used to then lock secrets (such as disk encryption |
| 76 |
keys) to these policies (via a TPM2 <function>PolicyAuthorizeNV</function> policy).</para> |
| 77 |
|
| 78 |
<para>Use tools such as |
| 79 |
<citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 80 |
or <citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry> to |
| 81 |
bind disk encryption to such a <command>systemd-pcrlock</command> TPM2 policy. Specifically, see the |
| 82 |
<option>--tpm2-pcrlock=</option> switches of these tools.</para> |
| 83 |
|
| 84 |
<para>The access policy logic requires a TPM2 device that implements the |
| 85 |
<literal>PolicyAuthorizeNV</literal> command, i.e. implements TPM 2.0 version 1.38 or newer.</para> |
| 86 |
</refsect1> |
| 87 |
|
| 88 |
<refsect1> |
| 89 |
<title>Commands</title> |
| 90 |
|
| 91 |
<para>The following commands are understood:</para> |
| 92 |
|
| 93 |
<variablelist> |
| 94 |
<varlistentry> |
| 95 |
<term><command>log</command></term> |
| 96 |
|
| 97 |
<listitem><para>This reads the combined TPM2 event log, validates it, matches it against the current |
| 98 |
PCR values, and outputs both in tabular form. Combine with <option>--json=</option> to generate |
| 99 |
output in JSON format.</para> |
| 100 |
|
| 101 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 102 |
</varlistentry> |
| 103 |
|
| 104 |
<varlistentry> |
| 105 |
<term><command>cel</command></term> |
| 106 |
|
| 107 |
<listitem><para>This reads the combined TPM2 event log and writes it to STDOUT in <ulink |
| 108 |
url="https://trustedcomputinggroup.org/resource/canonical-event-log-format/">TCG Canonical Event Log |
| 109 |
Format (CEL-JSON)</ulink>.</para> |
| 110 |
|
| 111 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 112 |
</varlistentry> |
| 113 |
|
| 114 |
<varlistentry> |
| 115 |
<term><command>list-components</command></term> |
| 116 |
|
| 117 |
<listitem><para>Shows a list of component definitions and their variants, i.e. the |
| 118 |
<filename>*.pcrlock</filename> files discovered in <filename>/var/lib/pcrlock.d/</filename>, |
| 119 |
<filename>/usr/lib/pcrlock.d/</filename>, and the other supported directories. See |
| 120 |
<citerefentry><refentrytitle>systemd.pcrlock</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 121 |
for details on these files and the full list of directories searched.</para> |
| 122 |
|
| 123 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 124 |
</varlistentry> |
| 125 |
|
| 126 |
<varlistentry> |
| 127 |
<term><command>predict</command></term> |
| 128 |
|
| 129 |
<listitem><para>Predicts the PCR state on future boots. This will analyze the TPM2 event log as |
| 130 |
described above, recognize components, and then generate all possible resulting PCR values for all |
| 131 |
combinations of component variants. Note that no prediction is made for PCRs whose value does not |
| 132 |
match the event log records, for which unrecognized measurements are discovered or for which |
| 133 |
components are defined that cannot be found in the event log. This is a safety measure to ensure that |
| 134 |
any generated access policy can be fulfilled correctly on current and future boots.</para> |
| 135 |
|
| 136 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 137 |
</listitem> |
| 138 |
</varlistentry> |
| 139 |
|
| 140 |
<varlistentry> |
| 141 |
<term><command>make-policy</command></term> |
| 142 |
|
| 143 |
<listitem><para>This predicts the PCR state for future boots, much like the |
| 144 |
<command>predict</command> command above. It then uses this data to generate a TPM2 access policy |
| 145 |
which it stores in a TPM2 NV index. The prediction and information about the used TPM2 and its NV |
| 146 |
index are written to <filename>/var/lib/systemd/pcrlock.json</filename>.</para> |
| 147 |
|
| 148 |
<para>The NV index is allocated on first invocation, and updated on subsequent invocations.</para> |
| 149 |
|
| 150 |
<para>The NV index contents may be changed (and thus the policy stored in it updated) by providing an |
| 151 |
access PIN. This PIN is normally generated automatically and stored in encrypted form (with an access |
| 152 |
policy binding it to the NV index itself) in the aforementioned JSON policy file. This PIN may be |
| 153 |
chosen by the user, via the <option>--recovery-pin=</option> switch. If specified it may be used as |
| 154 |
alternative path of access to update the policy.</para> |
| 155 |
|
| 156 |
<para>If the new prediction matches the old this command terminates quickly and executes no further |
| 157 |
operation. (Unless <option>--force</option> is specified, see below.)</para> |
| 158 |
|
| 159 |
<para>Starting with v256, a copy of the <filename>/var/lib/systemd/pcrlock.json</filename> policy |
| 160 |
file is encoded in a credential (see |
| 161 |
<citerefentry><refentrytitle>systemd-creds</refentrytitle><manvolnum>1</manvolnum></citerefentry> for |
| 162 |
details) and written to the EFI System Partition or XBOOTLDR partition, in the |
| 163 |
<filename>/loader/credentials/</filename> subdirectory. There it is picked up at boot by |
| 164 |
<citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> and |
| 165 |
passed to the invoked initrd, where it can be used to unlock the root file system (which typically |
| 166 |
contains <filename>/var/</filename>, which is where the primary copy of the policy is located, which |
| 167 |
hence cannot be used to unlock the root file system). The credential file is named after the boot |
| 168 |
entry token of the installation (see |
| 169 |
<citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>), which |
| 170 |
is configurable via the <option>--entry-token=</option> switch, see below.</para> |
| 171 |
|
| 172 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 173 |
</listitem> |
| 174 |
</varlistentry> |
| 175 |
|
| 176 |
<varlistentry> |
| 177 |
<term><command>remove-policy</command></term> |
| 178 |
|
| 179 |
<listitem><para>Removes a previously generated policy. Deletes the |
| 180 |
<filename>/var/lib/systemd/pcrlock.json</filename> file, and deallocates the NV index.</para> |
| 181 |
|
| 182 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 183 |
</listitem> |
| 184 |
</varlistentry> |
| 185 |
|
| 186 |
<varlistentry> |
| 187 |
<term><command>is-supported</command></term> |
| 188 |
|
| 189 |
<listitem><para>Checks if the local TPM2 supports all functionality for |
| 190 |
<command>systemd-pcrlock</command> to work correctly. This does similar tests as |
| 191 |
<command>systemd-analyze has-tpm2</command>, but also checks for supported of the TPM2 operations |
| 192 |
requires by <command>systemd-pcrlock</command>. Outputs one of <literal>no</literal>, |
| 193 |
<literal>partial</literal> (in case some parts of TPM2 support are available in hardware, firmware, |
| 194 |
OS, but not complete), <literal>obsolete</literal> (if TPM2 support is available in hardware, |
| 195 |
firmware and OS, but the operations required for <command>systemd-pcrlock</command> are missing), |
| 196 |
<literal>yes</literal>. Returns an exit status of zero if full support is available, otherwise |
| 197 |
non-zero.</para> |
| 198 |
|
| 199 |
<para>If combined with <option>--quiet</option>, suppresses the output of the string.</para> |
| 200 |
|
| 201 |
<para>Currently, this checks for support for the PolicAuthorizeNV TPM2 command, as well as for |
| 202 |
support of the SHA-256 hash algorithm.</para> |
| 203 |
|
| 204 |
<xi:include href="version-info.xml" xpointer="v258"/> |
| 205 |
</listitem> |
| 206 |
</varlistentry> |
| 207 |
|
| 208 |
<varlistentry> |
| 209 |
<term><command>lock-firmware-code</command></term> |
| 210 |
<term><command>unlock-firmware-code</command></term> |
| 211 |
|
| 212 |
<listitem><para>Generates/removes <filename>.pcrlock</filename> files based on the TPM2 event log of |
| 213 |
the current boot covering all records for PCRs 0 ("platform-code") and 2 ("external-code").</para> |
| 214 |
|
| 215 |
<para>This operation allows locking the boot process to the current version of the firmware of the |
| 216 |
system and its extension cards. This operation should only be used if the system vendor does not |
| 217 |
provide suitable pcrlock data ahead of time.</para> |
| 218 |
|
| 219 |
<para>Note that this data only matches the current version of the firmware. If a firmware update is |
| 220 |
applied this data will be out-of-date and any access policy generated from it will no longer pass. It |
| 221 |
is thus recommended to invoke <command>unlock-firmware-code</command> before doing a firmware update, |
| 222 |
followed by <command>make-policy</command> to refresh the policy.</para> |
| 223 |
|
| 224 |
<para><command>systemd-pcrlock lock-firmware-code</command> is invoked automatically at boot via the |
| 225 |
<filename>systemd-pcrlock-firmware-code.service</filename> unit, if enabled. This ensures that an |
| 226 |
access policy managed by <command>systemd-pcrlock</command> is automatically locked to the new |
| 227 |
firmware version whenever the policy has been relaxed temporarily, in order to cover for firmware |
| 228 |
updates, as described above.</para> |
| 229 |
|
| 230 |
<para>The files are only generated from the event log if the event log matches the current TPM2 PCR |
| 231 |
state.</para> |
| 232 |
|
| 233 |
<para>This writes/removes the files |
| 234 |
<filename>/var/lib/pcrlock.d/250-firmware-code-early.pcrlock.d/generated.pcrlock</filename> and |
| 235 |
<filename>/var/lib/pcrlock.d/550-firmware-code-late.pcrlock.d/generated.pcrlock</filename>.</para> |
| 236 |
|
| 237 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 238 |
</listitem> |
| 239 |
</varlistentry> |
| 240 |
|
| 241 |
<varlistentry> |
| 242 |
<term><command>lock-firmware-config</command></term> |
| 243 |
<term><command>unlock-firmware-config</command></term> |
| 244 |
|
| 245 |
<listitem><para>This is similar to |
| 246 |
<command>lock-firmware-code</command>/<command>unlock-firmware-code</command> but locks down the |
| 247 |
firmware configuration, i.e. PCRs 1 ("platform-config") and 3 ("external-config").</para> |
| 248 |
|
| 249 |
<para>This functionality should be used with care as in most scenarios a minor firmware configuration |
| 250 |
change should not invalidate access policies to TPM2 objects. Also note that some systems measure |
| 251 |
unstable and unpredictable information (e.g. current CPU voltages, temperatures, as part of SMBIOS |
| 252 |
data) to these PCRs, which means this form of lockdown cannot be used reliably on such systems. Use |
| 253 |
this functionality only if the system and hardware is well known and does not suffer by these |
| 254 |
limitations, for example in virtualized environments.</para> |
| 255 |
|
| 256 |
<para>Use <command>unlock-firmware-config</command> before making firmware configuration changes. If |
| 257 |
the <filename>systemd-pcrlock-firmware-config.service</filename> unit is enabled it will |
| 258 |
automatically generate a pcrlock file from the new measurements.</para> |
| 259 |
|
| 260 |
<para>This writes/removes the files |
| 261 |
<filename>/var/lib/pcrlock.d/250-firmware-config-early.pcrlock.d/generated.pcrlock</filename> and |
| 262 |
<filename>/var/lib/pcrlock.d/550-firmware-config-late.pcrlock.d/generated.pcrlock</filename>.</para> |
| 263 |
|
| 264 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 265 |
</listitem> |
| 266 |
</varlistentry> |
| 267 |
|
| 268 |
<varlistentry> |
| 269 |
<term><command>lock-secureboot-policy</command></term> |
| 270 |
<term><command>unlock-secureboot-policy</command></term> |
| 271 |
|
| 272 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on the SecureBoot policy |
| 273 |
currently enforced. This looks at the SecureBoot, PK, KEK, db, dbx, dbt, dbr EFI variables and |
| 274 |
predicts their measurements to PCR 7 ("secure-boot-policy") on the next boot.</para> |
| 275 |
|
| 276 |
<para>Use <command>unlock-firmware-config</command> before applying SecureBoot policy updates. If |
| 277 |
the <filename>systemd-pcrlock-secureboot-policy.service</filename> unit is enabled it will |
| 278 |
automatically generate a pcrlock file from the policy discovered.</para> |
| 279 |
|
| 280 |
<para>This writes/removes the file |
| 281 |
<filename>/var/lib/pcrlock.d/230-secureboot-policy.pcrlock.d/generated.pcrlock</filename>.</para> |
| 282 |
|
| 283 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 284 |
</listitem> |
| 285 |
</varlistentry> |
| 286 |
|
| 287 |
<varlistentry> |
| 288 |
<term><command>lock-secureboot-authority</command></term> |
| 289 |
<term><command>unlock-secureboot-authority</command></term> |
| 290 |
|
| 291 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on the SecureBoot |
| 292 |
authorities used to validate the boot path. SecureBoot authorities are the specific SecureBoot |
| 293 |
database entries that where used to validate the UEFI PE binaries executed at boot. This looks at the |
| 294 |
event log of the current boot, and uses relevant measurements on PCR 7 |
| 295 |
("secure-boot-policy").</para> |
| 296 |
|
| 297 |
<para>This writes/removes the file |
| 298 |
<filename>/var/lib/pcrlock.d/620-secureboot-authority.pcrlock.d/generated.pcrlock</filename>.</para> |
| 299 |
|
| 300 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 301 |
</listitem> |
| 302 |
</varlistentry> |
| 303 |
|
| 304 |
<varlistentry> |
| 305 |
<term><command>lock-gpt</command> <optional><replaceable>DEVICE</replaceable></optional></term> |
| 306 |
<term><command>unlock-gpt</command></term> |
| 307 |
|
| 308 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on the GPT partition |
| 309 |
table of the specified disk. If no disk is specified automatically determines the block device |
| 310 |
backing the root file system. This locks the state of the disk partitioning of the booted medium, |
| 311 |
which firmware measures to PCR 5 ("boot-loader-config").</para> |
| 312 |
|
| 313 |
<para>This writes/removes the file |
| 314 |
<filename>/var/lib/pcrlock.d/600-gpt.pcrlock.d/generated.pcrlock</filename>.</para> |
| 315 |
|
| 316 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 317 |
</listitem> |
| 318 |
</varlistentry> |
| 319 |
|
| 320 |
<varlistentry> |
| 321 |
<term><command>lock-pe</command> <optional><replaceable>BINARY</replaceable></optional></term> |
| 322 |
<term><command>unlock-pe</command></term> |
| 323 |
|
| 324 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on the specified PE |
| 325 |
binary. This is useful for predicting measurements the firmware makes to PCR 4 ("boot-loader-code") |
| 326 |
if the specified binary is part of the UEFI boot process. Use this on boot loader binaries and |
| 327 |
suchlike. Use <command>lock-uki</command> (see below) for PE binaries that are unified kernel images |
| 328 |
(UKIs).</para> |
| 329 |
|
| 330 |
<para>Expects a path to the PE binary as argument. If not specified, reads the binary from STDIN |
| 331 |
instead.</para> |
| 332 |
|
| 333 |
<para>The pcrlock file to write must be specified via the <option>--pcrlock=</option> switch.</para> |
| 334 |
|
| 335 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 336 |
</listitem> |
| 337 |
</varlistentry> |
| 338 |
|
| 339 |
<varlistentry> |
| 340 |
<term><command>lock-uki</command> <optional><replaceable>UKI</replaceable></optional></term> |
| 341 |
<term><command>unlock-uki</command></term> |
| 342 |
|
| 343 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on the specified UKI PE |
| 344 |
binary. This is useful for predicting measurements the firmware makes to PCR 4 ("boot-loader-code"), |
| 345 |
and <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 346 |
makes to PCR 11 ("kernel-boot"), if the specified UKI is booted. This is a superset of |
| 347 |
<command>lock-pe</command>.</para> |
| 348 |
|
| 349 |
<para>Expects a path to the UKI PE binary as argument. If not specified, reads the binary from STDIN |
| 350 |
instead.</para> |
| 351 |
|
| 352 |
<para>The pcrlock file to write must be specified via the <option>--pcrlock=</option> switch.</para> |
| 353 |
|
| 354 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 355 |
</listitem> |
| 356 |
</varlistentry> |
| 357 |
|
| 358 |
<varlistentry> |
| 359 |
<term><command>lock-machine-id</command></term> |
| 360 |
<term><command>unlock-machine-id</command></term> |
| 361 |
|
| 362 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on |
| 363 |
<filename>/etc/machine-id</filename>. This is useful for predicting measurements |
| 364 |
<citerefentry><refentrytitle>systemd-pcrmachine.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 365 |
makes to PCR 15 ("system-identity").</para> |
| 366 |
|
| 367 |
<para>This writes/removes the file |
| 368 |
<filename>/var/lib/pcrlock.d/820-machine-id.pcrlock</filename>.</para> |
| 369 |
|
| 370 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 371 |
</listitem> |
| 372 |
</varlistentry> |
| 373 |
|
| 374 |
<varlistentry> |
| 375 |
<term><command>lock-file-system</command> <optional><replaceable>PATH</replaceable></optional></term> |
| 376 |
<term><command>unlock-file-system</command> <optional><replaceable>PATH</replaceable></optional></term> |
| 377 |
|
| 378 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on file system |
| 379 |
identity. This is useful for predicting measurements |
| 380 |
<citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 381 |
makes to PCR 15 ("system-identity") for the root and <filename>/var/</filename> file systems.</para> |
| 382 |
|
| 383 |
<para>This writes/removes the files |
| 384 |
<filename>/var/lib/pcrlock.d/830-root-file-system.pcrlock</filename> and |
| 385 |
<filename>/var/lib/pcrlock.d/840-file-system-<replaceable>path</replaceable>.pcrlock</filename>.</para> |
| 386 |
|
| 387 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 388 |
</listitem> |
| 389 |
</varlistentry> |
| 390 |
|
| 391 |
<varlistentry> |
| 392 |
<term><command>lock-kernel-cmdline</command> <optional><replaceable>FILE</replaceable></optional></term> |
| 393 |
<term><command>unlock-kernel-cmdline</command></term> |
| 394 |
|
| 395 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on |
| 396 |
<filename>/proc/cmdline</filename> (or the specified file if given). This is useful for predicting |
| 397 |
measurements the Linux kernel makes to PCR 9 ("kernel-initrd").</para> |
| 398 |
|
| 399 |
<para>This writes/removes the file |
| 400 |
<filename>/var/lib/pcrlock.d/710-kernel-cmdline.pcrlock/generated.pcrlock</filename>.</para> |
| 401 |
|
| 402 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 403 |
</listitem> |
| 404 |
</varlistentry> |
| 405 |
|
| 406 |
<varlistentry> |
| 407 |
<term><command>lock-kernel-initrd</command> <replaceable>FILE</replaceable></term> |
| 408 |
<term><command>unlock-kernel-initrd</command></term> |
| 409 |
|
| 410 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on a kernel initrd cpio |
| 411 |
archive. This is useful for predicting measurements the Linux kernel makes to PCR 9 |
| 412 |
("kernel-initrd"). Do not use for |
| 413 |
<citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 414 |
UKIs, as the initrd is combined dynamically from various sources and hence does not take a single |
| 415 |
input, like this command.</para> |
| 416 |
|
| 417 |
<para>This writes/removes the file |
| 418 |
<filename>/var/lib/pcrlock.d/720-kernel-initrd.pcrlock/generated.pcrlock</filename>.</para> |
| 419 |
|
| 420 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 421 |
</listitem> |
| 422 |
</varlistentry> |
| 423 |
|
| 424 |
<varlistentry> |
| 425 |
<term><command>lock-raw</command> <optional><replaceable>FILE</replaceable></optional></term> |
| 426 |
<term><command>unlock-raw</command></term> |
| 427 |
|
| 428 |
<listitem><para>Generates/removes a <filename>.pcrlock</filename> file based on raw binary data. The |
| 429 |
data is either read from the specified file or from STDIN (if none is specified). This requires that |
| 430 |
<option>--pcrs=</option> is specified. The generated .pcrlock file is written to the file specified |
| 431 |
via <option>--pcrlock=</option> or to STDOUT (if none is specified).</para> |
| 432 |
|
| 433 |
<xi:include href="version-info.xml" xpointer="v255"/> |
| 434 |
</listitem> |
| 435 |
</varlistentry> |
| 436 |
|
| 437 |
</variablelist> |
| 438 |
</refsect1> |
| 439 |
|
| 440 |
<refsect1> |
| 441 |
<title>Options</title> |
| 442 |
|
| 443 |
<para>The following options are understood:</para> |
| 444 |
|
| 445 |
<variablelist> |
| 446 |
<varlistentry> |
| 447 |
<term><option>--raw-description</option></term> |
| 448 |
|
| 449 |
<listitem><para>When displaying the TPM2 event log do not attempt to decode the records to provide a |
| 450 |
friendly event log description string. Instead, show the binary payload data in escaped form.</para> |
| 451 |
|
| 452 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 453 |
</varlistentry> |
| 454 |
|
| 455 |
<varlistentry> |
| 456 |
<term><option>--pcr=</option></term> |
| 457 |
|
| 458 |
<listitem><para>Specifies the PCR number to use. May be specified more than once to select multiple |
| 459 |
PCRs.</para> |
| 460 |
|
| 461 |
<para>This is used by <command>lock-raw</command> and <command>lock-pe</command> to select the |
| 462 |
PCR to lock against.</para> |
| 463 |
|
| 464 |
<para>If used with <command>predict</command> and <command>make-policy</command> this will override |
| 465 |
which PCRs to include in the prediction and policy. If unspecified this defaults to PCRs 0-5, 7, |
| 466 |
11, 13-15. Note that these commands will not include any PCRs in the prediction/policy (even if specified |
| 467 |
explicitly) if there are measurements in the event log that do not match the current PCR value, or |
| 468 |
there are unrecognized measurements in the event log, or components define measurements not seen in |
| 469 |
the event log.</para> |
| 470 |
|
| 471 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 472 |
</varlistentry> |
| 473 |
|
| 474 |
<varlistentry> |
| 475 |
<term><option>--nv-index=</option></term> |
| 476 |
|
| 477 |
<listitem><para>Specifies the NV index to store the policy in. Honoured by |
| 478 |
<command>make-policy</command>. If not specified, the command will automatically pick a free NV |
| 479 |
index.</para> |
| 480 |
|
| 481 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 482 |
</varlistentry> |
| 483 |
|
| 484 |
<varlistentry> |
| 485 |
<term><option>--components=</option></term> |
| 486 |
|
| 487 |
<listitem><para>Takes a path to read <filename>*.pcrlock</filename> and |
| 488 |
<filename>*.pcrlock.d/*.pcrlock</filename> files from. May be used more than once to specify multiple |
| 489 |
such directories. If not specified, defaults to <filename>/etc/pcrlock.d/</filename>, |
| 490 |
<filename>/run/pcrlock.d/</filename>, <filename>/var/lib/pcrlock.d/</filename>, |
| 491 |
<filename>/usr/local/lib/pcrlock.d/</filename>, <filename>/usr/lib/pcrlock.d/</filename>.</para> |
| 492 |
|
| 493 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 494 |
</varlistentry> |
| 495 |
|
| 496 |
<varlistentry> |
| 497 |
<term><option>--location=</option></term> |
| 498 |
|
| 499 |
<listitem><para>Takes either a string or a colon-separated pair of strings. Configures up to which |
| 500 |
point in the sorted list of defined components to analyze/predict PCRs to. Typically, the |
| 501 |
<command>systemd-pcrlock</command> tool is invoked from a fully booted system after boot-up and |
| 502 |
before shutdown. This means various components that are defined for shutdown have not been measured |
| 503 |
yet, and should not be searched for. This option allows one to restrict which components are |
| 504 |
considered for analysis (taking only components before some point into account, ignoring components |
| 505 |
after them). The expected string is ordered against the filenames of the components defined. Any |
| 506 |
components with a lexicographically later name are ignored. This logic applies to the |
| 507 |
<command>log</command>, <command>predict</command>, and <command>make-policy</command> verbs. If a |
| 508 |
colon-separated pair of strings are specified then they select which phases of the boot to include |
| 509 |
in the prediction/policy. The first string defines where the first prediction shall be made, and the |
| 510 |
second string defines where the last prediction shall be made. All such predictions are then combined |
| 511 |
into one set.</para> |
| 512 |
|
| 513 |
<para>If used with <command>list-components</command> the selected location range will be highlighted |
| 514 |
in the component list.</para> |
| 515 |
|
| 516 |
<para>Defaults to <literal>760-:940-</literal>, which means the policies generated by default will |
| 517 |
basically cover the whole runtime of the OS userspace, from the initrd (as <literal>760-</literal> |
| 518 |
closely follows <filename>750-enter-initrd.pcrlock</filename>) until (and including) the main runtime |
| 519 |
of the system (as <literal>940-</literal> is closely followed by |
| 520 |
<filename>950-shutdown.pcrlock</filename>). See |
| 521 |
<citerefentry><refentrytitle>systemd.pcrlock</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 522 |
for a full list of well-known components, that illustrate where this range is placed by |
| 523 |
default.</para> |
| 524 |
|
| 525 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 526 |
</varlistentry> |
| 527 |
|
| 528 |
<varlistentry> |
| 529 |
<term><option>--recovery-pin=</option></term> |
| 530 |
|
| 531 |
<listitem><para>Takes one of <literal>hide</literal>, <literal>show</literal> or |
| 532 |
<literal>query</literal>. Defaults to <literal>hide</literal>. Honoured by |
| 533 |
<command>make-policy</command>. If <literal>query</literal>, will query the user for a PIN to unlock |
| 534 |
the TPM2 NV index with. If no policy was created before, this PIN is used to protect the newly |
| 535 |
allocated NV index. If a policy has been created before, the PIN is used to unlock write access to |
| 536 |
the NV index. If either <literal>hide</literal> or <literal>show</literal> is used, a PIN is |
| 537 |
automatically generated, and — only in case of <literal>show</literal> — displayed on |
| 538 |
screen. Regardless if user supplied or automatically generated, it is stored in encrypted form in the |
| 539 |
policy metadata file. The recovery PIN may be used to regain write access to an NV index in case the |
| 540 |
access policy became out of date.</para> |
| 541 |
|
| 542 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 543 |
</varlistentry> |
| 544 |
|
| 545 |
<varlistentry> |
| 546 |
<term><option>--pcrlock=</option></term> |
| 547 |
|
| 548 |
<listitem><para>Takes a file system path as argument. If specified, configures where to write the |
| 549 |
generated pcrlock data to. Honoured by the various <command>lock-*</command> commands. If not |
| 550 |
specified, a default path is generally used, as documented above.</para> |
| 551 |
|
| 552 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 553 |
</varlistentry> |
| 554 |
|
| 555 |
<varlistentry> |
| 556 |
<term><option>--policy=</option></term> |
| 557 |
|
| 558 |
<listitem><para>Takes a file system path as argument. If specified, configures where to write pcrlock |
| 559 |
policy metadata to. If not specified, defaults to |
| 560 |
<filename>/var/lib/systemd/pcrlock.json</filename>.</para> |
| 561 |
|
| 562 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 563 |
</varlistentry> |
| 564 |
|
| 565 |
<varlistentry> |
| 566 |
<term><option>--force</option></term> |
| 567 |
|
| 568 |
<listitem><para>If specified with <command>make-policy</command>, the predicted policy will be |
| 569 |
written to the NV index even if it is detected to be the same as the previously stored |
| 570 |
one.</para> |
| 571 |
|
| 572 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 573 |
</varlistentry> |
| 574 |
|
| 575 |
<varlistentry> |
| 576 |
<term><option>--entry-token=</option></term> |
| 577 |
|
| 578 |
<listitem><para>Sets the boot entry token to use for the file name for the pcrlock policy credential |
| 579 |
in the EFI System Partition or XBOOTLDR partition. See the |
| 580 |
<citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> option of |
| 581 |
the same regarding expected values. This switch has an effect on the |
| 582 |
<command>make-policy</command> command only.</para> |
| 583 |
|
| 584 |
<xi:include href="version-info.xml" xpointer="v256"/></listitem> |
| 585 |
</varlistentry> |
| 586 |
|
| 587 |
<varlistentry> |
| 588 |
<term><option>--quiet</option></term> |
| 589 |
|
| 590 |
<listitem><para>If specified suppresses output when invoked for |
| 591 |
<command>is-supported</command>.</para> |
| 592 |
|
| 593 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 594 |
</varlistentry> |
| 595 |
|
| 596 |
<xi:include href="standard-options.xml" xpointer="json" /> |
| 597 |
<xi:include href="standard-options.xml" xpointer="no-pager" /> |
| 598 |
<xi:include href="standard-options.xml" xpointer="help" /> |
| 599 |
<xi:include href="standard-options.xml" xpointer="version" /> |
| 600 |
</variablelist> |
| 601 |
</refsect1> |
| 602 |
|
| 603 |
<refsect1> |
| 604 |
<title>Exit status</title> |
| 605 |
|
| 606 |
<para>On success, 0 is returned, a non-zero failure code otherwise.</para> |
| 607 |
</refsect1> |
| 608 |
|
| 609 |
<refsect1> |
| 610 |
<title>See Also</title> |
| 611 |
<para><simplelist type="inline"> |
| 612 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 613 |
<member><citerefentry><refentrytitle>systemd.pcrlock</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 614 |
<member><citerefentry><refentrytitle>systemd-cryptenroll</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 615 |
<member><citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 616 |
<member><citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 617 |
<member><citerefentry><refentrytitle>systemd-pcrmachine.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 618 |
<member><citerefentry><refentrytitle>systemd-creds</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 619 |
<member><citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 620 |
<member><citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 621 |
</simplelist></para> |
| 622 |
</refsect1> |
| 623 |
|
| 624 |
</refentry> |