#697905#5
Date:
2013-01-11 09:19:53 UTC
From:
To:
Hi,

I think that using udev persistent device naming in /etc/crypttab
would be useful to prevent some dangerous situation, like the
following one.

I have a 3 disks setup with the first two in raid mode and the third as
archive. The swap partitions are encrypted with dm-crypt and out of the
raid. After the install /etc/crypttab contains:

sda1_crypt /dev/sda1 /dev/urandom cipher=aes-xts-plain64,size=256,swap
sdb1_crypt /dev/sdb1 /dev/urandom cipher=aes-xts-plain64,size=256,swap

When the first or the second disk fails or begin removed, sdc is renamed
sdb and the first partition (that unlucky was not a swap partition) is
overwritten. The recover of the filesystem was not automatic and
required to rewrite with zeros all the sectors overwritten by encrypted
data, as explained by that mail message:

https://www.redhat.com/archives/ext3-users/2011-January/msg00010.html


As dm-crypt without luks do not supports UUIDs, udev persistent naming
should prevent this situation in a safe manner, mapping the device and
doing mkswap or mkfs only if the partition is exactly on the disk
selected by the installer. In other cases it fails, that is safer than
doing mkswap on random partitions.

I have attached an untested patch to partman-crypto that should address
this issue. As this is my first look of debian installer sources, this
patch is not intended to be applied as is, but as a detailed
explanation of the fix. The /etc/crypttab would be:

sda1_crypt /dev/disk/by-id/scsi-NAME-SERIAL-part1 /dev/urandom ...


This bug affects both squeeze and wheezy.

Ciao

#697905#10
Date:
2013-01-11 09:57:23 UTC
From:
To:
Please unsubscribe..


Thank you.

#697905#15
Date:
2013-02-03 20:53:07 UTC
From:
To:
Hi,

Trek <trek00@inbox.ru> (11/01/2013):

thanks for your report and the proposed patch. I'm afraid it's very
late in the development cycle to merge that, and as you wrote, it's
even untested right now. Surely something we should be looking into
during the “jessie” development cycle.

Mraw,
KiBi.

#697905#20
Date:
2013-02-03 23:44:58 UTC
From:
To:
I was hoping to remove the disk ID transition code after wheezy.  I'm
really disappointed to see that the installer is still generating
brittle configuration files, though I agree that an untested patch can't
be accepted.

Ben.

#697905#25
Date:
2015-02-15 23:07:17 UTC
From:
To:
as I have installed jessie with debootstrap, I cannot verify if the
swap config lines in /etc/crypttab are safe now, but reading the source
they are not

the patch I proposed 2 years ago sadly run only on linux but not on
kfreebsd nor hurd

may be that in the meanwhile we can add a warning in the README.Debian
file of the cryptsetup package? The user should be informed to
use /dev/disk/by-id devices on linux or a precheck script with the
other kernels

ciao