Skip to content

asks the user for a password on the framebuffer showing the firmware image

License

Notifications You must be signed in to change notification settings

gdamjan/fb-ask-pass-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Primary usage: run it from a initcpio hook (on archlinux) to ask for the LUKS passphrase, while showing the firmware picture. The passphrase is saved in a file (/crypto_keyfile.bin) which the encrypt hook uses to unlock LUKS volumes.

The kernel parameters I use are:

quiet udev.log_priority=3 loglevel=3 vt.global_cursor_default=0 i915.fastboot=1

Arch initcpio configuration (/etc/mkinitcpio.conf):

HOOKS=(base udev autodetect block fb-ask-pass encrypt filesystems)

For testing, in a console you can just run:

sudo chown `id -u` /dev/fb0
cargo run

and it'll show whatever you type on the terminal. It won't work in X11 or wayland.

see also:

FAQ

Why Rust?

  • It's a learning experience
  • Rust compiles to a single binary, depends only on glibc

How does it work?

  • the program reads the firmware image provided by ACPI 5.0 from /sys/firmware/acpi/bgrt/* and displays it on the framebuffer at the same position (xoffset, yoffset).
    • afaik, UEFI needs to be enabled. probably quick boot, and full resolution booting too.
  • then waits for the user to enter its password, and writes it to a file.
  • look in arch/ to see how to integrate with archlinux's initcpio system.

What is BGRT?

the TL;DR; it's the image/logo that the BIOS shows when powering up the PC. The ACPI 5.0 standard allows access to the image by OS. Please read the kernel documentation about the /sys/firmware/acpi/bgrt interface.

Why not plymouth?

  • Yes, Plymouth is probably the better solution. It has much more features and is much better tested.
  • For example, plymouth stays in control for the whole boot process, and gives out control only before X11/lgoin manager takes over. This program instead, leaves the console in static graphic mode with the image, making it fairly useless.
  • This is just a very simple experiment.

TODO

  • some kind of password prompt, and some feedback
  • see how to integrate with Dracut and/or other distros
  • probably by using the keyring interface