Skip to content

Conversation

@danko-miladinovic
Copy link
Contributor

@danko-miladinovic danko-miladinovic commented Nov 24, 2025

What type of PR is this?

This is a feature because it adds Full Disk Encryption (FDE) capability to the CVM.

What does this do?

This PR changes the Buildroot configuration to add support for FDE. The main idea is to run a QEMU-NBD source disk and alter the initramfs init script to read the connect and read the source disk. The init script would then copy the source disk into the disk attached to the CVM. After the copy process is done the init script will boot the encrypted disk.

The kernel configuration is altered to match Ubuntu Noble OS.

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

Tests will be added.

Did you document any new/modified feature?

The documentation for launching the source disk image is added.

Notes

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 36.95652% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.11%. Comparing base (5ae4f0f) to head (682ad2a).

Files with missing lines Patch % Lines
manager/qemu/vm.go 48.38% 13 Missing and 3 partials ⚠️
manager/qemu/config.go 13.33% 12 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #553      +/-   ##
==========================================
- Coverage   68.34%   68.11%   -0.24%     
==========================================
  Files          77       77              
  Lines        5626     5670      +44     
==========================================
+ Hits         3845     3862      +17     
- Misses       1439     1461      +22     
- Partials      342      347       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danko-miladinovic danko-miladinovic marked this pull request as ready for review December 1, 2025 12:12
@danko-miladinovic danko-miladinovic self-assigned this Dec 1, 2025
# Ensure /etc/fstab exists
if [ ! -f "${TARGET_DIR}/etc/fstab" ]; then
touch "${TARGET_DIR}/etc/fstab"
# Ensure /etc/fstab does not exists
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Ensure /etc/fstab does not exists
# Ensure /etc/fstab does not exist

v.vmi.Config.OVMFVarsConfig.File = dstFile
}

if v.vmi.Config.EnableDisk {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If disk creation succeeds but VM startup fails later (e.g., in executableAndArgs or cmd.Start), the created qcow2 file in /tmp will be orphaned. Additionally, Stop() cleans up CertsMount and EnvMount but not DstFile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stop() has been modified to delete the disk.

2. Creates a fresh encrypted LUKS2 disk
3. Copies the qcow2 contents into the encrypted disk
4. Hashes the content
5. Extends a vTPM PCR with that hash (onyl for vTPM with SEV-SNP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
5. Extends a vTPM PCR with that hash (onyl for vTPM with SEV-SNP)
5. Extends a vTPM PCR with that hash (only for vTPM with SEV-SNP)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these deleted?

type Config struct {
EnableSEVSNP bool
EnableTDX bool
EnableDisk bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EnableDisk has no env tag and isn't set programmatically in NewConfig(), so it always defaults to false.

BR2_PACKAGE_GCC=y
BR2_PACKAGE_GCC_TARGET=y
BR2_PACKAGE_LIBSTDCPP=y
BR2_PACKAGE_LIBSTDCPP=y No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BR2_PACKAGE_LIBSTDCPP=y
BR2_PACKAGE_LIBSTDCPP=y

BR2_PACKAGE_NBD=y
BR2_PACKAGE_NBD_CLIENT=y
BR2_PACKAGE_CRYPTSETUP=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDE=y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a misspelling of EUDE to EUDEV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants