Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheLeftMoose/5976846cc106d71cd109acec53e6d4b0 to your computer and use it in GitHub Desktop.
Save TheLeftMoose/5976846cc106d71cd109acec53e6d4b0 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script signs the vbox modules in case you need to run vbox under uefi
#1. Create signing keys
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=vbox-mok-enrol-xxx/"
echo "1. Signing key created"
#2. Sign the modules
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxpci)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxnetflt)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxnetadp)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)
echo "2. Modules signed"
#3. Register the keys to Secure Boot
sudo mokutil --import MOK.der
echo "3. Keys registered"
echo "4. Please reboot, chose -> Enroll MOK-> insert password -> reboot"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment