Adding GRUB Env Variable for Integrity Checks
I’m currently developing a secure boot chain for my work. I’d like to utilize GRUB to boot into Linux where integrity checks will be performed, then if the filesystem is verified, change a custom GRUB environment variable flag which will allow the user to continue our boot into Windows.
My initial idea was led a bit astray as the emedded configuration doc is wrong, but I’ve been trying to persevere nonetheless. I found this StackOverflow thread suggesting a workaround is to embed a cfg file that uses `configfile` to call the “actual” file which contains the scripting and whatever else that I need. This is my process: 1. Create a grub image: Code:
$GRUBDIR/grub-mkimage \ Code:
$GRUBDIR/grub-install $DRIVE \ Embedded.cfg: Code:
configfile (memdisk)/grub.cfg Code:
load_env Grubenv: Code:
# GRUB Environment Block Code:
Booting from Hard Disk... To try and be ultimately clear: I want to create a GRUB environment variable named Clean. If Clean is true, I want to use /boot/grub/windows.cfg. If Clean is false, I want to use /boot/grub/linux.cfg. Clean will be initially set to false, forcing the user to boot into our Linux kernel that will then verify the integrity of the filesystem. If the filesystem is verified, I want Clean to be set to true (on next boot only) to allow the user to boot into Windows. If/once the system shuts down past this point, whether graceful or ungraceful, Clean should be false to force the user to verify the filesystem once more. I thoroughly feel like I’m missing one small detail for everything to fall into place, so if anyone has any advice, it would be greatly appreciated. Thanks so much |
1. Yes, I know, this is contrary to what GRUB documentation says, but all examples of grub.cfg I've seen use just = instead of ==, i.e.
Code:
if [ $Clean = "false" ]; then Code:
if [ "$Clean" = "false" ]; then 4. I suspect that Clean doesn't get set by load_env and is empty. Did you use grub-editenv* to change grubenv? ____ * On a Fedora/RHEL based system, the names of grub-* utilities would start with grub2- instead. |
All times are GMT -5. The time now is 01:17 AM. |