initialer commit

This commit is contained in:
Jakobus Schürz 2018-12-11 09:32:36 +01:00
parent 5eaa0beab1
commit 0843464499
2 changed files with 40 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.der
*.priv

38
create_module_key.sh Executable file
View file

@ -0,0 +1,38 @@
#!/bin/sh
MOK=modules_signing
case $1 in
-h)
echo Usage create key-pair:
$0 -c
echo Usage sign modules:
$0 -s <modulename> [<modulename>] [<modulename>]...
shift
;;
-c)
shift
echo create key-pair for signing the modules
if [ -e $MOK.priv ] ;then
:
else
openssl req -new -x509 -newkey rsa:2048 -keyout $MOK.priv -outform DER -out $MOK.der -nodes -days 36500 -subj "/CN=Jakobus Schuerz/"
fi
sudo mokutil --import $MOK.der
;;
-s)
shift
echo "Sign kernel modules $(uname -r)"
for i in $@; do
echo sudo /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 ./$MOK.priv ./$MOK.der $(modinfo -n ${i})
sudo /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 ./$MOK.priv ./$MOK.der $(modinfo -n ${i})
done
;;
*)
echo "wrong option"
exit 1
esac