Operating System - Linux
1752678 Members
5754 Online
108789 Solutions
New Discussion юеВ

Re: 'dm-crypt' - How can I be sure that data is encrypted ?

 
SOLVED
Go to solution
Maaz
Valued Contributor

'dm-crypt' - How can I be sure that data is encrypted ?

followed the http://www.saout.de/misc/dm-crypt/
to encrypt file system(/dev/sda6)

I did the following

# echo 0 `blockdev --getsize /dev/sda6` crypt aes-plain
0123456789abcdef0123456789abcdef 0 /dev/sda6 0 | dmsetup create volume0

# mkfs.reiserfs /dev/mapper/volume0
# mount /dev/mapper/volume0 /mnt
# mount |grep volume0
/dev/mapper/volume0 on /mnt type reiserfs (rw)

Now how can I verify that its(encryption) working fine or not ?

I unmount and mount the /dev/mapper/volume0 several times, but it never
ask me to provide the cipher.

How can I be sure(test/verify) that my data is safe/encrypted ?

Regards
3 REPLIES 3
Matti_Kurkela
Honored Contributor
Solution

Re: 'dm-crypt' - How can I be sure that data is encrypted ?

Unmounting and re-mounting the /dev/mapper/volume0 won't cause the pass-phrase to be requested.

Do this instead:
# umount /dev/mapper/volume0
# dmsetup remove volume0

Now your encrypted device is shut down and all information about the pass-phrase is removed from system memory.

To re-start your encrypted device:
# echo 0 `blockdev --getsize /dev/sda6` crypt aes-plain
0123456789abcdef0123456789abcdef 0 /dev/sda6 0 | dmsetup load volume0

# mount /dev/mapper/volume0 /mnt

To verify your data is encrypted, try to use some data recovery tools on /dev/sda6. I don't think you'll find any useful plaintext, unless you used /dev/sda6 as an unencrypted partition before setting up the encryption.

When setting up an encrypted partition, you should fill the partition with random data as the very first step, before "dmsetup create". This ensures no unencrypted data will remain, and makes it impossible to identify which parts of the encrypted partition have actually been used.

(A property of a good encryption algorithm is that the encrypted data resembles random noise unless you decrypt it with a correct key.)

For example:
dd if=/dev/urandom of=/dev/sda6 bs=16384
(Note: this will *destroy* any existing data on /dev/sda6. It will also take a long time.)

MK
MK
Maaz
Valued Contributor

Re: 'dm-crypt' - How can I be sure that data is encrypted ?

excellent help Matti Kurkela

thanks
Regards
Maaz
Steven E. Protter
Exalted Contributor

Re: 'dm-crypt' - How can I be sure that data is encrypted ?

Shalom,

I would try various methods to read the data, including dd, mount/umount, and some typical tools.

If you are very concerned, you can try some tools that use cracklib to crack the passphrase on the data.

But if the data looks like garbage in clear text, its encrypted. The issue to test is whether the pass phrase is something that can be broken.

In an ideal world, I'd devote a system to trying to crack such things to insure data safety.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com