Locked root and rescue mode
Fedora is among the group of Linux distributions that, by default, lock out the root account such that it does not have a password and cannot be logged into. But, traditionally, "rescue mode" boots the system into single-user mode, which requires a root password—difficult to provide if it does not exist. A Fedora proposal to remove the need for the password in that case, and just drop into a root shell, does not seem likely to go far in that form, but it would seem to have pointed toward some better solutions for the underlying problem.
The proposal
for Fedora 36, "Make Rescue Mode Work With Locked Root
",
was posted on December 6 by Fedora program manager Ben Cotton on
behalf of the feature owners: Michel Alexandre Salim, Neal Gompa, and David
Duncan.
The problem is that the "out-of-the-box user
experience
" is poor for systems with a locked root if users have a
need to fix their systems via
single-user mode; they will be prompted for a password that they cannot
provide and have to resort to other means of booting their ailing system
(e.g. rescue boot media). Another option is to boot with a kernel
command-line option such as "init=/sysroot/bin/bash", but that is
not particularly user-friendly either.
The guts of the change would use the --force option to sulogin
to skip the password requirement when entering single-user mode if the root
password is not accessible or the root login is disabled. But, as that man
page warns, the option should only be used "if you are sure the console is
physically protected against unauthorized access
". The proposal
says that the change "does not pose an increased security
risk
", because attackers already have other means of bypassing the
password (e.g. init=) or compromising the system if they have
physical access. Those who want to enforce a password for single-user mode
can simply set the root password.
The implementation would be based on a similar feature (patch) in Fedora CoreOS. By default, Fedora 36 would install an RPM that changes the systemd configuration to bypass the password. Users or Fedora variants that do not want that behavior can remove or not install that RPM.
As might be guessed, the claim that there is no increased risk drew comments. Zbigniew Jędrzejewski-Szmek said that there are at least two cases where having physical access does not necessarily lead to the ability to compromise the system:
If the data is encrypted, then being able to override the init doesn't achieve anything, until the decryption has been performed. The second case is when the admin has actually locked down the kernel command line and relies on the normal authentication mechanisms to protect the system. In both cases your proposal creates an additional method of attack that activates at a later point where the system is already running and the integrity of the system must be maintained to protect unencrypted data. With the proposal, any mechanism which leads to the system entering emergency mode results in a compromise.
The problem being addressed does exist, he said, but the solution is not a good one:
Essentially, you are proposing a behaviour of "something is wrong, let's make everything open without authentication", which is good for debugging and development, but not acceptable for a real system.The correct solution is to enhance login mechanisms so that it is possible to authenticate using existing credentials also in the rescue mode. The fact that this is not possible right now is a bug that needs to be fixed.
He had some suggestions for ways forward, including potentially adding a password hash (using the stronger yescrypt hashing algorithm) to the initial ramdisk (initrd) or elsewhere that is accessible at boot time (e.g. EFI variables). In addition, the Trusted Platform Module (TPM) could be used to encrypt the password in a system-specific fashion.
Richard W.M. Jones wondered
about the threat model and how skipping the password would actually cause
problems; "On the flip side I have hit the problem described and it's incredibly
annoying - it makes rescue mode useless in the default case.
"
Jędrzejewski-Szmek acknowledged
that the problem is "annoying and real
", but noted that the
proposal violates some fundamental properties that govern system access:
There are many many different ways in which systems are installed, but the general principle is that [once] the system is up, you need valid credentials to log in. So protecting the system before it's running, i.e. protecting the data at rest, can be done in many different ways and is your responsibility, after it is up, you know that the normal system mechanisms apply. With the proposal this promise is broken.
One example he gave was for a kiosk-installed system, where users have
access to the keyboard; "if you can affect the system so that
it does not boot properly, even by causing a sufficient delay, [it] is
enough to get unrestricted access.
"
Vit Ondruch asked about any existing work toward the solution proposed. Jędrzejewski-Szmek said that recent versions of systemd have support for the low-level plumbing (i.e. encrypted-secret storing), but the higher-level pieces are still missing:
But we're missing the upper parts, i.e. how to actually use and update the passwords. I didn't even mention this, because we don't have a comprehensive story yet. I think it'd be necessary to write some pam module and/or authentication helper from scratch.
The "wheel" group on Fedora (and other Unix systems) is meant to contain administrative users, so it would make sense to accept any password for users in that group as equivalent to that of root, Lennart Poettering said. He agreed that there is still work to do to collect up those passwords, encrypt them with the TPM, and store them where they are accessible at boot time, but the net effect would be useful well beyond just booting into single-user mode:
With such a mechanism we would have quite nice semantics: if a user is designated to have admin privs, then that's sufficient to be able to log into the root account, no further manual work necessary, and it applies to the whole runtime of the OS: from initrd to regular system, to sudo.
Chris Murphy was concerned
about tying the solution to the existence of a TPM, since there are systems
that do not have the device or it is not supported by the kernel.
Poettering said that using
the TPM by default makes sense even if there is a need to "find
graceful fallbacks for environments that are more limited
".
But Chris Adams was in favor of
the original proposal;
administrators who want to further lock down their systems can simply do so
by removing the RPM or setting a root password. "Locking down a system beyond the
default requires changing a bunch of things, so I do not see adding this
to that list to be a problem.
" Jędrzejewski-Szmek said that was
a step backward:
I also don't think we should assume that the admin will do a series of "hardening steps". This is what we had in the 90's: you'd install a stock distro and then go over a checklist of basic steps to make things secure. Let's not go back to that.
Murphy also wondered
about the Fedora CoreOS change. If the idea of skipping password checking
is terrible: "Is it terrible enough that CoreOS should
revert?
" Jędrzejewski-Szmek said that it
makes the CoreOS image unsuitable for general-purpose use; "Maybe
it's OK in limited circumstances where 'physical' access is
only possible if you're the administrator on the host.
"
While the feature owners did not participate much in the discussion, Salim was obviously keeping track of the feedback. He said that he was inclined to not rush a full solution for Fedora 36 and to push that back until Fedora 37. He noted that the question of what CoreOS should do is a good one. Beyond that, the questions of using the wheel group to delimit which passwords are valid and whether or not to add TPM dependencies for the feature need to be resolved.
He also wondered about some kind of recovery password, which had been raised in the thread as means to work with disks that need to be installed in another system (with a different TPM). That problem was seen to be a separate issue. In addition, Björn Persson thought that a recovery password was more appropriate for scenarios where a different authentication mechanism (e.g. hardware token) is used—and could get lost or broken:
As long as users normally log in with a passphrase, I see no need to have a separate passphrase for rescue mode. Root's or a wheel user's usual passphrase should be fine.
To address the immediate needs for Fedora 36, Salim suggested just
removing rescue mode as a boot option if no root password is set. In
addition, if someone tries to invoked rescue mode from the command line in that scenario,
"it should display an error rather
than prompting for a non-existent password
". Persson thought that
all sounded reasonable. The Fedora Engineering Steering Committee was slated to discuss the
proposal at its December 20 meeting,
but that was canceled due to a lack of quorum; it will presumably be
rescheduled for the next meeting on January 3.
Overall, the idea of using wheel group passwords seemed to gain a fair amount of traction, as did not opening up new ways to get root without any authentication. Our systems are complex enough, and installed in so many different ways and environments, that doing so was always going to raise some eyebrows. On the other hand, though, prompting for a password that cannot be provided is a sure path to user frustration—at a time when said user is probably already worried about the functioning of their system and does not need further headaches. The path to a better solution for that problem seems fairly clear; with luck we will see it in Fedora 37, coming in late 2022.
| Index entries for this article | |
|---|---|
| Security | Distribution security |
