summaryrefslogtreecommitdiffstats
path: root/udev/ykfde
blob: e3fec3db542b347508157fc8ac5cb4d496647c4a (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

source /etc/ykfde.conf

# Looks like Yubikey is reset after challenge response, triggering
# yet another add event. Ignore if the file exists.
[ -s /crypto_keyfile.bin ] && exit 0

# write the response to keyfile
ykchalresp -${YKFDE_SLOT:-2} "$(cat /ykfde-challenge)" | tr -d '\n' > /crypto_keyfile.bin 2>/dev/null

# if the systemd unit was faster try to answer password agent
for REQUEST in $(grep -l '^Message=Please give passphrase for disk' /run/systemd/ask-password/ask.*); do
	/usr/lib/systemd/systemd-reply-password 1 $(grep '^Socket=' ${REQUEST} | cut -d= -f2) < /crypto_keyfile.bin
done