Sunday, April 22, 2012

Creating Encrypted DVD's on Linux

This is based on another website whose URL I have lost.  I am adding value by describing how to use this to create a large file that can be put onto a DVD and loaded from there as a secure DVD.

# Here is howto create a crypto file system to put onto a DVD.
# Testing this out for work

# Create 4.4Gb file as filesystem

dd if=/dev/zero bs=1M count=4450 of=dvdfish

# if you create files of this size then they have to be written to the ISO format using standard 3, which isn't fully supported.

#you can always change the 4450 to 1485 and store 3 file systems of this size on each DVD.

# Load cryptoloop:

sudo modprobe cryptoloop && lsmod | grep cryptoloop

# Mount the file with the losetup command using the twofish cypher (be careful, it will ask for a password, do not confuse this with sudo asking for a password. We just authenticated against sudo so sudo does not need a password. Use a new one, and remember it!):

sudo losetup -e twofish /dev/loop0  dvdfish

# Create the ext3 filesystem:

sudo mkfs.ext3 /dev/loop0

# modify the file system a bit

# set reserved blocks to zero

sudo tune2fs -m 0 /dev/loop0

# set the auto check interval to never automatically check the file system on mounting it.

sudo tune2fs -c 0 /dev/loop0

# Make the directory where you want to mount the file system:

mkdir dvd

# And finally mount it:

sudo mount -t ext3 /dev/loop0 dvd

#Set permissions on the file system so you can write:

sudo chown -R username:username DVD

#change the username to be your username in both places

# If you do not get any error-messages then you just created a mount point for all your confidential information. Copy files to the dvd mount point and they will be encrypted on the fly. To umount and disable it, use the following commands:

#Copy your files to the dvd directory and organize them how you want.

#Once you have the data on the DVD that you wnt to securely store, then once it is ready, you close it and write the disk image to the DVD drive.

sudo umount dvd
sudo losetup -d /dev/loop0

# now put in a blank dvd into the drive and a window will pop up.  Drag the dvdfish file into this drive.  Burn the image.

# Insert the disk image you want into the DVD drive. Run these commands:

sudo losetup -e twofish /dev/loop0  /media/cdom/dvdfish
sudo mount -t ext3 /dev/loop0 dvd

# At this point the image is read only.

No comments:

Post a Comment