Created
February 2, 2020 18:11
-
-
Save ElXreno/d68ff6bbbc16a9fe1e50032f48b30b88 to your computer and use it in GitHub Desktop.
Sign hook for secure boot
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
#!/usr/bin/bash | |
LOGPATH="/var/log/zz_sign" | |
LOGFILE="$LOGPATH/log-$(date).txt" | |
PUBLICKEYFILE="/home/user/Documents/UEFI/public_key.der" | |
PRIVATEKEYFILE="/home/user/Documents/UEFI/private_key.priv" | |
sign() { | |
if [ -f "$PUBLICKEYFILE" ]; then | |
if [ -f "$PRIVATEKEYFILE" ]; then | |
find "/usr/lib/modules/${1}/extra" -name "*.ko" -type f -exec /usr/src/kernels/${1}/scripts/sign-file sha256 "$PRIVATEKEYFILE" "$PUBLICKEYFILE" "{}" \; | |
else | |
echo "Private key file doesn't exists!" | |
exit 1 | |
fi | |
else | |
echo "Public key file doesn't exists!" | |
exit 1 | |
fi | |
} | |
if [ -d "$LOGPATH" ]; then | |
mkdir -p "$LOGPATH" | |
fi | |
sign $1 2>&1 | tee "$LOGFILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment