persistent

package
v1.0.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToPersistentOffenders

func AddToPersistentOffenders(confPath, ip, reason string) error

AddToPersistentOffenders adds an IP to the persistent offenders config file

func CountRecentBans

func CountRecentBans(logPath, ip string, period time.Duration) (int, error)

CountRecentBans counts how many times an IP was banned in the given period

func LogPersistentOffender

func LogPersistentOffender(logPath, ip, jail string, banCount int) error

LogPersistentOffender logs to persistent-offenders.log

func LogTempBan

func LogTempBan(logPath, ip, jail, reason string) error

LogTempBan logs a temporary ban to the tracking file for escalation tracking This tracks temp bans to detect persistent offenders who should be escalated

Types

type BanEntry

type BanEntry struct {
	Timestamp time.Time
	IP        string
	Jail      string
	Reason    string
}

BanEntry represents a ban logged in bans.log (v1.0: removed fail2ban prefix)

type Config

type Config struct {
	GlobalThreshold int
	GlobalPeriod    time.Duration
	GlobalAction    string
	Enabled         bool

	BanLog        string
	OffendersLog  string
	OffendersConf string

	// Per-filter thresholds (v1.0: renamed from jail)
	Filters map[string]*FilterConfig
}

Config holds persistent offender configuration

func LoadConfig

func LoadConfig(configDir string) (*Config, error)

LoadConfig loads persistent offender configuration from files Removed: fail2ban.conf references (v1.0 migration to Suricata) .local settings override defaults

func (*Config) GetFilterConfig

func (c *Config) GetFilterConfig(filterName string) *FilterConfig

GetFilterConfig returns configuration for a specific filter (v1.0: renamed from GetJailConfig) If filter not found, returns global defaults

type FilterConfig

type FilterConfig struct {
	Name      string
	Threshold int
	Period    time.Duration
	Action    string
	Comment   string
}

FilterConfig holds configuration for a specific filter (v1.0: renamed from JailConfig)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL