login alerts

This commit is contained in:
Alex 2025-01-07 02:52:19 +03:00
parent 3eb358d618
commit 0e177210f6
10 changed files with 85 additions and 5 deletions

12
wrappers/login_wrapper.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
mydir=$(dirname "$0")
sudo "$mydir/send_login_alert.sh"
shell=$(getent passwd $LOGNAME | cut -d: -f7)
if [[ -n $SSH_ORIGINAL_COMMAND ]] # command given, so run it
then
exec "$shell" -c "$SSH_ORIGINAL_COMMAND"
else # no command, so interactive login shell
exec "$shell" -il
fi

4
wrappers/send_login_alert.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
mydir=$(dirname "$0")
"$mydir/../.venv/bin/python" "$mydir/../send_login_alert.py"