]> git.ipfire.org Git - thirdparty/systemd.git/commit
pid1: add ProtectSystem= as system-wide configuration, and default it to true in...
authorLennart Poettering <lennart@poettering.net>
Wed, 29 Nov 2023 17:52:28 +0000 (18:52 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 6 Dec 2023 21:10:20 +0000 (22:10 +0100)
commitffc1ec73b3a271d8ed59b3aef18cc5b42ec76579
treec169047464b298328fc499e8a56421bbd3049c55
parent8e3dc737b27d838050d3d78b8b9aaa5c6abbe4e4
pid1: add ProtectSystem= as system-wide configuration, and default it to true in the initrd

This adds a new ProtectSystem= setting that mirrors the option of the
same of services, but in a more restrictive way. If enabled will remount
/usr/ to read-only, very early at boot. Takes a special value "auto"
(which is the default) which is equivalent to true in the initrd, and
false otherwise.

Unlike the per-service option we don't support full/strict modes, but
the door is open to eventually support that too if it makes sense. It's
not entirely trivial though as we have very little mounted this early,
and hence the mechanism might not apply 1:1. Hence in this PR is a
conservative first step.

My primary goal with this is to lock down initrds a bit, since they
conceptually are mostly immutable, but they are unpacked into a mutable
tmpfs. let's tighten the screws a bit on that, and at least make /usr/
immutable.

This is particularly nice on USIs (i.e. Unified System Images, that pack
a whole OS into a UKI without transitioning out of it), such as
diskomator.
man/systemd-system.conf.xml
src/core/main.c
src/core/system.conf.in