unl0kr: ensure it runs on the same tty the session was initialized on

This commit is contained in:
2024-07-26 14:50:28 +00:00
parent f4df121e3d
commit d59380b4dd

View File

@@ -73,6 +73,10 @@ in
${lib.getExe' pkgs.inotify-tools "inotifywait"} --timeout 4 --event create --event delete /mnt/persist/private /run/gocryptfs ${lib.getExe' pkgs.inotify-tools "inotifywait"} --timeout 4 --event create --event delete /mnt/persist/private /run/gocryptfs
else else
echo "starting unl0kr" echo "starting unl0kr"
# switch back to the tty our session is running on (in case the user tabbed away after logging in),
# as only that TTY is sure to have echo disabled.
# this is racy, but when we race it's obvious from the UI that your password is being echo'd
${lib.getExe' pkgs.kbd "chvt"} ${builtins.toString cfg.config.vt}
unl0kr > /run/gocryptfs/private.key.incoming && unl0kr > /run/gocryptfs/private.key.incoming &&
cp /run/gocryptfs/private.key.incoming /run/gocryptfs/private.key cp /run/gocryptfs/private.key.incoming /run/gocryptfs/private.key
echo "unl0kr exited" echo "unl0kr exited"