wait for device to be connected

This commit is contained in:
shimunn 2019-09-19 22:53:17 +02:00
parent 2235fddb9a
commit 46bcc2f52a
Signed by: shimun
GPG Key ID: E81D8382DC2F971B
3 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,10 @@
[Unit]
Description=Wait for a FIDO2 device to be connected
[Service]
Type=oneshot
Environment=CON_MSG="Please connect your authenicator"
ExecStartPre=/usr/bin/plymouth display-message --text "${CON_MSG}"
ExecStart=/bin/bash -c 'while ! fido2luks connected; do sleep 1; done'
ExecStopPost=/usr/bin/plymouth hide-message --text "${CON_MSG}"

View File

@ -23,7 +23,7 @@ generate_service () {
printf -- "[Unit]"
printf -- "\nDescription=%s" "2fa for luks"
printf -- "\nBindsTo=%s" "$target_dev"
printf -- "\nAfter=%s cryptsetup-pre.target systemd-journald.socket" "$target_dev" #TODO: create service to wait or authenicator
printf -- "\nAfter=%s cryptsetup-pre.target fido2-connected.service systemd-journald.socket" "$target_dev" #TODO: create service to wait or authenicator
printf -- "\nBefore=%s umount.target luks-2fa.target" "$crypto_target_service"
printf -- "\nConflicts=umount.target"
printf -- "\nDefaultDependencies=no"

View File

@ -24,7 +24,10 @@ install () {
inst "$moddir/luks-2fa.target" "/etc/systemd/system/luks-2fa.target"
mkdir -p "$initdir/etc/systemd/system/luks-2fa.target.wants"
inst "$moddir/fido2-connected.service" "/etc/systemd/system/fido2-connected.service"
mkdir -p "$initdir/etc/systemd/system/sysinit.target.wants"
ln -sf "/etc/systemd/system/luks-2fa.target" "$initdir/etc/systemd/system/sysinit.target.wants/"
ln -sf "/etc/systemd/system/fido2-connected.service" "$initdir/etc/systemd/system/sysinit.target.wants/"
}