cryptenroll: default to block device backing /var/ rather than /
authorLennart Poettering <lennart@poettering.net>
Tue, 23 Apr 2024 10:35:38 +0000 (12:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 Apr 2024 13:23:44 +0000 (15:23 +0200)
commit8518f4a814426e7a92342298353a4cd9508cb33b
tree8bf573756196fa476eeb4a0ead9fe92b0c8b7fe8
parent1df4b21abdb9e562805a7b006d179507182f845e
cryptenroll: default to block device backing /var/ rather than /

With 1df4b21abdb9e562805a7b006d179507182f845e we started to default to
enrolling into the LUKS device backing the root fs if none was specified
(and no wipe operation is used). This changes to look for /var/ instead.

On most systems /var/ is going to be on the root fs, hence this change
is with little effect.

However, on systems where / and /var/ is separate it makes more sense to
default to /var/ because that's where the persistent and variable data
is placed (i.e.  where LUKS should be used) while / doesn't really have
to be variable, could as well be immutable, or ephemeral. Hence /var/
should be a safer default.

Or to say this differently: I think it makes sense to support systems
with /var/ being on / well. I also think it makes sense to support
systems with them being separate, and /var/ being variable and
persistent. But any other kind of system I find much less interesting to
support, and in that case people should just specify the device name.

Also, while we are at it, tighten the checks a bit, insist on a dm-crypt
+ LUKS superblock before continuing.

And finally, let's print a short message indicating the device we
operate on.
man/systemd-cryptenroll.xml
src/cryptenroll/cryptenroll.c