mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-22 12:35:13 +00:00
external usb key unlock fully functional
This commit is contained in:
parent
f39b6e5cf7
commit
dad9a4b716
39
src/tomb
39
src/tomb
@ -1,4 +1,4 @@
|
||||
#!/bin/zsh
|
||||
#!/bin/bash
|
||||
#
|
||||
# Tomb
|
||||
#
|
||||
@ -73,14 +73,14 @@ ask_usbkey() {
|
||||
done
|
||||
|
||||
# get the first partition
|
||||
usbpart=`dmesg |tail -n 4 |awk '/ sd.:/ { print $3 }'`
|
||||
|
||||
usbpart=`dmesg |tail -n 8 | grep ' sd.:' |cut -d: -f2`
|
||||
usbpart=`expr substr $usbpart 1 4`
|
||||
echo
|
||||
echo -n "usb key attached, mounting "
|
||||
echo -n "usb key attached, mounting $usbpart "
|
||||
# what that it is mounted
|
||||
mounted=false
|
||||
while [ "$mounted" != "true" ]; do
|
||||
cat /proc/mounts | tail -n2 | grep -q "^/dev/$usbpart"
|
||||
cat /proc/mounts | tail -n 2 | grep -q $usbpart
|
||||
if [ $? = 0 ]; then mounted=true; fi
|
||||
echo -n "."
|
||||
sleep .5
|
||||
@ -315,13 +315,6 @@ mount_tomb() {
|
||||
exit 0
|
||||
fi
|
||||
|
||||
nstloop=`losetup -f`
|
||||
losetup -f ${FILE}
|
||||
|
||||
act "check for a valid LUKS encrypted device"
|
||||
cryptsetup isLuks ${nstloop}
|
||||
if [ $? = 0 ]; then # it's a LUKS encrypted nest, see cryptsetup(1)
|
||||
|
||||
# check if key file is present
|
||||
if ! [ -r "${enc_key}" ]; then
|
||||
error "encryption key ${enc_key} not found on disk"
|
||||
@ -329,12 +322,23 @@ mount_tomb() {
|
||||
error "or provide a usb key, or press ctrl-c to abort"
|
||||
ask_usbkey ".tomb/$enc_key"
|
||||
if ! [ -r "${enc_key}" ]; then
|
||||
losetup -d ${nstloop}
|
||||
sleep 5
|
||||
return
|
||||
error "key is missing."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
nstloop=`losetup -f`
|
||||
losetup -f ${FILE}
|
||||
|
||||
act "check for a valid LUKS encrypted device"
|
||||
cryptsetup isLuks ${nstloop}
|
||||
if [ $? != 0 ]; then
|
||||
# is it a LUKS encrypted nest? see cryptsetup(1)
|
||||
error "$FILE is not a valid Luks encrypted storage file"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
modprobe dm-crypt
|
||||
modprobe aes-i586
|
||||
|
||||
@ -381,11 +385,6 @@ mount_tomb() {
|
||||
|
||||
notice "encrypted storage $FILE succesfully mounted on $MOUNT"
|
||||
|
||||
else
|
||||
|
||||
error "$FILE is not a valid Luks encrypted storage file"
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
umount_tomb() {
|
||||
|
Loading…
Reference in New Issue
Block a user