Comment 3 for bug 563

Revision history for this message
hunger (hunger) wrote : /etc/init.d/cryptdisks

I mailed this version to pitti a while back. He said he'd look into getting this into dapper if he can approve of my changes.

The version you see here is different from what I described in my earlier report. Here is a description of the features:

* leaves "swap" option for compatibility reasons.

* adds "pre_setup" option: The script is run before the volume is setup. Useful to create files for loopback mounting, etc.

* adds "post_setup" option: Run after the volume is set up. Useful for mk*fs (i.e. randomly encrypted /tmp) or mkswap.

* adds "pre_teardown" option: Run before tearing down a device. For the extra paranoid: Blank the disk before throwing away the key, etc.

* adds "post_teardown" option: Run after teardown: Remove the files created in pre_setup;-)

* adds "force_down" option: Bring down the device no matter what!

* Handles LUKS volumes, files (via loopback).

* adds "status" action to the start/stop script.

All pre-/post programs are called with the dm device as first and the source as secound parameter.

Example usage:
# Unlock keyfile ("none" password forces interactive)
hdd_keys /etc/hdd_keys.loop none post_setup=/lib/cryptdisks/scripts/mount

# use keyfile: (no options)
swap /dev/sda2 /.hdd_keys/swap.key

# Lock keyfile again:
hdd_keys /etc/hdd_keys.loop none pre_setup=/lib/cryptdisks/scripts/umount,force_down

# Setup disks using random keys:
tmp /dev/mapper/lv-tmp_c /dev/urandom post_setup=/lib/cryptdisks/scripts/mkreiserfs

# Create a loopback file for storage of temporary data:
loop /tmp/file none pre_setup=/lib/cryptdisks/scripts/create,post_setup=/lib/cryptdisks/scripts/mkreiserfs,post_teardown=/lib/cryptdisks/scripts/rm_src