Last active
April 23, 2025 11:46
-
-
Save kurtbahartr/f31e1d2488b05f6947f84de6bdca469e to your computer and use it in GitHub Desktop.
Sign things in Ubuntu using MOK certificates from shim-signed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$@" =~ ^-h$ ]] || [[ "$@" =~ ^-h\ ]] || [[ "$@" =~ \ -h\ ]] || [[ "$@" =~ \ -h$ ]]; then | |
echo "usage: sign-mok.sh /path/to/module.ko ..." | |
echo "" | |
echo "kmodsign usually accepts only one module per invocation." | |
echo "This script works with multiple modules because we work around this limitation with a for loop." | |
exit | |
fi | |
if [ "$2" != "" ]; then | |
echo "kmodsign usually accepts only one module per invocation." | |
echo "This script works with multiple modules because we work around this limitation with a for loop." | |
fi | |
for module in $@; do | |
echo "Signing $module..." | |
[ -f "$module" ] && sudo kmodsign sha512 /var/lib/shim-signed/mok/MOK.{priv,der} $module && echo "Signed $module." || echo "Could not sign $module." | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment