2024-05-30 01:42:30 +01:00
|
|
|
#!/bin/bash
|
|
|
|
echo "[*] Preparing to sign!";
|
|
|
|
#touch /dev/shm/sb-passpwd.txt;
|
|
|
|
#chown root:root /dev/shm/sb-passpwd.txt;
|
|
|
|
#chmod u=rw,g=,o= /dev/shm/sb-passpwd.txt;
|
|
|
|
#echo -n "Password: ";
|
|
|
|
#read -s pwd;
|
|
|
|
#echo -n "$pwd" > /dev/shm/sb-passpwd.txt;
|
|
|
|
echo "[-] BMOK Un-Signing...";
|
2024-05-31 23:28:25 +01:00
|
|
|
for i in $(/usr/bin/find /boot/grub -iname "*.efi" -type f -print)
|
2024-05-30 01:42:30 +01:00
|
|
|
do
|
|
|
|
echo $i;
|
2024-05-31 23:28:25 +01:00
|
|
|
/usr/bin/sbattach --remove $i;
|
2024-05-30 01:42:30 +01:00
|
|
|
done;
|
|
|
|
echo "[+] BMOK Signing...";
|
2024-05-31 23:28:25 +01:00
|
|
|
for i in $(/usr/bin/find /boot/grub -iname "*.efi" -type f -print)
|
2024-05-30 01:42:30 +01:00
|
|
|
do
|
|
|
|
echo $i;
|
2024-05-31 23:28:25 +01:00
|
|
|
/usr/bin/sbsign --key /cert/BMOK.priv --cert /cert/BMOK.pem $i --output $i;
|
2024-05-30 01:42:30 +01:00
|
|
|
done;
|
|
|
|
echo "[-] Un-Signing...";
|
|
|
|
#-iname "efi" -prune -o
|
2024-05-31 23:28:25 +01:00
|
|
|
for i in $(/usr/bin/find /boot -iname "*.sig" -type f -print)
|
2024-05-30 01:42:30 +01:00
|
|
|
do
|
|
|
|
rm "$i";
|
|
|
|
done;
|
|
|
|
echo "[+] Signing...";
|
2024-06-04 14:44:43 +01:00
|
|
|
for i in $(/usr/bin/find /boot -iname "efi" -prune -o -iname "grubenv" -prune -o -iname "boot-tainted" -prune -o -type f -print)
|
2024-05-30 01:42:30 +01:00
|
|
|
do
|
|
|
|
echo $i;
|
2024-05-31 23:28:25 +01:00
|
|
|
/usr/bin/gpg --batch --detach-sign $i;
|
2024-05-30 01:42:30 +01:00
|
|
|
#gpg -v --batch --detach-sign --passphrase-fd 0 $i < \
|
|
|
|
# /dev/shm/sb-passpwd.txt;
|
|
|
|
done;
|
2024-06-04 14:44:43 +01:00
|
|
|
for i in $(/usr/bin/find /boot/efi -iname "*.cfg" -type f -o -iname "*.efi" -type f -print)
|
|
|
|
do
|
|
|
|
echo $i;
|
|
|
|
/usr/bin/gpg --batch --detach-sign $i;
|
|
|
|
done;
|
2024-05-30 01:42:30 +01:00
|
|
|
#shred /dev/shm/sb-passpwd.txt;
|
|
|
|
echo "[*] Signing Complete!";
|