mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-19 06:53:14 +02:00
Added new clear function-calls for the recent-stored-events and as well the permanent-block list
This commit is contained in:
@@ -878,6 +878,18 @@ WHERE 1=1`
|
||||
return result, rows.Err()
|
||||
}
|
||||
|
||||
// Deletes all ban event records.
|
||||
func ClearBanEvents(ctx context.Context) (int64, error) {
|
||||
if db == nil {
|
||||
return 0, errors.New("storage not initialised")
|
||||
}
|
||||
res, err := db.ExecContext(ctx, `DELETE FROM ban_events`)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return res.RowsAffected()
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Recurring IP Statistics
|
||||
// =========================================================================
|
||||
@@ -1263,3 +1275,15 @@ func IsPermanentBlockActive(ctx context.Context, ip, integration string) (bool,
|
||||
}
|
||||
return rec.Status == "blocked", nil
|
||||
}
|
||||
|
||||
// Deletes all permanent block records.
|
||||
func ClearPermanentBlocks(ctx context.Context) (int64, error) {
|
||||
if db == nil {
|
||||
return 0, errors.New("storage not initialised")
|
||||
}
|
||||
res, err := db.ExecContext(ctx, `DELETE FROM permanent_blocks`)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return res.RowsAffected()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user