@Sebastian-Roth clever hack! there was one more hurdle: blockdev --rereadpt
in the runPartprobe function fails due to ioctl error on BLKRRPART: Device or resource busy
because cryptsetup luksOpen
appears to be locking the device. Luckily partprobe
works fine, so I just replaced that part of the script. Here’s my final commands (the last line just shows that the line has been replaced successfully). After running fog
, the decrypted partition/disk is successfully captured (with /dev/md126
as “Host Primary Disk”). 1 GB instead of 800 GB!
H
Best posts made by humoss233
-
RE: Error decrypting LUKS partition prior to capture/imaging
-
RE: Error decrypting LUKS partition prior to capture/imaging
@Sebastian-Roth thanks! changing the line endings fixed the error and the difference in paths doesn’t seem to be an issue
I had to repad the base64 string as trailing ='s can’t be passed in the kernel parameter (they are ignored). Here’s the final result:
#!/bin/bash # REF: https://gist.github.com/catwell/3046205 function repad { _l=$((${#1} % 4)) if [ $_l -eq 2 ]; then _s="$1"'==' elif [ $_l -eq 3 ]; then _s="$1"'=' else _s="$1" ; fi echo -n $_s } pass_dec=`echo -n $(repad $pass) | base64 -d | openssl enc -d -aes-128-ecb -K 691CACE3402341778F3DBCFD74859E0C -nosalt` for i in {/dev/sd*,/dev/nvme*,/dev/md*}; do echo -n $pass_dec | cryptsetup luksOpen $i $(basename $i)_crypt -d - 2> /dev/null if [ -e /dev/mapper/$(basename $i)_crypt ]; then rm $i ln -s /dev/mapper/$(basename $i)_crypt $i echo Decrypted $i fi done sed -i 's/blockdev --rereadpt/partprobe/g' /usr/share/fog/lib/funcs.sh
Generate the encrypted pass using
echo -n 'MY_LUKS_PASSWORD' | openssl enc -base64 -aes-128-ecb -K 691CACE3402341778F3DBCFD74859E0C -nosalt
and pass the result into apass
kernel parameterThanks again @george1421 and @Sebastian-Roth for all your help in making this work