Interview Prep/Linux/Packages, kernel and boot

You must ensure a server boots with Secure Boot enabled and still loads your custom kernel module. How?

AdvancedScenarioPackages, kernel and boot
Answer

Situation read → Sign the module with a key enrolled in MOK.

What I'd do →

openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 3650 -subj "/CN=Org Module Signing/"
sudo mokutil --import MOK.der        # set a one-time password, reboot, enroll in MOK manager
sudo /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 MOK.priv MOK.der vendor_drv.ko
mokutil --sb-state

DKMS can sign automatically with configured keys.

Why → With Secure Boot, the kernel lockdown rejects unsigned modules ("Key was rejected by service").

Interview tip → Keep the signing private key off the servers.

All Linux questions Roadmap: Linux

More on Packages, kernel and boot