Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
crypt-howto,heute mit cryptsetup,komplette disk und dm-crypt
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
_twist_
n00b
n00b


Joined: 19 Sep 2004
Posts: 1

PostPosted: Mon Dec 13, 2004 12:53 am    Post subject: crypt-howto,heute mit cryptsetup,komplette disk und dm-crypt Reply with quote

1x die ganze platte crypten????

kein problem; benötigt wird:

ein bootmedium mit ca 7 mb
gentoo mit:
dm-crypt - zum crypten
ash - kleine nette shell
der rest sollte schon da sein :)

kernel mit:
Code:

Block devices:
<*> Loopback device support
<*> RAM disk support
(4096) Default RAM disk size (kbytes)
[*]   Initial RAM disk (initrd) support

Multi-device support (RAID and LVM):
<*>   Device mapper support
<*>     Crypt target support

Pseudo filesystems:
[*] /dev file system support (OBSOLETE) --- unschön, aber praktisch

Cryptographic options:
<*>   Blowfish cipher algorithm --- den nehm ich, wer will, kann natürlich auch was anderes nehmen


so, damit ist der kernel in der lage, die wichtigsten sachen bereitzustellen....

nun bauen wir uns eine initrd, größe ~4mb:

Code:

dd if=/dev/zero of=initrd count=4096 bs=1024
losetup /dev/loop1 initrd
mkfs.ext2 /dev/loop1


die initrd benötigt noch folgende files (mounten mit mount -o loop initrd /mnt/loop):

Code:

box # ls -R
.:
bin  dev  lib  linuxrc  my_root  proc

./bin:
ash  cat  chroot  cp  cryptsetup  ls  mkdir  mknod  mount  pivot_root  umount

./dev:
console  hda  hda1  hda2  hda3  hda4  hda5  mapper  null  tty  urandom

./dev/mapper:
control

./lib:
ld-2.3.4.so    libc.so.6             libdl-2.3.4.so  libncurses.so.5     libpthread.so.0
ld-linux.so.2  libdevmapper.so       libdl.so.2      libncurses.so.5.4   librt-2.3.4.so
libc-2.3.4.so  libdevmapper.so.1.00  libncurses.so   libpthread-0.10.so  librt.so.1

./my_root:

./proc:



    das dev-dir könnte auch leer sein.... ich hatte probiert auf
    Code:
     [*] /dev file system support (OBSOLETE) 
    zu verzichten... aber irgendwas fehlt da wohl noch....was

    die libncurses.so und libpthread-0.10.so wird für ls und strace benötigt.... ist ganz praktisch zum debuggen


nun fehlt noch die initrd:
Code:

#!/bin/ash

echo "----------------------------------"

echo "Mounting /proc"
mount -n -t proc none /proc

CMDLINE=$(cat /proc/cmdline)

echo "Mounting /dev"
mount -n -t devfs none /dev

DO_LOOP="1"
while [ $DO_LOOP -eq 1 ]
do
    echo
    cryptsetup -v -c blowfish create crypt /dev/discs/disc0/part2

    mount -n -o ro -t ext3 /dev/mapper/crypt /my_root

    if [ $? -ne 0 ]
    then
        cryptsetup remove crypt
        echo "blub da any-key"
        read
    else
        DO_LOOP="0"
    fi
done

echo "Creating /dev"
mount -n -t ramfs none /my_root/dev
cp -apR /dev/* /my_root/dev

cd my_root

pivot_root . mnt/mnt

# Start init
exec chroot . /bin/sh <<- EOF >dev/console 2>&1
umount /mnt/mnt/dev
umount /mnt/mnt/proc
umount /mnt/mnt
exec /sbin/init ${CMDLINE}
EOF

ash


    cryptsetup muss noch angepasst werden, jenach verschlüsselungsart und partition/platte; bei mir ists blowfish und hda2

    das letzte ash sollte nie gebraucht werden, da vorher /sbin/init gestartet wird


zum schluss muss auf unser bootmedium ein grub/lilo/was auch immer und:
unser kernel (bei mir bzImage)
nett ist noch die dazugehörige System.map
und unsere initrd

wer will, kann diese noch mit gzip packen, dann aber nicht vergessen den namen beim booten zu ändern

gebootet wird der spaß mit:

Code:

kernel /bzImage root=/dev/ram0 init=/linuxrc initrd=initrd
initrd /initrd


wichtig:

wer udev verwendet sollte in /sbin/rc nach
Code:

ebegin "Mounting ramfs at /dev"
try mount -n -t ramfs none /dev

suchen und
Code:

try mount -n -t ramfs none /dev

durch
Code:

#try mount -n -t ramfs none /dev

ersetzen. was mit devfs, keine ahnung....

problem:
hier wird unsere schon gebautes /dev unbrauchbar gemacht und unser /dev/mapper/crypt ist weg.... das gibt böse probleme beim booten.

mal schaun, evtl. wird demnächst beim booten überprüft, ob ein /dev mit ramfs schon gemountet ist, dann wird dies überflüssig

das war dann eigentlich auch schon alles... nett oder??? war mein erstes howto... vorschläge sind willkommen :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum