Documentation
¶
Overview ¶
SPDX-License-Identifier: MPL-2.0 Copyright (c) 2025 Antonios Voulvoulis <contact@nftban.com>
Package banlog provides centralized ban logging for NFTBan All ban actions (from any source) should log here for stats tracking
meta:name="banlog" meta:type="package" meta:description="Central ban logging with audit trail support" meta:inventory.files="/var/log/nftban/bans.log" meta:inventory.binaries="" meta:inventory.env_vars="" meta:inventory.config_files="/etc/nftban/nftban.conf" meta:inventory.systemd_units="" meta:inventory.network="" meta:inventory.privileges="write:/var/log/nftban/"
Index ¶
Constants ¶
const ( SourceManual = "manual" SourceLogin = "login" SourcePortscan = "portscan" SourceDDoS = "ddos" SourceFeeds = "feeds" SourceSuricata = "suricata" SourceFail2ban = "fail2ban" // Legacy compatibility )
Source constants for ban log entries
const ( StatusBanned = "BANNED" StatusUnbanned = "UNBANNED" )
Status constants
Variables ¶
This section is empty.
Functions ¶
func LogBan ¶
LogBan writes a ban entry to the central ban.log Parameters:
- ip: IP address being banned
- source: Ban source (manual, login, portscan, ddos, feeds, suricata)
- country: Country code (e.g., "US", "CN", "UNK" if unknown)
Format: DATE|TIME|SOURCE|IP|COUNTRY|BANNED|REASON (reason empty for this func) Use LogBanWithReason for audit trail with reason
func LogBanWithReason ¶
LogBanWithReason writes a ban entry with a reason for audit trail Format: DATE|TIME|SOURCE|IP|COUNTRY|BANNED|REASON
func LogUnban ¶
LogUnban writes an unban entry to the central ban.log Parameters:
- ip: IP address being unbanned
- source: Unban source (usually "manual")
- country: Country code
Format: DATE|TIME|SOURCE|IP|COUNTRY|UNBANNED
func LogUnbanWithReason ¶ added in v1.5.0
LogUnbanWithReason writes an unban entry with a reason for audit trail Format: DATE|TIME|SOURCE|IP|COUNTRY|UNBANNED|REASON
Types ¶
This section is empty.