From 9ac0dca2f30b37a9de08e294d52ec9926fb376c0 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 4 Nov 2024 20:35:05 +0100 Subject: check yubikey if possible --- computer-time-limit | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/computer-time-limit b/computer-time-limit index a3a05cb..00d4c86 100755 --- a/computer-time-limit +++ b/computer-time-limit @@ -40,8 +40,21 @@ wie_lange_noch() { ab=$(date +%s) return fi + home=$(getent passwd "$1" | cut -d: -f6) + if [ -d "${home}" ]; then + cd "${home}" + if [ -f '.shared_secret' ] \ + && [ -f '/usr/src/skripte/ykverify/verify.py' ] \ + && ! '/usr/src/skripte/ykverify/verify.py'; then + noch=0 + ab=$(date +%s) + cd - + return + fi + cd - + fi erg=$( - sende_msg start "$1" + sende_msg start "$2" ) if [ -n "${erg}" ] && ! echo "${erg}" | grep -qvx '[0-9]\+'; then noch="${erg}" @@ -119,7 +132,7 @@ while true; do for user in "${!keys[@]}"; do key="${keys["${user}"]}" if is_logged_in "${user}"; then - wie_lange_noch "${key}" + wie_lange_noch "${user}" "${key}" check_time "${user}" "${key}" else sende_msg stop "${key}" >/dev/null -- cgit v1.2.3-70-g09d2