mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-11 13:47:05 +02:00
fixed recurring IPs now only count bans, not unbans
This commit is contained in:
@@ -669,7 +669,7 @@ func CountBanEventsByIP(ctx context.Context, ip, serverID string) (int64, error)
|
|||||||
query := `
|
query := `
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM ban_events
|
FROM ban_events
|
||||||
WHERE ip = ?`
|
WHERE ip = ? AND (event_type = 'ban' OR event_type IS NULL)`
|
||||||
args := []any{ip}
|
args := []any{ip}
|
||||||
|
|
||||||
if serverID != "" {
|
if serverID != "" {
|
||||||
@@ -743,7 +743,7 @@ func ListRecurringIPStats(ctx context.Context, since time.Time, minCount, limit
|
|||||||
query := `
|
query := `
|
||||||
SELECT ip, COALESCE(country, '') AS country, COUNT(*) AS cnt, MAX(occurred_at) AS last_seen
|
SELECT ip, COALESCE(country, '') AS country, COUNT(*) AS cnt, MAX(occurred_at) AS last_seen
|
||||||
FROM ban_events
|
FROM ban_events
|
||||||
WHERE ip != ''`
|
WHERE ip != '' AND (event_type = 'ban' OR event_type IS NULL)`
|
||||||
args := []any{}
|
args := []any{}
|
||||||
|
|
||||||
if serverID != "" {
|
if serverID != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user