User loginCMS by Drupal |
HOWTO: Replacing cryptoloop with dm-crypt in DebianA while back, I wrote a little HOWTO on putting the cryptoloop module back in Debian. Yesterday, Josh Triplett pointed out to me that current dm-crypt can actually be used instead of the cryptoloop module to compatibly work with cryptoloop-formatted volumes. Huh. It turns out to be as simple as
Obviously you'll need to make some substitutions in the above. Use
to clean up afterwards. Enjoy.
|
Impossible to mount
Hello,
I had offset with cryptoloop using twofish. But i'm unable to mount it with cryptosetup.
I used to mount this like that:
losetup -e twofish -o 2560 /dev/loop0 /dev/hdb1 => enter passphrase
mount -t ext3 /dev/loop0 /home/
I tried with your command :
cryptsetup create -c twofish -o 2560 testAB /dev/sdb1
and then :
mount /dev/mapper/testAB test/
But it's not working (wong FS type).
Do you see something wrong?
Thanks for help
ideas
Dunno. Things to try:
You may want to look at "--skip" vs "--offset". Not sure which you need here.
You may want to look at the "--key-size" option. Maybe there's a different default for twofish.
I don't think /dev/hdb1 vs /dev/sdb1 should make any difference, but for the record make sure you're trying the right volume.
If all else fails, see my other HOWTO for how to build cryptoloop for your box. See if that still works for you. That might give a clue about what's going on.
re:ideas
Hello,
cryptsetup --offset 2560 create -c twofish testAB /dev/sdb1
cryptsetup --skip 2560 create -c twofish testAB /dev/sdb1
for both, mount is failing (wrong FS type. I know that key is correct)
=> losetup -e twofish -o 2560 /dev/loop0 /dev/sdb1 and then I entered password. Maybe you can give a hint here.
Thanks
AB
more ideas
Huh. So the thing still pulls with cryptoloop; that's good, it means that we can rule out a lot of things.
There's some useful but dated information here.
The default keysize for most versions of losetup seems to be 256. For certain old versions of SuSE it was apparently 192.
I'm running out of ideas. You might want to ping the cryptsetup/dmcrypt folks directly...
Finally mounted
Hello,
Thanks for hint with mailing list. They were answering very fast. This is resolution:
losetup specifies the offset in bytes, while cryptsetup uses sectors (of 512 bytes).
you need to set not only offset but also IV offset (to the same value) (--skip value)
So, to sum up :
With Debian 5.x, with losetup, I used previously for kernel < 2.6.32:
# losetup -e twofish -o 2560 /dev/loop0 /dev/sdb1
# mount -t ext3 /dev/loop0 /home/
I'm now using cryptsetup 1.1.3 in Debian 6.0 with this command (as cryptloop module is not coming with kernel):
# cryptsetup create -c twofish -o 5 --skip 5 testAB /dev/sdb1
# mount /dev/mapper/testAB /home
Reference of thread:
http://www.saout.de/pipermail/dm-crypt/2011-April/001635.html
Thanks for help/ hints
Gratz!
Glad you got it working! Thanks huge for the report—it is greatly appreciated and should help others out a lot. I know I learned some things.
Using dm-crypt on files
Thanks. But I still can`t get how to mount it for second time.
Should I use "cryptsetup create..." every time ?
Log file:
---------------------------------------------------------
##install:
#dd if=/dev/zero of=BackCopyFile bs=1M count=125
#losetup -v -f BackCopyFile
Loop device is /dev/loop0
#cryptsetup -c aes -y create BackCopyMap /dev/loop0
Enter passphrase:
Verify passphrase:
#mkfs.ext3 /dev/mapper/BackCopyMap
Writing superblocks and filesystem accounting information: done
#mount /dev/mapper/BackCopyMap /mnt/BackCopyMount
#touch /mnt/BackCopyMount/test
#ls /mnt/BackCopyMount/
lost+found test
##umount:
#umount /dev/mapper/BackCopyMap
#cryptsetup remove BackCopyMap
#losetup -d /dev/loop0
Ok.
But how we can mount it ?
I tryed:
#losetup -v -f BackCopyFile
Loop device is /dev/loop0
v1:
# cryptsetup -c aes reload BackCopyMap /dev/loop0
The reload action is deprecated. Please use "dmsetup reload" ...
Enter passphrase:.
#mount /dev/mapper/BackCopyMap /mnt/BackCopyMount
mount: special device /dev/mapper/BackCopyMap does not exist
v2:
# cryptsetup -c aes luksOpen /dev/loop0 BackCopyMap
Device /dev/loop0 is not a valid LUKS device
v3:
#dmsetup load /dev/loop0 BackCopyMap
Device /dev/loop0 not found
Command failed
--
Nicholas
Yes, use cryptsetup create
Yes, use the horribly-named
cryptsetup createevery time, notcryptsetup reload.cryptsetup createwon't touch your filesystem--it just "creates" the device file in/dev/mapper. So do it every time just like you did it the first time.Can you show an example how
Can you show an example how to use dm-crypt with iso file with no loop device ?
(dd if=/dev/zero of=file.iso bs=1M count=125 ...)
Thanks.
Nicholas
Using dm-crypt on files
You will still need a loop device, but not cryptoloop. I just set this up for the first time last night.
To take it all down:
If you forget what loopback device you used, "
cryptsetup status volume-label" will show this, unless you've already done theremove. So go carefully.It's all lots more trouble that the
cryptoloopsolution, and no more secure. Apparently, though, it's the future for some reason.