delayed login alerts to prevent spam with mass logins

This commit is contained in:
Alex 2025-01-07 17:42:00 +03:00
parent 0e177210f6
commit b1b06b2e51
8 changed files with 100 additions and 7 deletions

View file

@ -4,8 +4,10 @@ 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
if [ "$SSH_ORIGINAL_COMMAND" = "internal-sftp" ] # command given, so run it
then
exec /usr/lib/ssh/sftp-server
elif [[ -n $SSH_ORIGINAL_COMMAND ]]; then
exec "$shell" -c "$SSH_ORIGINAL_COMMAND"
else # no command, so interactive login shell
exec "$shell" -il