feat(nixos): open the initrd emergency shell with the root password

Assisted-by: DeepSeek Harness (claude-opus-5-5)
This commit is contained in:
Ryan Yin committed 2026-11-17 21:05:20 +08:00
1 parent f76889a158
commit 044e8c5a2a
3 files changed
+18 -1

No files matched your search

+6
View File
@@ -102,6 +102,12 @@ an advisory and affected kernel versions before adding CVE claims; search snippe
key enrollment and actual Secure Boot state with `sbctl status`; do not assume all hosts have it.
- Secure Boot, signed boot images, kernel lockdown and module signature enforcement are distinct
controls. Test custom kernels and NVIDIA/out-of-tree modules before extending enforcement.
- A failed initrd on the physical servers opens a root shell after the root password
(`boot.initrd.systemd.emergencyAccess`, the public hash in [vars](../vars/default.nix)). It adds
no protection on shoryu, shushou and youko: Secure Boot is off, the systemd-boot editor is on and
TPM2 unlocks LUKS on PCRs 0+7 alone, so console access already grants root through a kernel
command-line edit. aquamarine's Lanzaboote stub ignores command-line edits while Secure Boot is
on.
- AppArmor is enabled, but the only explicit policy, sudo's, is in complain mode. Complain mode logs
rather than blocks. Existing FHS-oriented abstractions need Nix store path review; this is not
broad enforced application confinement.
+3
View File
@@ -39,6 +39,9 @@ in
./idle-suspend.nix
];
# A failed initrd drops to a root shell behind the root password (docs/SECURITY.md).
boot.initrd.systemd.emergencyAccess = myvars.initialHashedPassword;
# Bind the board's NCT6798D SuperIO, otherwise fan RPM and board temperatures
# are missing.
boot.kernelModules = [ "nct6775" ];
+9 -1
View File
@@ -9,7 +9,12 @@ let
inherit (networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24";
in
{ config, lib, ... }:
{
config,
lib,
myvars,
...
}:
{
# CPU policy belongs to physical hosts; guests do not control hardware frequency.
imports = [
@@ -34,6 +39,9 @@ in
# Retries need no console: root LUKS unlocks through TPM2 alone (hosts/README.md).
boot.loader.systemd-boot.bootCounting.enable = true;
# A failed initrd drops to a root shell behind the root password (docs/SECURITY.md).
boot.initrd.systemd.emergencyAccess = myvars.initialHashedPassword;
# KVM for the microVMs and the libvirt domains. AMD-specific: an Intel VM host
# would need kvm-intel instead (see hosts/idols-ai/hardware-intel.nix).
boot.kernelModules = [ "kvm-amd" ];