loopy: A tool to manage the creation and mounting of encrypted loop device
filesystems on the Linux operating system.

Reading this document completely will make using loopy a lot easier, and
consequently will get those loop devices up and running faster. There are
a few things this script requires to run:

*) A recent kernel, with the international kernel patch applied. see
   http://www.kerneli.org/ for more information. 
*) Support for CONFIG_BLK_DEV_LOOP, CONFIG_BLK_DEV_LOOP_GEN, 
   CONFIG_BLK_DEV_LOOP_USE_REL_BLOCK, and all of your preferred ciphers
   from CONFIG_CIPHERS compiled in (modules are fine). 
*) A patched version of mount and losetup. a patch is distributed with the 
   international kernel, found in linux/Documentation/crypto/. 
*) Superuser access, for the creation of loopy profiles. A user can mount a
   loopy device profile, but the loop device used must be writable by the
   user, and an entry needs to be added to /etc/fstab. 
*) and a bunch of other normal unix tools... just look at the source, i don't
   think i've used anything else too non-standard.

To get started using loopy, run:
$ loopy create

The user will be prompted for an arbitrary name for the profile it is about to
create. Next, a list of loop devices will be displayed, and the should select
one. The caveat here is that the user can only choose a loop device which they
can write to. So, before getting started, root should chown or chmod
appropriately. This is a very in-elegant way of doing things, suggestions here
would be appreciated. The user is then presented with a list of ciphers, and
the selected one will be used to encrypt the new filesystem. This list is 
simply awk'd from the output of losetup, so there are a few things to keep in
mind. First, it wouldn't be very wise to pick the 'none' cipher, because it
will obviously not do much of anything. Second, some of the ciphers are broken
in the international kernel right now. Quoted from the losetup man page: 

RESTRICTIONS
       DES  encryption  is painfully slow. On the other hand, XOR
       is terribly weak. Both are insecure nowadays. Some ciphers
       require a license for you to be allowed to use them.

BUGS
       CAST, DES, RC5 and Twofish are currently broken and cannot
       be used.

It also seems that many of the other ciphers are currently broken. dfc, mars, 
and RC6 don't seem to be functioning properly with the latest kernel patches
and losetup. That leaves us with only Blowfish, IDEA, and Serpent. IDEA
and Blowfish are both strong and resistant to cryptanalysis. Serpent is a
newer algorithm, and is a candidate for AES, the Advanced Encryption
Standard. Unfortunately, it is also very new, and hasn't had enough time to
be thoughourly analyzed. Serpent is very fast, however, so if speed is
critical, it may be a good choice. The safest algorithm is probably IDEA. 

After selecting a cipher, the user can then choose a directory to create for
the filesystem to be mounted to, with the default being $HOME/crypt. The size,
in kilobytes, is then needed. Almost done now, we need a passphrase for this
filesystem. The user will only be prompted once for this, and there is no way
to change it after it is initially set. Finally, an entry is added to
/etc/fstab for this mount point. If an unprivileged user is creating this
profile, they will be asked for the root password in order to finish things up. 

Now, to mount the new filesystem, type:
$ loopy mount 

where  is the name of the profile the user has just created. Each 
user can create multiple profiles, and mount them the same way. The first 
profile that is created is set as the default, and can be mounted with just: 
$ loopy mount

Unmounting the device is just as simple. Type:
$ loopy umount  

As above, the profile name can be omitted to unmount the default profile. 
Obviously, loopy cannot unmount the selected profile if the filesystem is 
being used, or the user is currently working the mounted directory. 

I would advise browsing through the source, as well as the files found in
$HOME/.loopy, to get a good understanding of what is going on here. This 
little script is not for everyone, and there may well be big security holes
opened when using this script. I've attempted to not do anything too foolish,
but i am not a bash expert, nor security, nor encryption... so be forewarned.
That being said, if anyone actually uses this, i would _really_ appreciate 
feedback. Questions/comments/suggestions/bug reports can be sent to
ian at wehrman.com. 

ian wehrman, 
october 03, 1999.  

The loopy homepage is located at:

	http://www.wehrman.com/ian/loopy/