canonical / encrypt-cloud-image

GNU General Public License v3.0
9 stars 10 forks source link

False detection of root partition. #11

Open jaskaran-khurana opened 1 year ago

jaskaran-khurana commented 1 year ago

In main.go we are discovering root partition by using filesystem guid, incase of migrating traditional server images which have efi boot root, the detection logic false detects boot as the root partition. Should we do something similar to https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html

///THis is doing false detection in main.go root := partitions.FindByPartitionType(linuxFilesystemGUID)

@chrisccoulson could you please take a look at this ask, maybe we need to harden this check. Scenario is we take a Ubuntu server image, remove grub and linux kernel and add the Ubuntu linux fde kernel package there, then run encryption tools on that image, it is detecting boot partition as root partition and encrypting that. I have moved detection logic to our service and pass uuid to the tools based on detection.

jaskaran-khurana commented 1 year ago

I have a disk with seperate root and var partition both get same partuuid, I installed ubuntu server from iso root@ubuntu1804:/mnt/repos/myclone/encrypt-cloud-image# lsblk -n -J -o type,fstype,uuid,parttype /dev/nbd0p2 {    "blockdevices": [       {"type": "part", "fstype": "ext4", "uuid": "dd446044-2a18-4e42-9551-9f52b2f96fde", "parttype": "0fc63daf-8483-4772-8e79-3d69d8477de4"}    ] } root@ubuntu1804:/mnt/repos/myclone/encrypt-cloud-image# lsblk -n -J -o type,fstype,uuid,parttype /dev/nbd0p3 {    "blockdevices": [       {"type": "part", "fstype": "ext4", "uuid": "ce6ce620-1841-40e3-b01c-7b0ba412e282", "parttype": "0fc63daf-8483-4772-8e79-3d69d8477de4"}    ] }