fix: daily report active users count matches who sessions (2.1.5-SAC)

Include local/console who lines; active_count from session list not raw who line count.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-23 14:41:52 +10:00
parent c96e870542
commit de61c6c771
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ IFS=$'\n\t'
# ============================================ # ============================================
CONFIG_FILE="/etc/ssh-monitor.conf" CONFIG_FILE="/etc/ssh-monitor.conf"
SSH_MONITOR_VERSION="2.1.4-SAC" SSH_MONITOR_VERSION="2.1.5-SAC"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/sac-client.sh" ]; then if [ -f "$SCRIPT_DIR/sac-client.sh" ]; then
@@ -1234,7 +1234,6 @@ get_active_ssh_sessions() {
local line user tty login_time ip local line user tty login_time ip
while IFS= read -r line; do while IFS= read -r line; do
[[ -z "$line" ]] && continue [[ -z "$line" ]] && continue
[[ "$line" != *"("* ]] && continue
user=$(awk '{print $1}' <<<"$line") user=$(awk '{print $1}' <<<"$line")
tty=$(awk '{print $2}' <<<"$line") tty=$(awk '{print $2}' <<<"$line")
login_time=$(awk '{print $3, $4}' <<<"$line") login_time=$(awk '{print $3, $4}' <<<"$line")
@@ -1766,7 +1765,8 @@ send_daily_report() {
local active_sessions local active_sessions
active_sessions=$(get_active_ssh_sessions) active_sessions=$(get_active_ssh_sessions)
local active_count local active_count
active_count=$(who 2>/dev/null | grep -c "." || echo "0") active_count=$(printf '%s' "$active_sessions" | grep -c '👤' || true)
active_count=${active_count:-0}
local active_bans=0 local active_bans=0
local ban_line local ban_line
+1 -1
View File
@@ -1 +1 @@
2.1.4-SAC 2.1.5-SAC