[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

USB Stick, GPG and CryptoFS in a startup script



Hi to all Debian friends,

I am posting my problem to this list since I am sort
of clueless. I have the following problem:

I have a dedicated partition which I use with cryptoloop (yes, I know
dm-crypt is out there) and a AES cipher. Mounting and unmounting the 
partition works fine with all 2.6 Kernels.

Thus I enhanced my setup by placing the key for encryption and
decryption of the partition as a file on my USB Stick. I additionally
symmetrically encrypt the key file with gpg. I have put all of this in a
small shell script (see attachment). Using this script as root after the
login works flawlessly.

So, now we come to the point: 
When I integrate my script into /etc/init.d as one of the startup
scripts, I get the following error message during boot time
<snip>
cannot open '/dev/tty' : no such device or address 
Error: Password must be at least 20 characters
</snip>

I have already put some debug commands into my script to do 
a ls on the tty device. This looks like the following:
<snip>
ls -al /dev/tty
crw-rw-rw-    1 root     tty        5,   0 Apr 27 21:29 /dev/tty
ls -al /dev/tty0
crw-------    1 root     root       4,   0 Apr  9 10:34 /dev/tty0
</snip>
As far as I could figure out, the init script /etc/init.d/bootmisc.sh 
sets the permissions on the tty device. 

I am still a noobie to Kernel internals. Thus I am not sure where to
look for further clues.

Thanks for any tips or hints.

Have a nice day

Clemens Bier

#!/bin/sh -e

case "$1" in
        start)
        /sbin/modprobe sd_mod
        /sbin/modprobe usb-storage
        /sbin/modprobe cryptoloop
        /sbin/modprobe aes
        /bin/mount -t ext2 /dev/sda2 /mnt/iriver
        gpg --no-options --decrypt /mnt/key/key.gpg < /dev/console | /sbin/losetup -e AES128 /dev/loop0 /dev/hdb7 -p 0
        /bin/mount -o defaults,users /dev/loop0 /crypto
        /bin/umount /dev/sda
        ;;
        stop)
        /bin/umount /dev/loop0
        /sbin/losetup -d /dev/loop0
        ;;
esac

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: