This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/fish | |
while true | |
set resp (inotifywait /run/systemd/ask-password -e moved_to) | |
set file = (string split ' ' $resp) | |
set pfile "/run/systemd/ask-password/$file[4]" | |
if grep "$CHALLENGE_KEY" $pfile >/dev/null | |
set socket (grep -i socket $pfile | sed s/socket=//i) | |
set ticket (oathtool -b --totp "$OTP_KEY") | |
echo socket "$socket" | |
echo "$ticket" | /lib/systemd/systemd-reply-password 1 "$socket" |