Skip to content

Commit 7f94015

Browse files
committed
initrd/bin/kexec-iso-init: permit user to boot unsigned iso after he acknowledges the big fat warning
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent fcffb0d commit 7f94015

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

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 \

0 commit comments

Comments
 (0)