Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # modified from https://gist.github.com/reillysiemens/ac6bea1e6c7684d62f544bd79b2182a4
- readonly hash_algo='sha256'
- readonly key='/var/lib/shim-signed/mok/MOK.priv'
- readonly x509='/var/lib/shim-signed/mok/MOK.der'
- readonly name="$(basename $0)"
- readonly esc='\033'
- readonly reset="${esc}[0m"
- red() { local string="${1}"; echo -e "${esc}[0;31m${string}${reset}"; }
- green() { local string="${1}"; echo -e "${esc}[0;32m${string}${reset}"; }
- blue() { local string="${1}"; echo -e "${esc}[0;34m${string}${reset}"; }
- log() { local string="${1}"; echo -e "[$(blue $name)] ${string}"; }
- [ -z "${KBUILD_SIGN_PIN}" ] && read -sp "Passphrase for ${key}: " KBUILD_SIGN_PIN && echo
- export KBUILD_SIGN_PIN
- for module in $(dirname $(modinfo -n vboxdrv))/*.ko; do
- log "Signing $(green ${module})..."
- /usr/src/kernels/$(uname -r)/scripts/sign-file "${hash_algo}" "${key}" "${x509}" "${module}"
- modprobe -v "$(basename ${module} .ko)" \
- && log "Loaded $(green $(basename ${module} .ko))" \
- || log "Unable to load $(red $(basename ${module} .ko))"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement