| 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.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd-validatefs_.service" conditional='HAVE_BLKID' |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>[email protected]</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>[email protected]</refentrytitle> |
| 16 |
<manvolnum>8</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>[email protected]</refname> |
| 21 |
<refpurpose>Validate File System Mount Constraint Data</refpurpose> |
| 22 |
</refnamediv> |
| 23 |
|
| 24 |
<refsynopsisdiv> |
| 25 |
<para><filename>[email protected]</filename></para> |
| 26 |
<para><filename>/usr/lib/systemd/systemd-validatefs</filename> <optional><replaceable>DEVICE</replaceable></optional></para> |
| 27 |
</refsynopsisdiv> |
| 28 |
|
| 29 |
<refsect1> |
| 30 |
<title>Description</title> |
| 31 |
|
| 32 |
<para><filename>[email protected]</filename> is a system service template that can be |
| 33 |
instantiated for newly established mount points. It reads file system mount constraint data from the file |
| 34 |
system, and ensures the mount runtime setup matches it. If it doesn't the service fails, which effects an |
| 35 |
immediate reboot.</para> |
| 36 |
|
| 37 |
<para>This functionality is supposed to ensure that trusted file systems cannot be used in a different |
| 38 |
context then what they were intended for. More specifically: in an |
| 39 |
<citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 40 |
based environment the file systems to mount are largely auto-discovered based on (unprotected) GPT |
| 41 |
partition table data. The mount constraint information can be used to validate the GPT partition data, |
| 42 |
based on the (protected) file system contents.</para> |
| 43 |
|
| 44 |
<para>Specifically, the mount constraints are encoded in the following extended attributes on the root |
| 45 |
inode of the file systems:</para> |
| 46 |
|
| 47 |
<orderedlist> |
| 48 |
<listitem><para><varname>user.validatefs.mount_point</varname>: this extended attribute shall contain |
| 49 |
one or more absolute, normalized paths, separated by NUL bytes. If set and the specified file system is |
| 50 |
mounted to a location not matching any of the listed paths the validation check will |
| 51 |
fail.</para></listitem> |
| 52 |
|
| 53 |
<listitem><para><varname>user.validatefs.gpt_label</varname>: this extended attribute may contain one |
| 54 |
or more free-form strings, separated by NUL bytes. If set, all backing partitions of the file system |
| 55 |
are checked against this list, and if any backing partition's label is not listed, the validation will |
| 56 |
fail. Note that there may be multiple backing partition in case of Verity setups, which combines a data |
| 57 |
and a hash partition.</para></listitem> |
| 58 |
|
| 59 |
<listitem><para><varname>user.validatefs.gpt_type_uuid</varname>: this extended attribute may contain |
| 60 |
one or more GPT partition type UUIDs, formatted as string, separated by NUL bytes. As above, all |
| 61 |
backing partitions of the file system are checked against this list, and if none is matching the |
| 62 |
validation will fail.</para></listitem> |
| 63 |
</orderedlist> |
| 64 |
|
| 65 |
<para>The <filename>[email protected]</filename> unit is automatically pulled into the initial |
| 66 |
transaction by |
| 67 |
<citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 68 |
for all file systems it discovers and generates mounts |
| 69 |
for. <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 70 |
will do this for all mounts with the <option>x-systemd.validatefs</option> mount option in |
| 71 |
<filename>/etc/fstab</filename>.</para> |
| 72 |
|
| 73 |
<para>The |
| 74 |
<citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry> tool |
| 75 |
generates these extended attributes automatically for the file systems it puts together, which may be |
| 76 |
controlled with the <varname>AddValidateFS=</varname> configuration option.</para> |
| 77 |
</refsect1> |
| 78 |
|
| 79 |
<refsect1> |
| 80 |
<title>Options</title> |
| 81 |
|
| 82 |
<para>The <filename>/usr/lib/systemd/systemd-validatefs</filename> executable may also be invoked from |
| 83 |
the command line, where it expects a path to a mount and the following options:</para> |
| 84 |
|
| 85 |
<variablelist> |
| 86 |
<varlistentry> |
| 87 |
<term><option>--root=</option></term> |
| 88 |
|
| 89 |
<listitem><para>Takes an absolute path or the special string <literal>auto</literal>. The specified |
| 90 |
path is removed as prefix from the specified mount point argument before the validation. If set to |
| 91 |
<literal>auto</literal> defaults to unspecified on the host and <filename>/sysroot/</filename> when |
| 92 |
run in initrd context, in order to validate the mount constraint data relative to the future file |
| 93 |
system root.</para> |
| 94 |
|
| 95 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 96 |
</varlistentry> |
| 97 |
|
| 98 |
<xi:include href="standard-options.xml" xpointer="help" /> |
| 99 |
<xi:include href="standard-options.xml" xpointer="version" /> |
| 100 |
|
| 101 |
</variablelist> |
| 102 |
</refsect1> |
| 103 |
|
| 104 |
<refsect1> |
| 105 |
<title>See Also</title> |
| 106 |
<para><simplelist type="inline"> |
| 107 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 108 |
<member><citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 109 |
<member><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 110 |
<member><citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 111 |
</simplelist></para> |
| 112 |
</refsect1> |
| 113 |
|
| 114 |
</refentry> |