@@ -9,11 +9,11 @@ SPDX-License-Identifier: LGPL-2.1-or-later
99
1010[ ` systemd-homed.service(8) ` ] ( https://www.freedesktop.org/software/systemd/man/systemd-homed.service.html )
1111manages home directories of regular ("human") users. Each directory it manages
12- encapsulates both the data store and the user record of the user so that it
12+ encapsulates both the data store and the user record of the user, so that it
1313comprehensively describes the user account, and is thus naturally portable
1414between systems without any further, external metadata. This document describes
15- the format used by these home directories, in context of the storage mechanism
16- used.
15+ the format used by these home directories, in the context of the storage
16+ mechanism used.
1717
1818## General Structure
1919
@@ -22,7 +22,7 @@ user record of the user. It follows the format defined in [`JSON User
2222Records`] ( https://systemd.io/USER_RECORD ) . It is recommended to bring the
2323record into 'normalized' form (i.e. all objects should contain their fields
2424sorted alphabetically by their key) before storing it there, though this is not
25- required nor enforced. Since the user record is cryptographically signed the
25+ required nor enforced. Since the user record is cryptographically signed, the
2626user cannot make modifications to the file on their own (at least not without
2727corrupting it, or knowing the private key used for signing the record). Note
2828that user records are stored here without their ` binding ` , ` status ` and
@@ -35,13 +35,13 @@ If the plain directory or `btrfs` subvolume storage mechanism of
3535` systemd-homed ` is used (i.e. ` --storage=directory ` or ` --storage=subvolume ` on
3636the
3737[ ` homectl(1) ` ] ( https://www.freedesktop.org/software/systemd/man/homectl.html )
38- command line) the home directory requires no special set-up besides including
38+ command line) the home directory requires no special setup besides including
3939the user record in the ` ~/.identity ` file.
4040
4141It is recommended to name home directories managed this way by
4242` systemd-homed.service ` by the user name, suffixed with ` .homedir ` (example:
4343` lennart.homedir ` for a user ` lennart ` ) but this is not enforced. When the user
44- is logged in the directory is generally mounted to ` /home/$USER ` (in our
44+ is logged in, the directory is generally mounted to ` /home/$USER ` (in our
4545example: ` /home/lennart ` ), thus dropping the suffix while the home directory is
4646active. ` systemd-homed ` will automatically discover home directories named this
4747way in ` /home/*.homedir ` and synthesize NSS user records for them as they show
@@ -54,19 +54,19 @@ mechanism, except that the home directory is encrypted using `fscrypt`. (Use
5454` --storage=fscrypt ` on the ` homectl ` command line.) Key management is
5555implemented via extended attributes on the directory itself: for each password
5656an extended attribute ` trusted.fscrypt_slot0 ` , ` trusted.fscrypt_slot1 ` ,
57- ` trusted.fscrypt_slot2 ` , … is maintained. It's value contains a colon-separated
57+ ` trusted.fscrypt_slot2 ` , … is maintained. Its value contains a colon-separated
5858pair of Base64 encoded data fields. The first field contains a salt value, the
5959second field the encrypted volume key. The latter is encrypted using AES256 in
60- counter mode, using a key derived from the password via PBKDF2-HMAC-SHA512
60+ counter mode, using a key derived from the password via PBKDF2-HMAC-SHA512,
6161together with the salt value. The construction is similar to what LUKS does for
6262` dm-crypt ` encrypted volumes. Note that extended attributes are not encrypted
63- by ` fscrypt ` and hence are suitable for carry the key slots. Moreover, by using
64- extended attributes the slots are directly attached to the directory and an
65- independent sidecar key database is not required.
63+ by ` fscrypt ` and hence are suitable for carrying the key slots. Moreover, by
64+ using extended attributes, the slots are directly attached to the directory and
65+ an independent sidecar key database is not required.
6666
6767## Storage Mechanism: ` cifs ` Home Directories
6868
69- In this storage mechanism the home directory is mounted from a CIFS server and
69+ In this storage mechanism, the home directory is mounted from a CIFS server and
7070service at login, configured inside the user record. (Use ` --storage=cifs ` on
7171the ` homectl ` command line.) The local password of the user is used to log into
7272the CIFS service. The directory share needs to contain the user record in
@@ -85,7 +85,7 @@ media). (Use `--storage=luks` on the `homectl` command line.) Specifically:
8585
8686* The image contains a GPT partition table. For now it should only contain a
8787 single partition, and that partition must have the type UUID
88- ` 773f91ef-66d4-49b5-bd83-d683bf40ad16 ` . It's partition label must be the
88+ ` 773f91ef-66d4-49b5-bd83-d683bf40ad16 ` . Its partition label must be the
8989 user name.
9090
9191* This partition must contain a LUKS2 volume, whose label must be the user
@@ -106,24 +106,24 @@ media). (Use `--storage=luks` on the `homectl` command line.) Specifically:
106106 contains a second copy of the user record in the ` ~/.identity ` file, like in
107107 the other storage mechanisms.
108108
109- The image file should either reside in a directory ` /home/ ` on the system,
110- named after the user, suffixed with ` .home ` . When activated the container home
109+ The image file should reside in a directory ` /home/ ` on the system,
110+ named after the user, suffixed with ` .home ` . When activated, the container home
111111directory is mounted to the same path, though with the ` .home ` suffix dropped —
112112unless a different mount point is defined in the user record. (e.g.: the
113113loopback file ` /home/waldo.home ` is mounted to ` /home/waldo ` while activated.)
114- When the image is stored on removable media (such as a USB stick) the image
115- file can be directly ` dd ` 'ed onto it, the format is unchanged. The GPT envelope
114+ When the image is stored on removable media (such as a USB stick), the image
115+ file can be directly ` dd ` 'ed onto it; the format is unchanged. The GPT envelope
116116should ensure the image is properly recognizable as a home directory both when
117117used in a loopback file and on a removable USB stick. (Note that when mounting
118- a home directory from an USB stick it too defaults to a directory in ` /home/ ` ,
118+ a home directory from an USB stick, it too defaults to a directory in ` /home/ ` ,
119119named after the username, with no further suffix.)
120120
121121Rationale for the GPT partition table envelope: this way the image is nicely
122122discoverable and recognizable already by partition managers as a home
123123directory. Moreover, when copied onto a USB stick the GPT envelope makes sure
124124the stick is properly recognizable as a portable home directory
125- medium. (Moreover it allows to embed additional partitions later on, for
126- example for allowing a multi-purpose USB stick that contains both a home
125+ medium. (Moreover, it allows embedding additional partitions later on, for
126+ example on a multi-purpose USB stick that contains both a home
127127directory and a generic storage volume.)
128128
129129Rationale for including the encrypted user record in the LUKS2 header:
@@ -133,7 +133,7 @@ images can be used as attack vectors, exploiting the kernel. Thus it is
133133necessary to validate the home directory image * before* mounting it and
134134establishing a minimal level of trust. Since the user record data is
135135cryptographically signed and user records not signed with a recognized private
136- key are not accepted a minimal level of trust between the system and the home
136+ key are not accepted, a minimal level of trust between the system and the home
137137directory image is established.
138138
139139Rationale for storing the home directory one level below to root directory of
@@ -145,10 +145,10 @@ do not show up in the user's home directory.
145145Regardless of the storage mechanism used, an activated home directory
146146necessarily involves a mount point to be established. In case of the
147147directory-based storage mechanisms (` directory ` , ` subvolume ` and ` fscrypt ` )
148- this is a bind mount, in case of ` cifs ` this is a CIFS network mount, and in
148+ this is a bind mount. In case of ` cifs ` this is a CIFS network mount, and in
149149case of the LUKS2 backend a regular block device mount of the file system
150150contained in the LUKS2 image. By requiring a mount for all cases (even for
151- those that already are a directory) a clear logic is defined to distinguish
151+ those that already are a directory), a clear logic is defined to distinguish
152152active and inactive home directories, so that the directories become
153153inaccessible under their regular path the instant they are
154154deactivated. Moreover, the ` nosuid ` , ` nodev ` and ` noexec ` flags configured in
@@ -161,15 +161,15 @@ compared. Activation is only permitted if they match the same user and are
161161signed by a recognized key. When the three instances differ in ` lastChangeUSec `
162162field, the newest record wins, and is propagated to the other two locations.
163163
164- During activation the file system checker (` fsck ` ) appropriate for the
164+ During activation, the file system checker (` fsck ` ) appropriate for the
165165selected file system is automatically invoked, ensuring the file system is in a
166166healthy state before it is mounted.
167167
168168If the UID assigned to a user does not match the owner of the home directory in
169169the file system, the home directory is automatically and recursively ` chown() ` ed
170170to the correct UID.
171171
172- Depending on the ` luksDiscard ` setting of the user record either the backing
172+ Depending on the ` luksDiscard ` setting of the user record, either the backing
173173loopback file is ` fallocate() ` ed during activation, or the mounted file system
174174is ` FITRIM ` ed after mounting, to ensure the setting is correctly enforced.
175175
0 commit comments