27.06.2013 Views

Hack Security Pro.pdf - Index of

Hack Security Pro.pdf - Index of

Hack Security Pro.pdf - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The first time this operation is done, we will have to format the partition in ext2 (it is not advised to use<br />

a journalized file system on an encrypted partition). The formatting <strong>of</strong> /dev/hda5 will also be encrypted,<br />

so we are going to format /dev/loop0<br />

Laptop:/home/xdream# mke2fs /dev/loop0<br />

mke2fs 1.27 (8-Mar-2002)<br />

Filesystem label=<br />

OS type: Linux<br />

Block size=4096 (log=2)<br />

Fragment size=4096 (log=2)<br />

611648 inodes, 1220932 blocks<br />

61046 blocks (5.00%) reserved for the super user<br />

First data block=0<br />

38 block groups<br />

32768 blocks per group, 32768 fragments per group<br />

16096 inodes per group<br />

Superblock backups stored on blocks:<br />

32768, 98304, 163840, 229376, 294912, 819200, 884736<br />

Writing inode tables: done<br />

Writing superblocks and filesystem accounting information: done<br />

This filesystem will be automatically checked every 20 mounts or<br />

180 days, whichever comes first. Use tune2fs -c or -i to override.<br />

We can finally set up the virtual device on the specified setup point:<br />

Laptop:/home/xdream# mount /dev/loop0 /mnt/CYPHER<br />

Laptop:/home/xdream# ls /mnt/CYPHER<br />

lost+found<br />

To remove the encrypted disk:<br />

Laptop:/home/xdream# umount /mnt/CYPHER<br />

Laptop:/home/xdream# losetup -d /dev/loop0<br />

Once the encrypted disk will have been formatted a first time, you can automate this operation with a<br />

script shell, to which you will send the mount option to set up the partition and unmount to remove it.<br />

#!/bin/sh<br />

case $1 in<br />

mount) losetup -e serpent -k 256 /dev/loop0 /dev/hda5<br />

mount /dev/loop0 /mnt/CYPHER<br />

break;;<br />

umount) umount /mnt/CYPHER<br />

losetup -d /dev/loop0<br />

break;;<br />

*) echo « Usage: $0 [mount | umount]<br />

The <strong>Hack</strong>ademy DMP -195/209- SYSDREAM

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!