Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist: add sd-plymouth-tpm2-totp mkinitcpio hook #75

Merged
merged 1 commit into from
Dec 17, 2020

Conversation

diabonas
Copy link
Member

@diabonas diabonas commented Dec 15, 2020

mkinitcpio supports two different kinds of initramfs images: one with a busybox init (HOOKS=(base udev ...)) and one with a systemd init (HOOKS=(systemd sd-...)). Only the former supports the runtime hooks in dist/initcpio/hooks that we use to start show-/plymouth-tpm2-totp, the latter relies on system unit files to start programs.

This commit adds a new mkinitcpio hook sd-plymouth-tpm2-totp to be used for systemd-based mkinitcpio initramfs images. It adds a systemd service plymouth-tpm2-totp.service that triggers plymouth-tpm2-totp once Plymouth has been started and /dev/tpm0 is available. While the hook itself is specific to mkinitcpio, this service might be useful for other systemd-based initramfs generators as well.

Unlike the other currently available hooks, this service currently does not allow selecting a different NV index using the kernel command line. As far as I am aware, there is no built-in way to supply arguments from the kernel command line to systemd units, so the easiest approach might be parsing /proc/cmdline directly in plymouth-tpm2-totp. However, this feature is out of scope for this commit.

Closes: #74

mkinitcpio supports two different kinds of initramfs images: one with a busybox
init (HOOKS=(base udev ...)) and one with a systemd init (HOOKS=(systemd
sd-...)). Only the former supports the runtime hooks in dist/initcpio/hooks
that we use to start show-/plymouth-tpm2-totp, the latter relies on system unit
files to start programs.

This commit adds a new mkinitcpio hook "sd-plymouth-tpm2-totp" to be
used for systemd-based mkinitcpio initramfs images. It adds a systemd service
"plymouth-tpm2-totp.service" that triggers plymouth-tpm2-totp once Plymouth has
been started and /dev/tpm0 is available. While the hook itself is specific to
mkinitcpio, this service might be useful for other systemd-based initramfs
generators as well.

Unlike the other currently available hooks, this service currently does not
allow selecting a different NV index using the kernel command line. As far as I
am aware, there is no built-in way to supply arguments from the kernel command
line to systemd units, so the easiest approach might be parsing /proc/cmdline
directly in plymouth-tpm2-totp. However, this feature is out of scope for this
commit.

Signed-off-by: Jonas Witschel <diabonas@gmx.de>
@diabonas diabonas merged commit 9bcfdcb into tpm2-software:master Dec 17, 2020
@diabonas diabonas deleted the sd-plymouth-tpm2-totp branch December 17, 2020 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no OTP shown with sd-plymouth
1 participant