This kind of functionality is far too advanced for GRUB. GRUB can't even talk over the network except for TFTP.
The SSH server that you saw runs under Linux. It is started early during the boot process, after the kernel has booted but before mounting the root filesystem. Linux runs programs from the initramfs (or initrd on older systems) before mounting the root filesystem; that's how you get a password prompt on the console when the root filesystem is encrypted, for example.
Initramfs typically have a set of BusyBox utilities. BusyBox can't send mail, but suggests the ssmtp utility as a companion for this task. You'll need to build a statically compiled version.
An alternative approach could be to install the dropbear client and send the email (or other form of notification) from another machine. You can use the command=
directive in an authorized_keys
file to restrict the use of a key to one specific command.
Yet another approach, if the machine is on a network segment which is protected from intrusion, could be to ping a dedicated port, or “port knock” some sequence, or send a ping with some constant payload.
noauto
filesystem. At that point you can just ssh in and mount the encrypted filesystem in much the same way as you're wanting. You can even have amail
command insiderc.local
to send off that email. – Bratchley Jun 28 '14 at 23:25