diff --git a/installer-rs/crates/phoebus-core/src/config.rs b/installer-rs/crates/phoebus-core/src/config.rs index a0b9a00..4bcee57 100644 --- a/installer-rs/crates/phoebus-core/src/config.rs +++ b/installer-rs/crates/phoebus-core/src/config.rs @@ -795,4 +795,20 @@ STAGE3_SHA256='abc'\n"; let text = "[storage]\nfilesystem = \"zfs\"\n"; assert!(InstallConfig::from_toml(text).is_err()); } + + #[test] + fn boot_security_keys_parse_so_validation_can_reject_them() { + // The keys stay parseable (legacy + TOML) so a request is rejected + // with a named field error, never silently ignored. + let legacy = InstallConfig::from_legacy("KERNEL_UKI='yes'\nSECUREBOOT='yes'\n").unwrap(); + assert!(legacy.kernel.uki); + assert!(legacy.kernel.secureboot); + let toml = InstallConfig::from_toml("[kernel]\nuki = true\nsecureboot = true\n").unwrap(); + assert!(toml.kernel.uki); + assert!(toml.kernel.secureboot); + // Defaults stay plain BLS. + let defaults = InstallConfig::default(); + assert!(!defaults.kernel.uki); + assert!(!defaults.kernel.secureboot); + } } diff --git a/installer-rs/crates/phoebus-core/src/plan.rs b/installer-rs/crates/phoebus-core/src/plan.rs index ddb7bc6..3e7e469 100644 --- a/installer-rs/crates/phoebus-core/src/plan.rs +++ b/installer-rs/crates/phoebus-core/src/plan.rs @@ -142,10 +142,10 @@ impl InstallPlan { " Bootloader : {} (BLS entries)\n", "systemd-boot" )); - o.push_str(&format!( - " Unified UKI : {} (deferred; BLS used)\n", - if config.kernel.uki { "yes" } else { "no" } - )); + // Authenticated boot is not implemented. Report the actual BLS boot + // path unconditionally: never render the requested flags as active. + o.push_str(" Unified UKI : not implemented (BLS entries used)\n"); + o.push_str(" Secure Boot : not implemented (boot chain unsigned)\n"); let profile = match config.kernel.profile { KernelProfile::Safe => "safe", KernelProfile::Optimized => "optimized", @@ -300,4 +300,23 @@ mod tests { let boot = names.iter().position(|n| *n == "boot_install").unwrap(); assert!(kernel < nvidia && nvidia < boot); } + + #[test] + fn boot_preview_reports_plain_bls_and_never_an_active_uki() { + let cfg = InstallConfig::default(); + let text = InstallPlan::for_config(&cfg).render_human(&cfg, None); + assert!(text.contains("systemd-boot (BLS entries)")); + assert!(text.contains("Unified UKI : not implemented (BLS entries used)")); + assert!(text.contains("Secure Boot : not implemented (boot chain unsigned)")); + // Even a config that requests UKI/Secure Boot must not render them + // as active (validation rejects such configs; the preview is the + // backstop). + let mut requested = InstallConfig::default(); + requested.kernel.uki = true; + requested.kernel.secureboot = true; + let text = InstallPlan::for_config(&requested).render_human(&requested, None); + assert!(!text.contains("Unified UKI : yes"), "{text}"); + assert!(!text.contains("Secure Boot : enabled"), "{text}"); + assert!(text.contains("not implemented"), "{text}"); + } } diff --git a/installer-rs/crates/phoebus-core/src/validate.rs b/installer-rs/crates/phoebus-core/src/validate.rs index d9a0d80..66207ac 100644 --- a/installer-rs/crates/phoebus-core/src/validate.rs +++ b/installer-rs/crates/phoebus-core/src/validate.rs @@ -226,6 +226,23 @@ pub fn validate_config(config: &InstallConfig) -> Vec { "keep at least 2 kernels so a known-good kernel is available", )); } + // Authenticated boot is not implemented: the installed boot path is + // plain BLS (systemd-boot + dracut, no signing, no UKI). Accepting these + // flags would imply a security property the system does not provide, so + // they are rejected here — before the CLI, TUI, GUI, or plan preview can + // present them as active. See the "UKI" row in docs/STATUS.md. + if config.kernel.uki { + issues.push(ValidationIssue::new( + "uki", + "Unified Kernel Images are not implemented; the installer uses plain BLS entries (uki must be false)", + )); + } + if config.kernel.secureboot { + issues.push(ValidationIssue::new( + "secureboot", + "UEFI Secure Boot is not implemented; the boot chain is unsigned (secureboot must be false)", + )); + } if config.packages.accept_license.trim().is_empty() { issues.push(ValidationIssue::new( "accept_license", @@ -332,4 +349,37 @@ mod tests { .iter() .all(|i| i.field != "target_disk")); } + + #[test] + fn unimplemented_boot_security_flags_are_rejected() { + // Parsing still accepts the legacy keys so the error names the field; + // validation rejects them because the boot path is plain unsigned BLS. + let mut cfg = InstallConfig::default(); + cfg.system.hostname = "phoebus".into(); + cfg.system.timezone = "UTC".into(); + cfg.user.username = "alice".into(); + cfg.storage.disk = "/dev/vda".into(); + assert!(validate_config(&cfg).iter().all(|i| i.field != "uki")); + assert!(validate_config(&cfg) + .iter() + .all(|i| i.field != "secureboot")); + + cfg.kernel.uki = true; + let issues = validate_config(&cfg); + let uki = issues + .iter() + .find(|i| i.field == "uki") + .expect("uki rejected"); + assert!(uki.message.contains("not implemented"), "{uki}"); + + cfg.kernel.uki = false; + cfg.kernel.secureboot = true; + let issues = validate_config(&cfg); + let sb = issues + .iter() + .find(|i| i.field == "secureboot") + .expect("secureboot rejected"); + assert!(sb.message.contains("not implemented"), "{sb}"); + assert!(sb.message.contains("unsigned"), "{sb}"); + } } diff --git a/installer-rs/crates/phoebus-installer/tests/golden/plan.txt b/installer-rs/crates/phoebus-installer/tests/golden/plan.txt index 5a51e89..e293388 100644 --- a/installer-rs/crates/phoebus-installer/tests/golden/plan.txt +++ b/installer-rs/crates/phoebus-installer/tests/golden/plan.txt @@ -32,7 +32,8 @@ Storage: Boot and kernel: Bootloader : systemd-boot (BLS entries) - Unified UKI : no (deferred; BLS used) + Unified UKI : not implemented (BLS entries used) + Secure Boot : not implemented (boot chain unsigned) Kernel : sys-kernel/gentoo-kernel-bin (safe profile) Keep kernels : 3 diff --git a/installer/tests/vm/appliance-test.conf.example b/installer/tests/vm/appliance-test.conf.example index 6750a90..8c5d141 100644 --- a/installer/tests/vm/appliance-test.conf.example +++ b/installer/tests/vm/appliance-test.conf.example @@ -25,6 +25,9 @@ KERNEL_PROFILE='safe' KERNEL_UKI='no' KERNEL_CONSOLE='console=tty0 console=ttyS0,115200' KEEP_KERNELS='3' +# Authenticated boot is not implemented: KERNEL_UKI and SECUREBOOT must stay +# 'no'. The installer rejects 'yes' rather than implying an unsigned BLS +# boot chain is signed. PACKAGE_POLICY='balanced' FEATURES_BINPKG='yes' @@ -37,4 +40,7 @@ FLATPAK='yes' NIX_ENABLED='no' STAGE3_URL='http://10.0.2.2:8000/stage3.tar.xz' +# Paste the real digest of the served file here (`sha256sum stage3.tar.xz` +# on the host). A placeholder or malformed pin refuses to install; empty +# means "verify against Gentoo's signed DIGESTS with gpg". STAGE3_SHA256='0000000000000000000000000000000000000000000000000000000000000000' diff --git a/installer/tests/vm/test.conf.example b/installer/tests/vm/test.conf.example index b4c40b7..6768492 100644 --- a/installer/tests/vm/test.conf.example +++ b/installer/tests/vm/test.conf.example @@ -23,6 +23,9 @@ KERNEL_PROFILE='safe' KERNEL_UKI='no' KERNEL_CONSOLE='console=tty0 console=ttyS0,115200' KEEP_KERNELS='3' +# Authenticated boot is not implemented: KERNEL_UKI and SECUREBOOT must stay +# 'no'. The installer rejects 'yes' rather than implying an unsigned BLS +# boot chain is signed. PACKAGE_POLICY='balanced' FEATURES_BINPKG='yes' @@ -33,6 +36,10 @@ DESKTOP_PROFILE='mango' FLATPAK='yes' # Pinned stage3 served from the host HTTP server so the SHA-256 is verified -# without a second download. Replace with a real Gentoo URL for other setups. +# without re-downloading from the internet. Replace with a real Gentoo URL for other setups. +# STAGE3_SHA256 must be the real 64-digit hex digest of the served file +# (run `sha256sum stage3.tar.xz` on the host and paste it here): empty means +# "verify against Gentoo's signed DIGESTS with gpg" (needs the release key in +# the live image), while a placeholder or malformed pin refuses to install. STAGE3_URL='http://10.0.2.2:8000/stage3.tar.xz' STAGE3_SHA256='0000000000000000000000000000000000000000000000000000000000000000'