Skip to content

Instantly share code, notes, and snippets.

@cezarignat
Last active November 1, 2023 15:09
Show Gist options
  • Save cezarignat/bc0b5e1d6e5263e54504105eaef8fa7d to your computer and use it in GitHub Desktop.
Save cezarignat/bc0b5e1d6e5263e54504105eaef8fa7d to your computer and use it in GitHub Desktop.
Self sign the required modules, vmmon and vmnet, for VMWARE to work with SecureBoot on, Ubuntu 17
#!/bin/sh
#Asking for sudo because the script needs it almost all the time
sudo echo -n
#Creating the key used to sign the two modules
echo 'Preparing vmware key...'
openssl req -new -x509 -newkey rsa:2048 -keyout VMWAREKEY.priv -outform DER -out VMWAREKEY.der -nodes -days 36500 -subj "/CN=VMware/"
#Sign the modules
echo 'Signing Virtual machine monitor...'
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWAREKEY.priv ./VMWAREKEY.der $(modinfo -n vmmon)
echo 'Signing Virtual ethernet...'
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWAREKEY.priv ./VMWAREKEY.der $(modinfo -n vmnet)
#Import the key, it will ask you to set a password. You need to reboot for changes to take effect
echo 'Importing key...'
echo 'Set a password to use after reboot'
sudo mokutil --import VMWAREKEY.der
RED='\033[0;31m'
printf "${RED}### You need to reboot for the changes to take effect. \n${RED}### Use the password you entered above to import the key. \n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment