First, Gentoo is great! I am 13 (and a half) and have installed it 4 times so far. It is hard at first but DON'T GIVE UP because it is worth it! If I can make it work SO CAN YOU!
I figured out how to make a encrypted root file system. It is pretty easy (and keeps your little brother from stealing your MP3 files). So for my first newbie post I will share how I did it.
Stuff you need first
----------------------
1) A working system with a seperate /boot partition. If Gentoo is not working right before you encrypt the root file system, it won't work very good afterwards either.
2) The loop-AES stuff... download from sourceforge. Read the loop-AES README so that if something don't work you don't feel like a clueless idiot later.
3) The source tarball for util-linux-2.11y (or whatever). Get from the standard kernel sites... ftp.kernel.org/pub/utils/util-linux.
4) The Knoppix (or Knoppix lite) CD from
http://www.knoppix.net . Burn it to a CD and make sure you can boot from it. Knoppix is great rescue system and I use it it alot to fix stuff when I mess up bad. Knoppix comes with loop-AES already on it so you don't need to make your own rescue system. This is important later because to encrypt a root file system you can't be running on it at the same time.
How to do it steps
--------------------
1) Recompile your kernel. You HAVE to use CONFIG_MODULES=y, CONFIG_BLK_DEV_LOOP=n (y or m WONT WORK), CONFIG_BLK_DEV_RAM=y, CONFIG_BLK_DEV_RAM_SIZE=4096, CONFIG_BLK_DEV_INITRD=y, CONFIG_MINIX_FS=Y (this is because the ramdisk is minix), CONFIG_PROC_FS=y plus whateve FILESYSTEM YOUR ROOT IS HAS TO BE Y (modules wont work because the kernel can't get modules from the root file system until it knows how to read it and decrypt it when it is booting, other stuff can be modules if you want). Make sure that your new kernel works before going further.
2) cd to /usr/src and untar the loop-AES tar file. Type make. This makes a new loop device driver that knows how to encrypt and uncrypt stuff.
3) Put the util-linux-2.11y (or whatever) tar file in the loop-AES directory then untar it. cd to util-linux-2.11y. MAKE SURE YOU HAVE YOUR BOOT PARTITION MOUNTED AT /boot . Then type all of this stuff:
patch -p1 <../util-linux-2.11y.diff
export CFLAGS=-O2
export LDFLAGS='-static -s'
./configure
make SUBDIRS="lib mount"
cd mount
install -m 4755 -o root mount umount /bin
install -m 755 losetup swapon /sbin
rm -f /sbin/swapoff && ( cd /sbin && ln -s swapon swapoff )
rm -f /usr/share/man/man8/{mount,umount,losetup,swapon,swapoff}.8.gz
install -m 644 mount.8 umount.8 losetup.8 /usr/share/man/man8
install -m 644 swapon.8 swapoff.8 /usr/share/man/man8
rm -f /usr/share/man/man5/fstab.5.gz
install -m 644 fstab.5 /usr/share/man/man5
cp -p /lib/modules/`uname -r`/block/loop.o /boot/loop-`uname -r`.o
4) In the loop-AES directory edit build-initrd.sh. Change BOOTDEV, BOOTTYPE, CRYPTROOT, ROOTYPE and CIPHERTYPE to what you want. Then type sh build-initrd.sh . This makes a ramdisk so that the kernel knows how to get the pass phrase when you boot later.
5) Boot the knoppix CD. Type knoppix 2 so you get a root shell and not everything else because it makes it slow. Type this stuff:
losetup -e AES256 -T /dev/loop0 /dev/hda2 (or whatever is your root partition)
give the secret pass phrase that you want (DONT FORGET WHAT IT IS!)
dd if=/dev/hda2 of=/dev/loop0 bs=64k conv=notrunc (this will take a while if the partition is real big SO DONT WORRY)
6) Type mkdir /mnt/gentoo then mkdir /mnt/gentoo/boot then mount /dev/hda2 /mnt/gentoo then /mount /dev/hda1 /mnt/gentoo/boot (or whatever your partitions are). Then chroot /mnt/gentoo /bin/bash. Then edit fstab to make your root say /dev/loop5 instead of /dev/hdawhatever.
7) cd to /boot/grub and edit grub.conf to add a entry like this:
title=Encrypted Root
root (hd0,0)
kernel /bzImage ro root=/dev/ram1
initrd /initrd.gz
Reboot (TAKE OUT THE KNOPPIX CD) and tell grub you want the Encrypted Root and it will start booting then ask you for your secret pass phrase and EVERYTHING WORKS GREAT!
If it doesnt work it means that you did something wrong so then boot the knoppix cd again and do the losetup (FROM #6 LOOK UP A FEW LINES) again (DONT DO THE DD AGAIN NO MATTER WHAT) and mount it and then read the loop-AES README to find out what got messed up.
It is easy to encrypt swap and other partitions to. Read the loop-AES README!
Hope you like it!!!
Chad