Debian Codegraph @

upstream/debian-unstable/man7/systemd.image-policy.7

raw
1 '\" t
2 .TH "SYSTEMD\&.IMAGE\-POLICY" "7" "" "systemd 261~rc3" "systemd.image-policy"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd.image-policy \- Disk Image Dissection Policy
24 .SH "DESCRIPTION"
25 .PP
26 In systemd, whenever a disk image (DDI) implementing the
27 \m[blue]\fBUAPI\&.2 Discoverable Partitions Specification\fR\m[]\&\s-2\u[1]\d\s+2
28 is activated, a policy may be specified controlling which partitions to mount and what kind of cryptographic protection to require, and which type of filesystem is allowed\&. Such a disk image dissection policy is a string that contains per\-partition\-type rules, separated by colons (":")\&. The individual rules consist of a partition identifier, an equal sign ("="), and one or more flags which may be set per partition\&. If multiple flags are specified per partition they are separated by a plus sign ("+")\&.
29 .PP
30 The partition identifiers currently defined are:
31 \fBroot\fR,
32 \fBusr\fR,
33 \fBhome\fR,
34 \fBsrv\fR,
35 \fBesp\fR,
36 \fBxbootldr\fR,
37 \fBswap\fR,
38 \fBroot\-verity\fR,
39 \fBroot\-verity\-sig\fR,
40 \fBusr\-verity\fR,
41 \fBusr\-verity\-sig\fR,
42 \fBtmp\fR,
43 \fBvar\fR\&. These identifiers match the relevant partition types in the Discoverable Partitions Specification, but are agnostic to CPU architectures\&. If the partition identifier is left empty it defines the
44 \fIdefault\fR
45 policy for partitions defined in the Discoverable Partitions Specification for which no policy flags are explicitly listed in the policy string\&.
46 .PP
47 The following partition policy flags are defined that dictate the existence/absence, the use, and the protection level of partitions:
48 .sp
49 .RS 4
50 .ie n \{\
51 \h'-04'\(bu\h'+03'\c
52 .\}
53 .el \{\
54 .sp -1
55 .IP \(bu 2.3
56 .\}
57 \fBunprotected\fR
58 for partitions that shall exist and be used, but shall come without cryptographic protection, lacking both Verity authentication and LUKS encryption\&.
59 .RE
60 .sp
61 .RS 4
62 .ie n \{\
63 \h'-04'\(bu\h'+03'\c
64 .\}
65 .el \{\
66 .sp -1
67 .IP \(bu 2.3
68 .\}
69 \fBverity\fR
70 for partitions that shall exist and be used, with Verity authentication\&. (Note: if a DDI image carries a data partition, along with a Verity partition and a signature partition for it, and only the
71 \fBverity\fR
72 flag is set (\fBsigned\fR
73 is not), then the image will be set up with Verity, but the signature data will not be used\&. Or in other words: any DDI with a set of partitions that qualify for
74 \fBsignature\fR
75 also implicitly qualifies for
76 \fBverity\fR, and in fact also
77 \fBunprotected\fR)\&.
78 .RE
79 .sp
80 .RS 4
81 .ie n \{\
82 \h'-04'\(bu\h'+03'\c
83 .\}
84 .el \{\
85 .sp -1
86 .IP \(bu 2.3
87 .\}
88 \fBsigned\fR
89 for partitions that shall exist and be used, with Verity authentication, which are also accompanied by a PKCS#7 signature of the Verity root hash\&.
90 .RE
91 .sp
92 .RS 4
93 .ie n \{\
94 \h'-04'\(bu\h'+03'\c
95 .\}
96 .el \{\
97 .sp -1
98 .IP \(bu 2.3
99 .\}
100 \fBencrypted\fR
101 for partitions which shall exist and be used and are encrypted with LUKS\&.
102 .RE
103 .sp
104 .RS 4
105 .ie n \{\
106 \h'-04'\(bu\h'+03'\c
107 .\}
108 .el \{\
109 .sp -1
110 .IP \(bu 2.3
111 .\}
112 \fBunused\fR
113 for partitions that shall exist but shall not be used\&.
114 .RE
115 .sp
116 .RS 4
117 .ie n \{\
118 \h'-04'\(bu\h'+03'\c
119 .\}
120 .el \{\
121 .sp -1
122 .IP \(bu 2.3
123 .\}
124 \fBabsent\fR
125 for partitions that shall not exist on the image\&.
126 .RE
127 .PP
128 The following filesystem policy flags are defined that dictate which filesystem types are allowed for which partition:
129 .sp
130 .it 1 an-trap
131 .nr an-no-space-flag 1
132 .nr an-break-flag 1
133 .br
134 .B Table\ \&1.\ \& Filesystems types supported by the policy
135 .TS
136 allbox tab(:);
137 lB.
138 T{
139 Filesystem flag
140 T}
141 .T&
142 l
143 l
144 l
145 l
146 l
147 l
148 l.
149 T{
150 "btrfs"
151 T}
152 T{
153 "erofs"
154 T}
155 T{
156 "ext4"
157 T}
158 T{
159 "f2fs"
160 T}
161 T{
162 "squashfs"
163 T}
164 T{
165 "vfat"
166 T}
167 T{
168 "xfs"
169 T}
170 .TE
171 .sp 1
172 .PP
173 By setting a combination of the flags above, alternatives can be declared\&. For example the combination
174 "unused+absent"
175 means: the partition may exist (in which case it shall not be used) or may be absent\&. The combination of
176 "unprotected+verity+signed+encrypted+unused+absent"
177 may be specified via the special shortcut
178 "open", and indicates that the partition may exist or may be absent, but if it exists is used, regardless of the protection level\&.
179 .PP
180 As special rule: if none of the flags above are set for a listed partition identifier, the default policy of
181 \fBopen\fR
182 is implied, i\&.e\&. setting none of these flags listed above means effectively all flags listed above will be set\&.
183 .PP
184 The following partition policy flags are defined that dictate the state of specific GPT partition flags:
185 .sp
186 .RS 4
187 .ie n \{\
188 \h'-04'\(bu\h'+03'\c
189 .\}
190 .el \{\
191 .sp -1
192 .IP \(bu 2.3
193 .\}
194 \fBread\-only\-off\fR,
195 \fBread\-only\-on\fR
196 to require that the partitions have the read\-only partition flag off or on\&.
197 .RE
198 .sp
199 .RS 4
200 .ie n \{\
201 \h'-04'\(bu\h'+03'\c
202 .\}
203 .el \{\
204 .sp -1
205 .IP \(bu 2.3
206 .\}
207 \fBgrowfs\-off\fR,
208 \fBgrowfs\-on\fR
209 to require that the partitions have the growfs partition flag off or on\&.
210 .RE
211 .PP
212 If both
213 \fBread\-only\-off\fR
214 and
215 \fBread\-only\-on\fR
216 are set for a partition, then the state of the read\-only flag on the partition is not dictated by the policy\&. Setting neither flag is equivalent to setting both, i\&.e\&. setting neither of these two flags means effectively both will be set\&. A similar logic applies to
217 \fBgrowfs\-off\fR/\fBgrowfs\-on\fR\&.
218 .PP
219 If partitions are not listed within an image policy string, the default policy flags are applied (configurable via an empty partition identifier, see above)\&. If no default policy flags are configured in the policy string, it is implied to be
220 "absent+unused", except for the Verity partition and their signature partitions where the policy is automatically derived from minimal protection level of the data partition they protect, as encoded in the policy\&.
221 .SH "SPECIAL POLICIES"
222 .PP
223 The special image policy string
224 "*"
225 is short for "use everything", i\&.e\&. is equivalent to:
226 .sp
227 .if n \{\
228 .RS 4
229 .\}
230 .nf
231 =verity+signed+encrypted+unprotected+unused+absent
232 .fi
233 .if n \{\
234 .RE
235 .\}
236 .PP
237 The special image policy string
238 "\-"
239 is short for "use nothing", i\&.e\&. is equivalent to:
240 .sp
241 .if n \{\
242 .RS 4
243 .\}
244 .nf
245 =unused+absent
246 .fi
247 .if n \{\
248 .RE
249 .\}
250 .PP
251 The special image policy string
252 "~"
253 is short for "everything must be absent", i\&.e\&. is equivalent to:
254 .sp
255 .if n \{\
256 .RS 4
257 .\}
258 .nf
259 =absent
260 .fi
261 .if n \{\
262 .RE
263 .\}
264 .SH "USE"
265 .PP
266 Most systemd components that support operating with disk images support a
267 \fB\-\-image\-policy=\fR
268 command line option to specify the image policy to use, and default to relatively open policies (typically the
269 "*"
270 policy, as described above), under the assumption that trust in disk images is established before the images are passed to the program in question\&.
271 .PP
272 For the host image itself
273 \fBsystemd-gpt-auto-generator\fR(8)
274 is responsible for processing the GPT partition table and making use of the included discoverable partitions\&. It accepts an image policy via the kernel command line option
275 \fBsystemd\&.image_policy=\fR\&.
276 .PP
277 Note that image policies do not dictate how the components will mount and use disk images \(em they only dictate which parts to avoid and which protection level and arrangement to require while mounting/using them\&. For example,
278 \fBsystemd-sysext\fR(8)
279 only cares for the
280 /usr/
281 and
282 /opt/
283 trees inside a disk image, and thus ignores any
284 /home/
285 partitions (and similar) in all cases, which might be included in the image, regardless whether the configured image policy would allow access to it or not\&. Similar,
286 \fBsystemd-nspawn\fR(1)
287 is not going to make use of any discovered swap device, regardless of whether the policy would allow that or not\&.
288 .PP
289 Use the
290 \fBimage\-policy\fR
291 command of the
292 \fBsystemd-analyze\fR(1)
293 tool to analyze image policy strings, and determine what a specific policy string means for a specific partition\&.
294 .SH "EXAMPLES"
295 .PP
296 The following image policy string dictates one read\-only Verity\-enabled
297 /usr/
298 partition must exist, plus encrypted root and swap partitions\&. All other partitions are ignored:
299 .sp
300 .if n \{\
301 .RS 4
302 .\}
303 .nf
304 usr=verity+read\-only\-on:root=encrypted:swap=encrypted
305 .fi
306 .if n \{\
307 .RE
308 .\}
309 .PP
310 The following image policy string dictates an encrypted, writable root file system, and optional
311 /srv/
312 file system that must be encrypted if it exists and no swap partition may exist:
313 .sp
314 .if n \{\
315 .RS 4
316 .\}
317 .nf
318 root=encrypted+read\-only\-off:srv=encrypted+absent:swap=absent
319 .fi
320 .if n \{\
321 .RE
322 .\}
323 .PP
324 The following image policy string dictates a single root partition that may be encrypted, but does not have to be, and ignores swap partitions, and uses all other partitions if they are available, possibly with encryption\&.
325 .sp
326 .if n \{\
327 .RS 4
328 .\}
329 .nf
330 root=unprotected+encrypted:swap=absent+unused:=unprotected+encrypted+absent
331 .fi
332 .if n \{\
333 .RE
334 .\}
335 .PP
336 The following image policy string dictates a single root partition that can only be erofs or squashfs, and ignores swap partitions, and uses all other partitions if they are available, possibly with encryption\&.
337 .sp
338 .if n \{\
339 .RS 4
340 .\}
341 .nf
342 root=erofs+squashfs:swap=absent+unused:=unprotected+encrypted+absent
343 .fi
344 .if n \{\
345 .RE
346 .\}
347 .SH "SEE ALSO"
348 .PP
349 \fBsystemd\fR(1), \fBsystemd-dissect\fR(1), \fBsystemd-gpt-auto-generator\fR(8), \fBsystemd-sysext\fR(8), \fBsystemd-analyze\fR(1)
350 .SH "NOTES"
351 .IP " 1." 4
352 UAPI.2 Discoverable Partitions Specification
353 .RS 4
354 \%https://uapi-group.org/specifications/specs/discoverable_partitions_specification
355 .RE