Second review pass: strip account fields, clear stale cidata inputs, await OEM finalization
Codex xhigh round 2: - Strip account authentication fields (!users, !root-password, root_enc_password, auth_config account entries) from the archinstall config in OEM mode, not just user_credentials — a combined/legacy config could otherwise have archinstall create a provisioning account before OOBE. - Clear stale OEM inputs (oem marker, credentials, optional files) from /root before copying a cidata drive, so a retried install in the same live session can't force a fresh drive back into OEM mode or reuse an old LUKS passphrase. - The test harness waits for the OEM pending flag to clear before saving the base image, so it never snapshots a half-finalized first boot; it also handles the deliberately skipped mode picker on blank disks built against a pre-OEM runtime. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e49ea2bc96
commit
8aee09cb29
5 files changed
+90
-2
No files matched your search
@@ -38,10 +38,20 @@ done
|
||||
mkdir -p "$mnt"
|
||||
mount -o ro "$device" "$mnt" || exit 1
|
||||
|
||||
# Clear any inputs a previous load in this live session left in /root before
|
||||
# copying the current drive: a stale `oem` marker or credentials file would
|
||||
# otherwise force a fresh drive's config back into OEM mode or hand it an old
|
||||
# LUKS passphrase. The interactive wizard writes these same names, but a
|
||||
# cidata load always precedes it, so nothing of the user's is discarded here.
|
||||
optional_inputs=(user_credentials.json oem user_full_name.txt user_email_address.txt user_encrypt_installation.txt authorized_keys tailscale_authkey)
|
||||
for file in user_configuration.json "${optional_inputs[@]}"; do
|
||||
rm -f "$dest/$file"
|
||||
done
|
||||
|
||||
loaded=1
|
||||
if [[ -f $mnt/user_configuration.json ]] && [[ -f $mnt/user_credentials.json || -f $mnt/oem ]]; then
|
||||
files=("$mnt"/user_configuration.json)
|
||||
for file in user_credentials.json oem user_full_name.txt user_email_address.txt user_encrypt_installation.txt authorized_keys tailscale_authkey; do
|
||||
for file in "${optional_inputs[@]}"; do
|
||||
[[ -f $mnt/$file ]] && files+=("$mnt/$file")
|
||||
done
|
||||
if cp "${files[@]}" "$dest"/; then
|
||||
|
||||
@@ -76,6 +76,14 @@ class InstallContext:
|
||||
|
||||
arch_configuration = dict(user_configuration)
|
||||
arch_configuration.pop("omarchy_install", None)
|
||||
|
||||
if oem:
|
||||
# The userless invariant covers the archinstall config too: a
|
||||
# combined/legacy config could carry account authentication that
|
||||
# archinstall would still act on (users, a root password). Strip
|
||||
# every such field so no account is created before first boot.
|
||||
_strip_account_fields(arch_configuration)
|
||||
|
||||
state_dir = Path(os.environ.get("OMARCHY_INSTALL_STATE_DIR", "/run/omarchy-install"))
|
||||
state_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -135,6 +143,20 @@ class InstallContext:
|
||||
return self.mode == "protected"
|
||||
|
||||
|
||||
def _strip_account_fields(arch_configuration: dict) -> None:
|
||||
"""Remove every field archinstall reads to create users or set a root
|
||||
password, so an OEM install cannot ship a hidden provisioning account.
|
||||
Encryption material lives elsewhere (disk_config.disk_encryption) and is
|
||||
untouched."""
|
||||
for key in ("!users", "!root-password", "root_enc_password", "users"):
|
||||
arch_configuration.pop(key, None)
|
||||
|
||||
auth = arch_configuration.get("auth_config")
|
||||
if isinstance(auth, dict):
|
||||
for key in ("users", "root_enc_password"):
|
||||
auth.pop(key, None)
|
||||
|
||||
|
||||
def _inject_oem_encryption_password(arch_configuration: dict, user_credentials: dict) -> None:
|
||||
"""Ensure an encrypted OEM install has a LUKS passphrase archinstall can
|
||||
use. Reuse one the input already carries (an autoinstall rig may supply
|
||||
|
||||
Reference in new issue
Block a user