SHARE
TWEET

Untitled

a guest Jul 20th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. readonly hash_algo='sha256'
  4. readonly key='/root/module-signing/MOK.priv'
  5. readonly x509='/root/module-signing/MOK.der'
  6.  
  7. readonly name="$(basename $0)"
  8. readonly esc='\\e'
  9. readonly reset="${esc}[0m"
  10.  
  11. green() { local string="${1}"; echo "${esc}[32m${string}${reset}"; }
  12. blue() { local string="${1}"; echo "${esc}[34m${string}${reset}"; }
  13. log() { local string="${1}"; echo "[$(blue $name)] ${string}"; }
  14.  
  15. # The exact location of `sign-file` might vary depending on your platform.
  16. alias sign-file="/usr/src/kernels/$(uname -r)/scripts/sign-file"
  17.  
  18. [ -z "${KBUILD_SIGN_PIN}" ] && read -p "Passphrase for ${key}: " KBUILD_SIGN_PIN
  19.  
  20. for module in $(dirname $(modinfo -n vboxdrv))/*.ko; do
  21.   log "Signing $(green ${module})..."
  22.   sign-file "${hash_algo}" "${key}" "${x509}" "${module}"
  23. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top