|
|
@ -11,7 +11,7 @@ URL="https://api.telegram.org/bot$KEY/sendMessage"
|
|
|
|
if [[ "$PAM_SERVICE" == "sshd" && "$PAM_TYPE" == "open_session" && "$PAM_USER" != "git" && -z "$TMUX" ]]; then
|
|
|
|
if [[ "$PAM_SERVICE" == "sshd" && "$PAM_TYPE" == "open_session" && "$PAM_USER" != "git" && -z "$TMUX" ]]; then
|
|
|
|
IP="$PAM_RHOST"
|
|
|
|
IP="$PAM_RHOST"
|
|
|
|
cache_file="${CACHE_DIR}/${IP}-${PAM_USER}"
|
|
|
|
cache_file="${CACHE_DIR}/${IP}-${PAM_USER}"
|
|
|
|
cache_mtime=$(stat --format="%Y" "$cache_file")
|
|
|
|
cache_mtime=$(stat --format="%Y" "$cache_file" 2>/dev/null)
|
|
|
|
current_time=$(date +%s)
|
|
|
|
current_time=$(date +%s)
|
|
|
|
touch "$cache_file"
|
|
|
|
touch "$cache_file"
|
|
|
|
if (( cache_mtime > (current_time - 4*60*60) )); then
|
|
|
|
if (( cache_mtime > (current_time - 4*60*60) )); then
|
|
|
|