yubilock

Lock X when YubiKey is detached (OpenBSD)
git clone _git@git.zakaria.org/yubilock.git
Log | Files | Refs | README | LICENSE

commit 42a36c2980e0b2bfd5c482e227ec913d923be347
parent 0e969d2e34cdad00212e4d034786d4ba4302d73e
Author: zakaria <e-zk@users.noreply.github.com>
Date:   Tue, 11 Jan 2022 00:05:15 +1000

Fix lock_cmd + arguments not working

Diffstat:
Mdetach | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/detach b/detach @@ -18,9 +18,10 @@ # user to run xlock command as ((change this)) xuser=zzz # lock command to run -lock_cmd='xlock +description -info "KEY DETACHED"' +lock_cmd=/usr/X11R6/bin/xlock +lock_cmd_args="-bg darkred -info DETACHED" # primary X11 display -DISPLAY=:0 +export DISPLAY=:0 # event = {attach, detach} # class = device class [0-5] @@ -32,7 +33,7 @@ name="$2" # uncomment to log all detach events to syslog #logger -t "$event" "${class}:${name}" -# if event is a 'fido' any device being detached... +# if event is a 'fido' device being detached... if [ "$event" = "detach" ]; then case "$name" in fido[0-9]) @@ -40,8 +41,8 @@ if [ "$event" = "detach" ]; then logger -t "$event" "fido key detached - locking" # actually lock display now - export DISPLAY - doas -u $xuser "$lock_cmd" & + export DISPLAY=$DISPLAY + doas -n -u "$xuser" "$lock_cmd" ${lock_cmd_args} ;; esac fi