Crypted loopback disk

From Aktivix
Jump to: navigation, search

Some notes on how to craete an encrypted loopback disk for things like ssl keys and certs.

dd if=/dev/urandom of=/tmp/crypto.img bs=1M count=10
chmod 600 /tmp/crypto.img 
losetup /dev/loop0 /tmp/crypto.img 
cryptsetup -y luksFormat /dev/loop0
cryptsetup luksOpen /dev/loop0 crypto
mke2fs -j -O dir_index /dev/mapper/crypto
mkdir /etc/crypto 
mount /dev/mapper/crypto /etc/crypto