tpm2-software / tpm2-totp

Attest the trustworthiness of a device against a human using time-based one-time passwords
https://tpm2-software.github.io
BSD 3-Clause "New" or "Revised" License
163 stars 36 forks source link

Add plymouth integration #23

Closed diabonas closed 5 years ago

diabonas commented 5 years ago

This PR adds a binary plymouth-tpm2-totp that calculates the TOTP and displays it as a plymouth message. Depending on the theme, this will look somewhat like this (the password prompt is for the disk encryption):

Plymouth boot splash with TOTP and disk encryption password prompt

The application is intended to be installed and run in the background in the initial ramdisk and will automatically exit when plymouth is stopped after booting is complete.

One plymouth message with the TOTP is displayed when the application is started, after that a new message is displayed after each full 30 seconds when the TOTP changes. If there are other plymouth messages, these will overwrite the TOTP. Since this usually only happens if there are errors during boot, the user will probably want to see these instead of the TOTP.

There are also some integration tests with the plymouth daemon. They check whether plymouth-tpm2-totp is successfully able to send messages to the daemon and if it exits with the correct status if plymouth quits or the TOTP calculation fails.

Also included are mkinitpio hooks to add the binary to the initial ramdisk and start it in the background. They replace the already existing hooks on systems with plymouth installed.

I have successfully been testing this PR on my own computer for the last week.

Closes #5.

codecov[bot] commented 5 years ago

Codecov Report

Merging #23 into master will decrease coverage by 0.07%. The diff coverage is 77.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #23      +/-   ##
==========================================
- Coverage   80.53%   80.46%   -0.08%     
==========================================
  Files           4        5       +1     
  Lines         745      819      +74     
==========================================
+ Hits          600      659      +59     
- Misses        145      160      +15
Impacted Files Coverage Δ
src/plymouth-tpm2-totp.c 77.02% <77.02%> (ø)
src/tpm2-totp.c 82.03% <0%> (+0.97%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ac23908...f20c5e0. Read the comment docs.