Skip to content

Commit 652eff3

Browse files
authored
Merge pull request #1984 from tlaurion/permit_unsafe_usb_boot_of_unsigned_iso
Permit unsafe usb boot of unsigned ISO (Ventoy-like)
2 parents 728ea39 + 7f94015 commit 652eff3

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

initrd/bin/kexec-iso-init

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Boot from signed ISO
33
set -e -o pipefail
44
. /etc/functions
5+
. /etc/gui_functions
56
. /tmp/config
67

78
TRACE_FUNC
@@ -19,8 +20,32 @@ fi
1920

2021
ISO_PATH="${ISO_PATH##/}"
2122

22-
gpgv --homedir=/etc/distro/ "$ISOSIG" "$MOUNTED_ISO_PATH" \
23-
|| die 'ISO signature failed'
23+
if [ -r "$ISOSIG" ]; then
24+
# Signature found, verify it
25+
gpgv --homedir=/etc/distro/ "$ISOSIG" "$MOUNTED_ISO_PATH" \
26+
|| die 'ISO signature failed'
27+
echo '+++ ISO signature verified'
28+
else
29+
# No signature found, prompt user with warning
30+
echo '+++ WARNING: No signature found for ISO'
31+
if [ -x /bin/whiptail ]; then
32+
if ! whiptail_warning --title 'UNSIGNED ISO WARNING' --yesno \
33+
"WARNING: UNSIGNED ISO DETECTED\n\nThe selected ISO file:\n$MOUNTED_ISO_PATH\n\nDoes not have a detached signature (.sig or .asc file).\n\n\nThis means the integrity and authenticity of the ISO cannot be verified.\nBooting unsigned ISOs is potentially unsafe.\n\nDo you want to proceed with booting this unsigned ISO?" \
34+
0 80; then
35+
die "Unsigned ISO boot cancelled by user"
36+
fi
37+
else
38+
echo "WARNING: The selected ISO file does not have a detached signature"
39+
echo "This means the integrity and authenticity cannot be verified"
40+
echo "Booting unsigned ISOs is potentially unsafe"
41+
read -n1 -p "Do you want to proceed anyway? (y/N): " response
42+
echo
43+
if [ "$response" != "y" ] && [ "$response" != "Y" ]; then
44+
die "Unsigned ISO boot cancelled by user"
45+
fi
46+
fi
47+
echo '+++ Proceeding with unsigned ISO boot'
48+
fi
2449

2550
echo '+++ Mounting ISO and booting'
2651
mount -t iso9660 -o loop $MOUNTED_ISO_PATH /boot \

initrd/bin/media-scan

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ get_menu_option() {
7979
fi
8080
}
8181

82-
# create ISO menu options
83-
ls -1r /media/*.iso 2>/dev/null > /tmp/iso_menu.txt || true
82+
# create ISO menu options - search recursively for ISO files
83+
find /media -name "*.iso" -type f 2>/dev/null | sort -r > /tmp/iso_menu.txt || true
8484
if [ `cat /tmp/iso_menu.txt | wc -l` -gt 0 ]; then
8585
option_confirm=""
8686
while [ -z "$option" -a "$option_index" != "s" ]

0 commit comments

Comments
 (0)