[pkg-cryptsetup-devel] Bug#864647: Patch
Ole Tange
ole at tange.dk
Mon Jun 12 13:44:01 UTC 2017
--- /usr/share/initramfs-tools/scripts/local-top/cryptroot
2015-01-22 22:03:47.000000000 +0100
+++ /root/cryptroot.new 2017-06-12 13:14:13.031995434 +0200
@@ -277,7 +277,20 @@
export CRYPTTAB_TRIED="$count"
count=$(( $count + 1 ))
+ /bin/sleep 3
+
if [ -z "$cryptkeyscript" ]; then
+ # Test all devices
+ mkdir /mnt
+ echo -n "Searching for cryptkey.txt on
available disks... "
+ for PART in `cat /proc/partitions |awk '{print
$4}'|tail -n +3`; do
+ if mount /dev/$PART /mnt 2>/dev/null; then
+ cat /mnt/cryptkey.txt >>
/tmp/cryptkeys.txt 2>/dev/null
+ umount /dev/$PART
+ fi
+ done
+ echo "done."
+
if [ ${cryptsource#/dev/disk/by-uuid/} !=
$cryptsource ]; then
# UUIDs are not very helpful
diskname="$crypttarget"
@@ -297,10 +310,29 @@
if [ ! -e "$NEWROOT" ]; then
- if ! crypttarget="$crypttarget"
cryptsource="$cryptsource" \
- $cryptkeyscript "$cryptkey" | $cryptopen; then
+ keyfound=0
+ if [ -e /tmp/cryptkeys.txt ] ; then
+ echo Trying keys from cryptkey.txt
+ for key in `cat /tmp/cryptkeys.txt`; do
+ if crypttarget="$crypttarget"
cryptsource="$cryptsource" \
+ echo -n "$key" | $cryptopen; then
+ # Found the key
+ echo Key found in cryptkey.txt
+ keyfound=1
+ key=""
+ fi
+ done
+ # Remove traces of the key
+ rm /tmp/cryptkeys.txt
+ unset key
+ fi
+ if [ "$keyfound" = "0" ]; then
+ # Fall back to manual entry
+ if ! crypttarget="$crypttarget"
cryptsource="$cryptsource" \
+ $cryptkeyscript "$cryptkey" | $cryptopen; then
message "cryptsetup: cryptsetup failed,
bad password or options?"
continue
+ fi
fi
fi
More information about the pkg-cryptsetup-devel
mailing list