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
|
# Tomb
|
||||||
#
|
#
|
||||||
@ -73,14 +73,14 @@ ask_usbkey() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# get the first partition
|
# 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
|
||||||
echo -n "usb key attached, mounting "
|
echo -n "usb key attached, mounting $usbpart "
|
||||||
# what that it is mounted
|
# what that it is mounted
|
||||||
mounted=false
|
mounted=false
|
||||||
while [ "$mounted" != "true" ]; do
|
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
|
if [ $? = 0 ]; then mounted=true; fi
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep .5
|
sleep .5
|
||||||
@ -315,13 +315,6 @@ mount_tomb() {
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
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
|
# check if key file is present
|
||||||
if ! [ -r "${enc_key}" ]; then
|
if ! [ -r "${enc_key}" ]; then
|
||||||
error "encryption key ${enc_key} not found on disk"
|
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"
|
error "or provide a usb key, or press ctrl-c to abort"
|
||||||
ask_usbkey ".tomb/$enc_key"
|
ask_usbkey ".tomb/$enc_key"
|
||||||
if ! [ -r "${enc_key}" ]; then
|
if ! [ -r "${enc_key}" ]; then
|
||||||
losetup -d ${nstloop}
|
error "key is missing."
|
||||||
sleep 5
|
exit 0
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
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 dm-crypt
|
||||||
modprobe aes-i586
|
modprobe aes-i586
|
||||||
|
|
||||||
@ -381,11 +385,6 @@ mount_tomb() {
|
|||||||
|
|
||||||
notice "encrypted storage $FILE succesfully mounted on $MOUNT"
|
notice "encrypted storage $FILE succesfully mounted on $MOUNT"
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
error "$FILE is not a valid Luks encrypted storage file"
|
|
||||||
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
umount_tomb() {
|
umount_tomb() {
|
||||||
|
Loading…
Reference in New Issue
Block a user