Harden QEMU input and credentials (#516 #519)

This commit is contained in:
Noah
2026-09-11 09:49:09 -06:00
parent bf39a74337
commit 7e0089826b
3 changed files with 123 additions and 10 deletions
+11
View File
@@ -10,6 +10,17 @@
exec </dev/console >/dev/console 2>&1
/bin/busybox --install -s /bin
# mkfs.ext4 -d preserves the checkout owner's uid. Production owns shadow as
# root, and the UI intentionally rejects any other owner before verifying it.
chown 0:0 /etc/shadow
chmod 0600 /etc/shadow
root_hash="$(awk -F: '$1 == "root" { print $2 }' /etc/shadow)"
test_hash="$(printf '%s' root | /usr/bin/mkpasswd -m md5 -S wardenrs 2>/dev/null)"
if [ -z "$root_hash" ] || [ "$test_hash" != "$root_hash" ]; then
echo "FATAL: QEMU root credential verifier is unavailable"
poweroff -f
fi
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t tmpfs tmpfs /tmp