]> git.ipfire.org Git - thirdparty/systemd.git/commit
firstboot: Tighten up passwd/shadow handling
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 21 Jul 2020 21:30:16 +0000 (22:30 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 22 Jul 2020 20:22:41 +0000 (21:22 +0100)
commitc4a53ebf7a51674a14f2273bb6fac382ca75f9eb
treec0ce644a485cd87b6d4983587c1178f1b2ff0853
parenteced0d2a46774a40021fd8e5d624461bc107a46e
firstboot: Tighten up passwd/shadow handling

There are a lot of edge cases that the current implementation
doesn't handle, especially in cases where one of passwd/shadow
exists and the other doesn't exist. For example, if
--root-password is specified, we will write /etc/shadow but
won't add a root entry to /etc/passwd if there is none.

To fix some of these issues, we constrain systemd-firstboot to
only modify /etc/passwd and /etc/shadow if both do not exist
already (or --force) is specified. On top of that, we calculate
all necessary information for both passwd and shadow upfront so
we can take it all into account when writing the actual files.

If no root password options are given --force is specified or both
files do not exist, we lock the root account for security purposes.
man/systemd-firstboot.xml
src/firstboot/firstboot.c