LDP/LDP/howto/docbook/Encrypted-Root-Filesystem-H...

585 lines
19 KiB
XML
Raw Normal View History

2005-03-13 22:11:45 +00:00
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://docbook.org/xml/4.2/docbookx.dtd" []>
2003-09-27 17:24:23 +00:00
<article class="whitepaper" id="Encrypted-Root-Filesystem-HOWTO">
<articleinfo>
<title>Encrypted Root Filesystem HOWTO</title>
<author>
<firstname>Christophe</firstname>
<surname>Devine</surname>
</author>
<abstract>
<para>
2003-12-02 01:23:23 +00:00
This document explains how to make your personal data secure
2003-09-27 17:24:23 +00:00
by encrypting your Linux root filesystem using strong cryptography.
</para>
</abstract>
<legalnotice>
<para>
This HOWTO is released under the GNU Free Documentation License
Version 1.2.
</para>
</legalnotice>
<revhistory id="revhistory">
2003-09-27 17:24:23 +00:00
2005-03-13 22:11:45 +00:00
<revision>
<revnumber>v1.3</revnumber>
<date>2005-03-13</date>
<authorinitials>cd</authorinitials>
<revremark>Updated the packages version.</revremark>
</revision>
2004-10-20 17:20:45 +00:00
<revision>
<revnumber>v1.2</revnumber>
<date>2004-10-20</date>
<authorinitials>cd</authorinitials>
<revremark>Updated the packages version.</revremark>
</revision>
2003-12-02 01:23:23 +00:00
<revision>
<revnumber>v1.1</revnumber>
<date>2003-12-01</date>
<authorinitials>cd</authorinitials>
<revremark>Added support for GRUB.</revremark>
</revision>
2003-09-27 17:24:23 +00:00
<revision>
<revnumber>v1.0</revnumber>
<date>2003-09-24</date>
<authorinitials>cd</authorinitials>
<revremark>Initial release, reviewed by LDP.</revremark>
</revision>
<revision>
<revnumber>v0.9</revnumber>
<date>2003-09-11</date>
<authorinitials>cd</authorinitials>
<revremark>Updated and converted to DocBook XML.</revremark>
</revision>
</revhistory>
</articleinfo>
2003-12-02 01:23:23 +00:00
<sect1 id="preparing-system">
<title>Preparing the system</title>
<sect2 id="partition-layout">
<title>Setting up the partition layout</title>
<para>
Your hard disk (hda) should contain at least three partitions:
<itemizedlist>
<listitem><para>
2004-10-20 17:20:45 +00:00
hda1: this small unencrypted partition will ask for
2003-09-27 17:24:23 +00:00
a password in order to mount the encrypted root filesystem.
2003-12-02 01:23:23 +00:00
</para></listitem>
<listitem><para>
hda2: this partition will contain your encrypted root filesystem;
make sure it is large enough.
</para></listitem>
<listitem><para>
2003-09-27 17:24:23 +00:00
hda3: this partition holds the current GNU/Linux system.
2003-12-02 01:23:23 +00:00
</para></listitem>
</itemizedlist>
</para><para>
At this point, both hda1 and hda2 are unused. hda3 is where your
Linux distribution is currently installed; /usr and /boot must
<emphasis>not</emphasis> be separated from this partition.
2004-10-20 17:20:45 +00:00
</para><para>
Here's an example of what your partition layout might look like:
</para><para>
<screen># fdisk -l /dev/hda
Disk /dev/hda: 255 heads, 63 sectors, 2432 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 1 8001 83 Linux
/dev/hda2 2 263 2104515 83 Linux
/dev/hda3 264 525 2104515 83 Linux
/dev/hda4 526 2047 12225465 83 Linux</screen>
2005-03-13 22:11:45 +00:00
</para>
</sect2>
<sect2 id="debian-packages">
<title>Required packages</title>
<para>
If you use Debian, the following packages are mandatory:
</para><para>
<screen>apt-get install gcc make libncurses5-dev patch bzip2 wget</screen>
</para><para>
To make copy &amp; paste easier, you should also install:
</para><para>
<screen>apt-get install lynx gpm</screen>
</para>
2003-12-02 01:23:23 +00:00
</sect2>
2003-09-27 17:24:23 +00:00
2004-10-20 17:20:45 +00:00
<sect2 id="install-kernel-2.4">
2005-03-13 22:11:45 +00:00
<title>Installing Linux-2.4.29</title>
2003-09-27 17:24:23 +00:00
<para>
2004-10-20 17:20:45 +00:00
There are two main projects which add loopback encryption support in the
kernel: cryptoloop and loop-AES. This howto is based on loop-AES, since it
features an extremely fast and highly optimized implementation of Rijndael
2003-09-27 17:24:23 +00:00
in assembly language, and therefore provides maximum performance if
2004-10-20 17:20:45 +00:00
you have an IA-32 (x86) CPU. Besides, there are some
2005-03-13 22:11:45 +00:00
<ulink url="http://groups.google.com/groups?selm=1emrG-1Ck-25%40gated-at.bofh.it">security concerns</ulink>
2004-10-20 17:20:45 +00:00
about cryptoloop.
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
First of all, download and unpack the loop-AES package:
2003-09-27 17:24:23 +00:00
</para><para>
2005-03-13 22:11:45 +00:00
<screen>cd /usr/src
wget http://loop-aes.sourceforge.net/loop-AES/loop-AES-v3.0b.tar.bz2
tar -xvjf loop-AES-v3.0b.tar.bz2</screen>
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
Then you must download and patch the kernel source:
2003-09-27 17:24:23 +00:00
</para><para>
2005-03-13 22:11:45 +00:00
<screen>wget http://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.29.tar.bz2
tar -xvjf linux-2.4.29.tar.bz2
cd linux-2.4.29
2004-10-20 17:20:45 +00:00
rm include/linux/loop.h drivers/block/loop.c
2005-03-13 22:11:45 +00:00
patch -Np1 -i ../loop-AES-v3.0b/kernel-2.4.28.diff</screen>
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
Setup the keyboard map:
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
<screen>dumpkeys | loadkeys -m - > drivers/char/defkeymap.c</screen>
2003-09-27 17:24:23 +00:00
</para><para>
Next, configure your kernel; make sure the following options are set:
</para><para>
2003-12-02 01:23:23 +00:00
<screen>make menuconfig
Block devices ---&gt;
2003-09-27 17:24:23 +00:00
&lt;*&gt; Loopback device support
[*] AES encrypted loop device support (NEW)
&lt;*&gt; RAM disk support
(4096) Default RAM disk size (NEW)
2003-12-02 01:23:23 +00:00
[*] Initial RAM disk (initrd) support
File systems ---&gt;
&lt;*&gt; Ext3 journalling file system support
&lt;*&gt; Second extended fs support
(important note: do not enable /dev file system support)</screen>
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
Compile the kernel and install it:
</para><para>
<screen>make dep bzImage
make modules modules_install
2004-10-20 17:20:45 +00:00
cp arch/i386/boot/bzImage /boot/vmlinuz</screen>
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
If grub is your bootloader, update /boot/grub/menu.lst
or /boot/grub/grub.conf:
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
<screen>cat &gt; /boot/grub/menu.lst &lt;&lt; EOF
default 0
timeout 10
color green/black light-green/black
title Linux
root (hd0,2)
2004-10-20 17:20:45 +00:00
kernel /boot/vmlinuz ro root=/dev/hda3
2003-12-02 01:23:23 +00:00
EOF</screen>
</para><para>
Otherwise, update /etc/lilo.conf and run lilo:
</para><para>
<screen>cat &gt; /etc/lilo.conf &lt;&lt; EOF
lba32
boot=/dev/hda
prompt
2005-03-13 22:11:45 +00:00
timeout=60
2004-10-20 17:20:45 +00:00
image=/boot/vmlinuz
2003-12-02 01:23:23 +00:00
label=Linux
read-only
root=/dev/hda3
EOF
lilo</screen>
</para><para>
You may now restart the system.
2003-09-27 17:24:23 +00:00
</para>
</sect2>
2003-12-02 01:23:23 +00:00
2004-10-20 17:20:45 +00:00
<sect2 id="install-kernel-2.6">
2005-03-13 22:11:45 +00:00
<title>Installing Linux-2.6.10</title>
2004-10-20 17:20:45 +00:00
<para>
Proceed as described in the previous section, using loop-aes'
2005-03-13 22:11:45 +00:00
<emphasis>kernel-2.6.10.diff</emphasis> patch instead, and make
sure cryptoloop support is <emphasis>not</emphasis> activated.
Note that modules support require that you have the module-init-tools
2004-10-20 17:20:45 +00:00
package installed.
</para>
</sect2>
2003-09-27 17:24:23 +00:00
<sect2 id="install-util-linux">
2005-03-13 22:11:45 +00:00
<title>Installing util-linux-2.12p</title>
2003-12-02 01:23:23 +00:00
<para>
2003-09-27 17:24:23 +00:00
The losetup program, which is part of the util-linux package, must be
patched and recompiled in order to add strong cryptography support.
2003-12-02 01:23:23 +00:00
Download, unpack and patch util-linux:
</para><para>
2005-03-13 22:11:45 +00:00
<screen>cd /usr/src
wget http://ftp.kernel.org/pub/linux/utils/util-linux/util-linux-2.12p.tar.bz2
tar -xvjf util-linux-2.12p.tar.bz2
cd util-linux-2.12p
patch -Np1 -i ../loop-AES-v3.0b/util-linux-2.12p.diff</screen>
2003-12-02 01:23:23 +00:00
</para><para>
2003-09-27 17:24:23 +00:00
To use passwords that are less than 20 characters, enter:
2003-12-02 01:23:23 +00:00
</para><para>
<screen>CFLAGS=&quot;-O2 -DLOOP_PASSWORD_MIN_LENGTH=8&quot;; export CFLAGS</screen>
</para><para>
2005-03-13 22:11:45 +00:00
Security is certainly your major concern. For this reason, please do not
enable passwords shorter than 20 characters. Data privacy is not free,
2004-10-20 17:20:45 +00:00
one has to 'pay' in form of long passwords.
2003-12-02 01:23:23 +00:00
</para><para>
2003-09-27 17:24:23 +00:00
Compile losetup and install it as root:
2003-12-02 01:23:23 +00:00
</para><para>
<screen>./configure &amp;&amp; make lib mount
2004-10-20 17:20:45 +00:00
mv -f /sbin/losetup /sbin/losetup~
rm -f /usr/share/man/man8/losetup.8*
cd mount
gzip losetup.8
cp losetup /sbin
2005-03-13 22:11:45 +00:00
cp losetup.8.gz /usr/share/man/man8/
chattr +i /sbin/losetup</screen>
2003-12-02 01:23:23 +00:00
</para>
2003-09-27 17:24:23 +00:00
</sect2>
</sect1>
<sect1 id="encrypt-root-filesystem">
<title>Creating the encrypted root filesystem</title>
<para>
Fill the target partition with random data:
</para><para>
2003-12-02 01:23:23 +00:00
<screen>shred -n 1 -v /dev/hda2</screen>
2003-09-27 17:24:23 +00:00
</para><para>
Setup the encrypted loopback device:
</para><para>
2004-10-20 17:20:45 +00:00
<screen>losetup -e aes256 -S xxxxxx /dev/loop0 /dev/hda2</screen>
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
To prevent optimized dictionary attacks, it is recommended to add
2004-10-20 17:20:45 +00:00
the -S xxxxxx option, where "xxxxxx" is your randomly chosen
2005-03-13 22:11:45 +00:00
seed (for example, you might choose "gPk4lA"). Write down your seed on
a piece of paper so that you don't loose it afterwards. Also, in order
to avoid boot-time problems with the keyboard map, do not use non-ASCII
2004-10-20 17:20:45 +00:00
characters (accents, etc.) in your password. The
<ulink url="http://www.diceware.com/">Diceware</ulink> site offers
a simple way to create strong, yet easy to remember, passphrases.
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
Now create the ext3 filesystem:
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
<screen>mke2fs -j /dev/loop0</screen>
2003-09-27 17:24:23 +00:00
</para><para>
2004-10-20 17:20:45 +00:00
Check that the password you entered is correct:
2003-09-27 17:24:23 +00:00
</para><para>
2003-12-02 01:23:23 +00:00
<screen>losetup -d /dev/loop0
2004-10-20 17:20:45 +00:00
losetup -e aes256 -S xxxxxx /dev/loop0 /dev/hda2</screen>
2003-12-02 01:23:23 +00:00
</para><para>
<screen>mkdir /mnt/efs
mount /dev/loop0 /mnt/efs</screen>
2003-09-27 17:24:23 +00:00
</para><para>
You can compare the encrypted and unencrypted data:
</para><para>
2003-12-02 01:23:23 +00:00
<screen>xxd /dev/hda2 | less
xxd /dev/loop0 | less</screen>
</para><para>
It's time to install your encrypted Linux system. If you use a GNU/Linux
distribution (such as Debian, Slackware, Gentoo, Mandrake, RedHat/Fedora,
SuSE, etc.), run the following command:
</para><para>
<screen>cp -avx / /mnt/efs</screen>
</para><para>
If you use the Linux From Scratch book, proceed as described in
the manual, with the modifications below:
<itemizedlist>
<listitem>
2003-09-27 17:24:23 +00:00
<para>Chapter 6 - Installing util-linux:</para>
<para>Apply the loop-AES patch after unpacking the sources.</para>
</listitem><listitem>
<para>Chapter 8 - Making the LFS system bootable:</para>
2004-10-20 17:20:45 +00:00
<para>Refer to the next section (Setting up the boot device).</para>
2003-12-02 01:23:23 +00:00
</listitem>
</itemizedlist>
</para>
2003-09-27 17:24:23 +00:00
</sect1>
2003-12-02 01:23:23 +00:00
<sect1 id="setup-boot-device">
2003-09-27 17:24:23 +00:00
<title>Setting up the boot device</title>
<sect2 id="initial-ramdisk">
<title>Creating the ramdisk</title>
<para>
To begin with, chroot inside the encrypted partition and create
the boot device mount point:
</para><para>
2003-12-02 01:23:23 +00:00
<screen>chroot /mnt/efs
2003-09-27 17:24:23 +00:00
mkdir /loader</screen>
</para><para>
Then, create the initial ramdisk (initrd), which will be needed
afterwards:
</para><para>
2003-12-02 01:23:23 +00:00
<screen>cd
dd if=/dev/zero of=initrd bs=1k count=4096
2003-09-27 17:24:23 +00:00
mke2fs -F initrd
mkdir ramdisk
mount -o loop initrd ramdisk</screen>
</para><para>
2004-10-20 17:20:45 +00:00
If you're using grsecurity, you may get a "Permission denied" error
message; in this case you'll have to run the mount command outside chroot.
</para><para>
2003-09-27 17:24:23 +00:00
Create the filesystem hierarchy and copy the required files in it:
</para><para>
<screen>mkdir ramdisk/{bin,dev,lib,mnt,sbin}
2004-10-20 17:20:45 +00:00
cp /bin/{bash,mount} ramdisk/bin/
2003-12-02 01:23:23 +00:00
ln -s bash ramdisk/bin/sh
mknod -m 600 ramdisk/dev/console c 5 1
mknod -m 600 ramdisk/dev/hda2 b 3 2
mknod -m 600 ramdisk/dev/loop0 b 7 0
cp /lib/{ld-linux.so.2,libc.so.6,libdl.so.2} ramdisk/lib/
cp /lib/{libncurses.so.5,libtermcap.so.2} ramdisk/lib/
2003-09-27 17:24:23 +00:00
cp /sbin/{losetup,pivot_root} ramdisk/sbin/</screen>
</para><para>
2003-12-02 01:23:23 +00:00
It's ok if you see a message like "/lib/libncurses.so.5: No such file
or directory", or "/lib/libtermcap.so.2: No such file or directory";
bash only requires one of these two libraries. You can check which one
2004-10-20 17:20:45 +00:00
is actually required with:
2003-12-02 01:23:23 +00:00
</para><para>
<screen>ldd /bin/bash</screen>
</para><para>
2004-10-20 17:20:45 +00:00
Compile the sleep program, which will prevent the password prompt
being flooded by kernel messages (such as usb devices being registered).
</para><para>
<screen>cat &gt; sleep.c &lt;&lt; &quot;EOF&quot;
#include &lt;unistd.h&gt;
#include &lt;stdlib.h&gt;
int main( int argc, char *argv[] )
{
if( argc == 2 )
sleep( atoi( argv[1] ) );
return( 0 );
}
EOF
gcc -s sleep.c -o ramdisk/bin/sleep
rm sleep.c</screen>
</para><para>
2005-03-13 22:11:45 +00:00
Create the init script:
2003-09-27 17:24:23 +00:00
</para><para>
<screen>cat &gt; ramdisk/sbin/init &lt;&lt; &quot;EOF&quot;
#!/bin/sh
2004-10-20 17:20:45 +00:00
/bin/sleep 3
2005-03-13 22:11:45 +00:00
echo -n "Enter seed value: "
read SEED
/sbin/losetup -e aes256 -S $SEED /dev/loop0 /dev/hda2
2004-10-20 17:20:45 +00:00
/bin/mount -r -n -t ext3 /dev/loop0 /mnt
2003-09-27 17:24:23 +00:00
while [ $? -ne 0 ]
do
/sbin/losetup -d /dev/loop0
2005-03-13 22:11:45 +00:00
/sbin/losetup -e aes256 -S $SEED /dev/loop0 /dev/hda2
2004-10-20 17:20:45 +00:00
/bin/mount -r -n -t ext3 /dev/loop0 /mnt
2003-09-27 17:24:23 +00:00
done
cd /mnt
/sbin/pivot_root . loader
exec /usr/sbin/chroot . /sbin/init
EOF
chmod 755 ramdisk/sbin/init</screen>
</para><para>
Umount the loopback device and compress the initrd:
</para><para>
<screen>umount -d ramdisk
rmdir ramdisk
2003-12-02 01:23:23 +00:00
gzip initrd
mv initrd.gz /boot/</screen>
2003-09-27 17:24:23 +00:00
</para>
</sect2>
<sect2 id="bootable-cd">
2004-10-20 17:20:45 +00:00
<title>Booting from a CD-ROM</title>
2003-09-27 17:24:23 +00:00
<para>
2003-12-02 01:23:23 +00:00
I strongly advise you to start your system with a read-only
media, such as a bootable CD-ROM.
</para><para>
2003-09-27 17:24:23 +00:00
Download and unpack syslinux:
</para><para>
2005-03-13 22:11:45 +00:00
<screen>wget http://ftp.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.07.tar.bz2
tar -xvjf syslinux-3.07.tar.bz2</screen>
2003-09-27 17:24:23 +00:00
</para><para>
Configure isolinux:
</para><para>
<screen>mkdir bootcd
2005-03-13 22:11:45 +00:00
cp /boot/{vmlinuz,initrd.gz} syslinux-3.07/isolinux.bin bootcd
2004-10-20 17:20:45 +00:00
echo &quot;DEFAULT /vmlinuz initrd=initrd.gz ro root=/dev/ram0&quot; \
2003-09-27 17:24:23 +00:00
&gt; bootcd/isolinux.cfg</screen>
</para><para>
Create and burn the bootable cd-rom iso image:
</para><para>
<screen>mkisofs -o bootcd.iso -b isolinux.bin -c boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-J -hide-rr-moved -R bootcd/
2003-12-02 01:23:23 +00:00
cdrecord -dev 0,0,0 -speed 4 -v bootcd.iso
rm -rf bootcd{,.iso}</screen>
</para>
</sect2>
2004-10-20 17:20:45 +00:00
2003-12-02 01:23:23 +00:00
<sect2 id="boot-partition">
2004-10-20 17:20:45 +00:00
<title>Booting from a HD partition</title>
2003-12-02 01:23:23 +00:00
<para>
2004-10-20 17:20:45 +00:00
The boot partition can come in handy if you happen to lose your bootable
CD. <emphasis>Remember that hda1 is a writable media and is thus insecure;
use it only in case of emergency!</emphasis>
2003-12-02 01:23:23 +00:00
</para><para>
Create and mount the ext2 filesystem:
</para><para>
<screen>dd if=/dev/zero of=/dev/hda1 bs=8192
mke2fs /dev/hda1
mount /dev/hda1 /loader</screen>
</para><para>
Copy the kernel and the initial ramdisk:
</para><para>
2004-10-20 17:20:45 +00:00
<screen>cp /boot/{vmlinuz,initrd.gz} /loader</screen>
2003-12-02 01:23:23 +00:00
</para><para>
If you use grub:
</para><para>
<screen>mkdir /loader/boot
cp -av /boot/grub /loader/boot/
cat &gt; /loader/boot/grub/menu.lst &lt;&lt; EOF
default 0
timeout 10
color green/black light-green/black
title Linux
root (hd0,0)
2004-10-20 17:20:45 +00:00
kernel /vmlinuz ro root=/dev/ram0
2003-12-02 01:23:23 +00:00
initrd /initrd.gz
EOF
grub-install --root-directory=/loader /dev/hda
umount /loader</screen>
</para><para>
If you use lilo:
</para><para>
<screen>mkdir /loader/{boot,dev,etc}
cp /boot/boot.b /loader/boot/
mknod -m 600 /loader/dev/hda b 3 0
mknod -m 600 /loader/dev/hda1 b 3 1
2005-03-13 22:11:45 +00:00
mknod -m 600 /loader/dev/hda2 b 3 2
mknod -m 600 /loader/dev/hda3 b 3 3
mknod -m 600 /loader/dev/hda4 b 3 4
2003-12-02 01:23:23 +00:00
mknod -m 600 /loader/dev/ram0 b 1 0
cat &gt; /loader/etc/lilo.conf &lt;&lt; EOF
lba32
boot=/dev/hda
prompt
2005-03-13 22:11:45 +00:00
timeout=60
2003-12-02 01:23:23 +00:00
image=/vmlinuz
label=Linux
initrd=/initrd.gz
read-only
root=/dev/ram0
EOF
lilo -r /loader
umount /loader</screen>
2003-09-27 17:24:23 +00:00
</para>
</sect2>
</sect1>
2003-12-02 01:23:23 +00:00
<sect1 id="final-steps">
<title>Final steps</title>
2003-09-27 17:24:23 +00:00
<para>
2004-10-20 17:20:45 +00:00
Still inside chroot, modify /etc/fstab so that it contains:
2003-09-27 17:24:23 +00:00
</para><para>
2004-10-20 17:20:45 +00:00
<screen>/dev/loop0 / ext3 defaults 0 1</screen>
2003-09-27 17:24:23 +00:00
</para><para>
2005-03-13 22:11:45 +00:00
Delete /etc/mtab and exit from chroot. Finally, run "umount -d /mnt/efs"
2004-10-20 17:20:45 +00:00
and reboot. If something goes wrong, you can still boot your unencrypted
partition by entering "Linux root=/dev/hda3" at the LILO: prompt.
2003-09-27 17:24:23 +00:00
</para><para>
2004-10-20 17:20:45 +00:00
If everything went well, you can now re-partition your disk and encrypt
hda3 as well as hda4. In the following scripts, we assume that hda3 will
hold the swap device and hda4 will contain /home; you should initialize
both partitions first:
2003-09-27 17:24:23 +00:00
</para><para>
2004-10-20 17:20:45 +00:00
<screen>shred -n 1 -v /dev/hda3
shred -n 1 -v /dev/hda4
losetup -e aes256 -S xxxxxx /dev/loop1 /dev/hda3
losetup -e aes256 -S xxxxxx /dev/loop2 /dev/hda4
mkswap /dev/loop1
mke2fs -j /dev/loop2</screen>
2003-09-27 17:24:23 +00:00
</para><para>
2004-10-20 17:20:45 +00:00
Then create a script in the system startup directory and update fstab:
2003-09-27 17:24:23 +00:00
</para><para>
2004-10-20 17:20:45 +00:00
<screen>cat &gt; /etc/init.d/loop &lt;&lt; &quot;EOF&quot;
#!/bin/sh
if [ "`/usr/bin/md5sum /dev/hda1`" != \
"5671cebdb3bed87c3b3c345f0101d016 /dev/hda1" ]
then
echo -n "WARNING! hda1 integrity verification FAILED - press enter."
read
fi
echo &quot;1st password chosen above&quot; | \
/sbin/losetup -p 0 -e aes256 -S xxxxxx /dev/loop1 /dev/hda3
2003-12-02 01:23:23 +00:00
2004-10-20 17:20:45 +00:00
echo &quot;2nd password chosen above&quot; | \
/sbin/losetup -p 0 -e aes256 -S xxxxxx /dev/loop2 /dev/hda4
/sbin/swapon /dev/loop1
for i in `seq 0 63`
do
echo -n -e "\33[10;10]\33[11;10]" > /dev/tty$i
done
EOF
chmod 700 /etc/init.d/loop
ln -s ../init.d/loop /etc/rcS.d/S00loop
vi /etc/fstab
...
/dev/loop2 /home ext3 defaults 0 2</screen>
2003-09-27 17:24:23 +00:00
</para>
</sect1>
<sect1 id="about">
<title>About this HOWTO</title>
<para>
2003-12-02 01:23:23 +00:00
The Encrypted Root Filesystem HOWTO was first written in november 2002 for the
<ulink url="http://www.linuxfromscratch.org/lfs/news.html">Linux From Scratch</ulink>
2005-03-13 22:11:45 +00:00
project. I'd like to thank the many people who have since contributed to
this document (in reverse chronological order): Micha Borrmann,
Dennis Lemckert, Oleg Vyushin, Ellen Bokhorst, Daczi L<>szl<7A>, Gaetano Zappulla,
Guillaume Lehmann, Claude Thomassin, Jean-Philippe Gu<47>rard, Luc Vo Van,
Jacobus Brink, Ernesto P<>rez Est<73>vez, Matthew Ploessel, Mike Lorek,
Lars Bungum, Michael Shields, Julien Perrot, Grant Stephenson, Cary W. Gilmer,
James Howells, Pedro Baez, Josh Purinton, Jari Ruusu and Zibeli Aton.
2004-10-20 17:20:45 +00:00
</para><para>
This HOWTO has been translated in various languages:
<itemizedlist>
<listitem><para><ulink url="http://www.traduc.org/docs/HOWTO/lecture/Encrypted-Root-Filesystem-HOWTO.html">French</ulink></para></listitem>
<listitem><para><ulink url="http://www.linux.it/~gaetano/erfs/">Italian</ulink></para></listitem>
<listitem><para><ulink url="http://tldp.fsf.hu/HOWTO/Encrypted-Root-Filesystem-HOWTO-hu/">Hungarian</ulink></para></listitem>
2005-03-13 22:11:45 +00:00
<listitem><para><ulink url="http://doc.nl.linux.org/HOWTO/Encrypted-Root-Filesystem-HOWTO-NL/article.html">Dutch</ulink></para></listitem>
2004-10-20 17:20:45 +00:00
</itemizedlist>
2003-12-02 01:23:23 +00:00
</para><para>
Please send any comment to
<ulink url="http://www.cr0.net:8040/about/">Christophe Devine</ulink>.
2003-09-27 17:24:23 +00:00
</para>
</sect1>
</article>