Skip to contentSkip to conversation

Grub Scripting

DISCUSSION Chris Umphress 5 participants 7 messages May 8, 2009

lore
Share & tools
lore
#0 lore raw

Hey,

We have some computers that need a boot loader to self-destruct at the end of a school year. In order to accomplish this we would like to use Grub scripting. From what I have been able to find, the support is incomplete and we would have to write the code to self-destruct somehow.

What is required to get the scripting engine functional enough? I should be able to dedicate a couple days to this. Granted, that isn't much but I'm hoping it will be enough.

Thanks!

Signature · 1 line
Chris Umphress <http://www.epicvoyage.org>
#1 lore raw
Quoted 8 lines · Chris Umphress

Hey,

We have some computers that need a boot loader to self-destruct at the end of a school year. In order to accomplish this we would like to use Grub scripting. From what I have been able to find, the support is incomplete and we would have to write the code to self-destruct somehow.

Why do you need this? Remember that destroying bootloader leaves all the data intact. Furthermore it looks like that your goal is to restrict a legitimate freedom. I can't be sure of it since I don't know more details but don't expect us to help you to restrict freedom.

Quoted 16 lines

What is required to get the scripting engine functional enough? I should be able to dedicate a couple days to this. Granted, that isn't much but I'm hoping it will be enough.

Thanks!

--
Chris Umphress <http://www.epicvoyage.org>

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#2 lore raw
Quoted 6 lines · Vladimir 'phcoder' Serbinenko

On Fri, May 8, 2009 at 9:48 AM, Chris Umphress <[email protected]> wrote:
Hey,

Quoted 14 lines

We have some computers that need a boot loader to self-destruct at the
end of a school year. In order to accomplish this we would like to use
Grub scripting. From what I have been able to find, the support is
incomplete and we would have to write the code to self-destruct
somehow.
Why do you need this? Remember that destroying bootloader leaves all the data intact. Furthermore it looks like that your goal is to restrict a legitimate freedom. I can't be sure of it since I don't know more details but don't expect us to help you to restrict freedom.

It does not only leave all the data intact, but also most computers nowadays allow selecting the boot device with a key press on boot, plus booting from USB drives and/or memory cards. Put those things together and your scheme becomes useless. I think it's way simpler to just lock the computer room at the end of the school year.

The opposite extreme would be to implement an actual hard drive nuking at the end of the school year (with DBAN for example, www.dban.org), which would not be that much of a problem if your computers are similar enough to keep just a handful of disk images handy to restore them to life next September. However, implementing a self-destruct scheme would, even if possible, be risky - just suppose that the BIOS date gets somehow changed: bang! you're dead.

Signature · 1 line
-- Lazy, Oblivious, Recurrent Disaster -- Habbit
#3 lore raw
In reply to Chris Umphress
Quoted 7 lines · Chris Umphress

Hey,

We have some computers that need a boot loader to self-destruct at the end of a school year. In order to accomplish this we would like to use Grub scripting. From what I have been able to find, the support is incomplete and we would have to write the code to self-destruct somehow.

I can think of a couple ways to do what you say:

- if there is a date/time command in GRUB, have the grub.cfg check the date and refuse to offer any booting options after that date (where I suppose the hardware-clock supplies that date)

- alternatively to "not booting", you could have it boot DBAN which will erase everything on all disks :-)

Or have a human manually boot the self-destruct option (which should require an administrator password probably)

(how do you expect to re-use these computers, if they have a nonfunctional boot-loader, by the way?)

-Isaac

#4 lore raw
Quoted 5 lines · Isaac Dupree

I can think of a couple ways to do what you say:

- if there is a date/time command in GRUB, have the grub.cfg check the date and refuse to offer any booting options after that date (where I suppose the hardware-clock supplies that date)

I was told by Mr. Gerards that he thought support for querying the date/time from the system BIOS was already implemented for scripting purposes. Even if it weren't, I have queried information directly before -- back when QuickBASIC was in wider use.

Quoted 2 lines

- alternatively to "not booting", you could have it boot DBAN which will erase everything on all disks :-)

We don't want to destroy the entire system but are considering the destruction of the partition table (after creating a backup). Slightly complicated, yes, but we do need the data on these systems to be accessible for us to recover.

Quoted 5 lines

Or have a human manually boot the self-destruct option (which should require an administrator password probably)

(how do you expect to re-use these computers, if they have a nonfunctional boot-loader, by the way?)

We'll overwrite the boot loader and restore the partition table if it was destroyed. That would be handled from a custom, bootable live-CD or thumbdrive. This is going to be used on laptops that are lent out and it is one more way that we can try to force people to return them without sending the police out. This is why we need it automated.

If they do something silly to their system clock, we'll have to have them bring it in. It might be possible to lock the system BIOS, depending on what others decide the users need to be able to do.

Yes, we are relying on the inexperience of most of the students. We intend to have a backup method in Windows to restore the boot loader should it be changed.

Hopefully this explains our reasoning a little better.

Quoted 1 line

-Isaac

Signature · 1 line
Chris Umphress <http://www.epicvoyage.org>
#5 lore raw

Chris Umphress wrote on Friday 08 May 2009:

Quoted 5 lines

We'll overwrite the boot loader and restore the partition table if it was destroyed. That would be handled from a custom, bootable live-CD or thumbdrive. This is going to be used on laptops that are lent out and it is one more way that we can try to force people to return them without sending the police out. This is why we need it automated.

It seems like just disabling the GRUB boot menu entries would be a better method than actually wiping the MBR/partition table/etc. A somewhat robust way (so that it's not trivial for a user to set back the BIOS date after the system has locked them out) would be to set a flag in the GRUB boot partition that indicates the system is to be locked down. Then whenever that flag is set, instead of using the normal boot setup, your GRUB script displays a message to the user like "Your usage period of this computer has expired. Please return it to [your org. here]."

Regards,
Colin

#6 lore raw
Quoted 7 lines · Colin D Bennett

Chris Umphress wrote on Friday 08 May 2009:

Quoted 5 lines

We'll overwrite the boot loader and restore the partition table if it was destroyed. That would be handled from a custom, bootable live-CD or thumbdrive. This is going to be used on laptops that are lent out and it is one more way that we can try to force people to return them without sending the police out. This is why we need it automated.

Quoted 8 lines

It seems like just disabling the GRUB boot menu entries would be a better method than actually wiping the MBR/partition table/etc.  A somewhat robust way (so that it's not trivial for a user to set back the BIOS date after the system has locked them out) would be to set a flag in the GRUB boot partition that indicates the system is to be locked down.  Then whenever that flag is set, instead of using the normal boot setup, your GRUB script displays a message to the user like "Your usage period of this computer has expired. Please return it to [your org. here]."

That would be a simpler solution. By destroying the partition table we are ensuring that a Windows XP CD with the "fixmbr" command won't return the system to working order. A lot of kids are clever enough to pull that off.

It is a slippery slope for how much is too much work for the actual results.

Signature · 1 line
Chris Umphress <http://www.epicvoyage.org>