security-misc/usr/bin/faillock-user

38 lines
842 B
Plaintext
Raw Normal View History

#!/bin/bash
## Copyright (C) 2022 - 2022 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
## See the file COPYING for copying conditions.
2022-11-24 18:24:14 +07:00
true "$0: START PHASE 1"
if test -f /etc/pam-info-debug || test -f /usr/local/etc/pam-info-debug ; then
set -x
exec 5>&1 1>> ~/pam-info-debug.txt
exec 6>&2 2>> ~/pam-info-debug.txt
fi
true "$0: START PHASE 2"
if ! command -v "/usr/sbin/faillock" &>/dev/null; then
true "$0: ERROR: The faillock program is unavailable, exiting."
exit 2
fi
2022-11-24 18:31:24 +07:00
## Debugging.
who_ami="$(whoami)"
2022-11-24 18:31:24 +07:00
true "$0: who_ami: $who_ami"
true "$0: PAM_USER: $PAM_USER"
2022-11-24 18:25:47 +07:00
true "$0: SUDO_USER: $SUDO_USER"
2022-11-24 18:14:04 +07:00
if [ "$SUDO_USER" = "" ]; then
user_to_check="$who_ami"
else
user_to_check="$SUDO_USER"
fi
2022-11-24 18:49:15 +07:00
faillock --user "$user_to_check"
2022-11-24 18:49:15 +07:00
## Debugging.
## Explicit "exit $?" to have it recorded in the xtrace if enabled.
exit $?