Matthew Johnson: Passwordless Encrypted Root in Debian
If, like me, you wanted both an encrypted root filesystem and
some form of bootsplash you may have discovered that this is tricky.
You need to enter the decryption passphrase on the terminal which
means exiting the bootsplash.
I decided it must be possible to use a USB token with the key on it
rather than a passphrase to decrypt the drive and while this
seems supported upstream, it is not supported out of the box on Debian.
This is a short howto explaining my solution.
Pre-requisites
You will need a USB hard disk and a computer using Debian with an
encrypted root filesystem. I am assuming that you are using a stock
kernel with an initramfs image and have a luks encrypted LVM containing
the root filesystem. You will have to change some of the details below
to match your specific system.
In the examples below
/dev/hda5
is the encrypted partition
and
/dev/sda2
is the partition on the USB disk holding the key.
Setting up the key
First we need to generate a random key and put it on the disk. To save
having to mount things in the initramfs, I chose to use a partition at
the end of the USB flash disk. This means repartitioning and reformatting
your USB disk. I recommend allocating the last cylinder in fdisk to
primary partition 2.
Once you have the second, small partition (you are only going to use
1k, so as small a partition as possible) you can put a key on it.
This is as simple as
dd if=/dev/urandom of=/dev/sda2
bs=1M
.
Adding the key to the luks partition
Next, you need to add your new key as able to decrypt the partition.
Luks allows several keys to be able to unlock the partition. The real
key is decrypted under each of the user keys or passphrases and stored
in a key slot' in the partition. To add your key type:
touch /tmp/keyfile chmod 600 /tmp/keyfile dd if=/dev/sda2 bs=1k count=1 of=/tmp/keyfile cryptsetup luksAddKey /dev/hda5 /tmp/keyfile wipe /tmp/keyfileNote the careful handling of the temporary key file (luksKeyAdd won't read from stdin, whereas luksOpen will), I recommend storing it on a ramdisk and you should certainly use wipe rather than rm if you don't. Once you have added your USB key you could remove the passphrase from the key list with luksDelKey, but if for any reason you lose the USB hdd you will be unable to decrypt the partition; I recommend leaving both keys available. Booting automatically In order to boot using the USB key we need to provide a couple of helper scripts in order for the initramfs to work. We also need to set some parameters on the kernel command line. In Debian these scripts can be added to the initramfs by putting them in /etc/initramfs-tools/. The first script is a helper script used when building the initramfs. This writes a second script into the initramfs itself which takes the partition as a parameter and prints the key on stdout. This should be written to /etc/initramfs-tools/hooks/cryptkey (executable) and contain:
#!/bin/sh -- PREREQ="" prereqs() echo "$PREREQ" case $1 in prereqs) prereqs exit 0 ;; esac . /usr/share/initramfs-tools/hook-functions cat > $ DESTDIR /bin/loadkeyThe second script runs immediately before the cryptsetup script in the initramfs and ensures that the USB disk is available. This will cause the boot sequence to block until the USB disk is inserted and the device nodes created by udev. It can be provided directly in /etc/initramfs-tools/scripts/local-top/00ensureusb (executable) and should contain:
#!/bin/sh --
PREREQ=""
prereqs()
echo "$PREREQ"
case $1 in
prereqs)
prereqs
exit 0
;;
esac
if ! grep cryptopts /proc/cmdline >/dev/null; then return; fi
. /scripts/functions
log_begin_msg "Waiting for USB to become available..."
modprobe usbcore
modprobe uhci_hcd
modprobe ehci_hcd
modprobe usb_storage
while [ ! -b /dev/sda2 ]; do
sleep 1
done
log_end_msg
exit 0
The cryptsetup script itself reads configuration from the kernel command
line. Here you can give it a script which will read the key and the
source for the key to read. Edit your grub or lilo config and append
the following to the kernel command line:
cryptopts=keyscript=/bin/loadkey,key=/dev/sda2,source=/dev/hda5,target=hda5_crypt,lvm=hecate-root
You will obviously have to change the name of your lvm root partition
(volumegroup-logicalvolume). I recommend having two entries in the
boot menu, one with the cryptopts and one without to allow easy
decryption using the passphrase instead.
Conclusion
That should be everything. Boot your computer and inset the usb hdd.
When the boot process passes decryption you can remove it again. You
may have to replug it if you boot with it inserted to start with.



Atheros has released a
One of the hard things about getting started with
We just had a chimney fire tonight at home...
Nothing grave, indeed. I was just hacking close to the wood stove we use to heat the house during winter and I suddenly hear a kind of whoooosh noise in the chimney.
Fortunately, I had of these devices you can throw in the fire and make a lot of smoke that help cooling down the fire, then I poured water inside the stove (which is exactly what's to be done, said the firemen later).
Then I call firemen who came in about 10 minutes....and basically had nothing to do except survey the chimney for a while (the exit of the stove to the chimney was bright red for about 1 hour)....and dirty half of the house..:-)
Noone hurt, nothing broken in the house, but that was kind of a fear. Man, the chimney was to be cleaned next Wednesday....just a little bit too late, but last cleaning was in May...:-
I think it'll be quite a while since a light that wood stove again....
Update: thanks to Eric Cooper, I now know about "wood stove" or "wood-burning stove".

Sooner or later, I will conduct a series of interviews as well as a community
survey among Debian package maintainers as part of
an hour ago I received an email from my AM who considers my packages to be
in good shape; that means that the "Tasks and Skills Check" part
of my 
As last Wednesday was the second anniversary of me joining Google, I thought
it an opportune time to reflect on how I've found learning
Well, I havn't seen this recently. Maybe because aptitude has rename
'upgrade' do 'safe-upgrade', to make it obvious, that 'dist-upgrade' might do
unwanted things.Back when I was the maintainer of the galeon webbrowser package, I got bug
reports and reports on IRC each time the mozilla packages was updated.The galeon package used to have a conflict with mozilla of any newer major
version than the one it was built with. This was a good thing - mozilla APIs
were chaning, and when Mozilla was upgraded from let's say version 1.5 to 1.6,
it would break galeon. Galeon would at least need to be recompiled or might
even need source changes. So there was plenty of reason to add this conflic.People were using 'dist-upgrade' all the time, and what dist-upgrade did then
was to upgrade the mozilla package by removing galeon. And they couldn't even
install galeon back again, because the new mozilla had replaced the old mozilla
in unstable. And each time, I basically had to tell people "well, you shouldn't
have used 'dist-upgrade', it's for upgrading between major version of Debian,
not for daily use.In fact, running dist-upgrade right now would uninstall
'iceweasel-dom-inspector' for me. I guess this is exactly due to the same
reasons.I'm wondering whether we should maybe do a 'uninstall-ok' list (or
'dist-upgrade-hints') and ship it with the distribution. I'd then modify the
'dist-upgrade' command to
We had a nice trip the rest of the way home from our
Is there an existing system which will allow me to query Apache logfiles via an SQL string? (Without importing into a database first).
I've found the perl library SQL::YASL - but that has a couple of omissions which mean it isn't ideal for my task: