Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

sign kernel modules #3

Closed
ghost opened this issue Jul 3, 2019 · 12 comments
Closed

sign kernel modules #3

ghost opened this issue Jul 3, 2019 · 12 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jul 3, 2019

Hello!
How I should sign kernel modules (dkms) for loading and working properly?
At the moment I have:

modprobe: ERROR: could not insert 'vboxdrv': Operation not permitted

dmesg:

PKCS#7 signature not signed with a trusted key

Thanks in advance!

@Snawoot Snawoot self-assigned this Jul 3, 2019
@Snawoot
Copy link
Owner

Snawoot commented Jul 3, 2019

Hello!

Here is article on this topic: https://stegard.net/2016/10/virtualbox-secure-boot-ubuntu-fail/

In short, module signature required when Secure Boot is enabled. At this moment linux-secureboot-kit doesn't sign DKMS modules, but I think it is also possible to add signing hook into DKMS post-install scripts or existing kernel post-install hooks.

Recipe above uses machine owner keys (MOK) to sign modules, which enrolment requires additional reboot. Probably we don't need MOK keys and we are already good to go with our db.key and db.crt. I'll try it soon and we'll see if automation in linux-secureboot-kit can be extended to cover DKMS modules along with the rest of protected code.

@ghost
Copy link
Author

ghost commented Jul 3, 2019

@Snawoot thanks a lot for a fast answer!
That's good, firstly I will try sign modules with MOK, and after I will wait for signing DKMS modules by linux-secureboot-kit ;)

@Snawoot Snawoot pinned this issue Jul 3, 2019
@ghost
Copy link
Author

ghost commented Jul 3, 2019

@Snawoot btw, I can't enroll MOK keys in UEFI - tool simply don't starting up on boot. I tried reset to setup mode and clean UEFI keys, but UEFI print me that: Secure Variable Update is locked down!
Also, efi-readvar print me: Variable MokList has no entries

@Snawoot
Copy link
Owner

Snawoot commented Jul 3, 2019

@mrsmith0x00 Then try to sign with db.key and db.crt instead of MOK keys. I think it has to work. Please tell your results.

@Snawoot
Copy link
Owner

Snawoot commented Jul 3, 2019

@Snawoot
Copy link
Owner

Snawoot commented Jul 3, 2019

And since they are already installed in UEFI, you don't have to add them; you may sign modules with it right away.

@ghost
Copy link
Author

ghost commented Jul 3, 2019

@mrsmith0x00 yeah, I think that this will work. But... I deleted my old linux-secure-boot folder with db.key and db.crt (sorry for that). Then I exported db file via efi-readvar -v db -o db.file. How can I solve this problem? Or I should reinstall all with zero?

@Snawoot
Copy link
Owner

Snawoot commented Jul 3, 2019

No problem. Variables contain only certificates, so private key is lost and you have to reinstall from scratch: remove all keys from UEFI, remove SignedBoot menu entry from UEFI and run install again.

@ghost
Copy link
Author

ghost commented Jul 3, 2019

@Snawoot done! Via:
/usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 /home/user/linux-secureboot-kit/db.key /home/user/linux-secureboot-kit/db.crt /lib/modules/$(uname -r)/updates/dkms/vboxdrv.ko
Thank you!

@ghost
Copy link
Author

ghost commented Jul 3, 2019

Thanks a lot for help! Now closed.

@ghost ghost closed this as completed Jul 3, 2019
@Snawoot
Copy link
Owner

Snawoot commented Jul 3, 2019

Nice! Now I have shallow understanding how it should be automated and probably soon it'll be included into linux-secure-boot recipes.

@Snawoot
Copy link
Owner

Snawoot commented Jul 7, 2019

Short notice: automated signature for DKMS modules has been merged into master along with improved initramfs signature hooks.

@Snawoot Snawoot unpinned this issue Jul 8, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant