web

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdvancedActionsTestHandler added in v1.2.7

func AdvancedActionsTestHandler(c *gin.Context)

AdvancedActionsTestHandler allows manual block/unblock tests.

func ApplyFail2banSettings

func ApplyFail2banSettings(jailLocalPath string) error

ApplyFail2banSettings updates /etc/fail2ban/jail.local [DEFAULT] with our JSON

func BanIPHandler added in v1.2.8

func BanIPHandler(c *gin.Context)

BanIPHandler bans a given IP in a specific jail.

func BanInsightsHandler added in v1.2.7

func BanInsightsHandler(c *gin.Context)

BanInsightsHandler returns aggregate stats for countries and recurring IPs.

func BanNotificationHandler

func BanNotificationHandler(c *gin.Context)

BanNotificationHandler processes incoming ban notifications from Fail2Ban.

func BanStatisticsHandler added in v1.2.7

func BanStatisticsHandler(c *gin.Context)

BanStatisticsHandler returns aggregated ban counts per server.

func CreateFilterHandler added in v1.2.7

func CreateFilterHandler(c *gin.Context)

CreateFilterHandler creates a new filter.

func CreateJailHandler added in v1.2.7

func CreateJailHandler(c *gin.Context)

CreateJailHandler creates a new jail.

func DeleteFilterHandler added in v1.2.7

func DeleteFilterHandler(c *gin.Context)

DeleteFilterHandler deletes a filter.

func DeleteJailHandler added in v1.2.7

func DeleteJailHandler(c *gin.Context)

DeleteJailHandler deletes a jail.

func DeleteServerHandler added in v1.2.7

func DeleteServerHandler(c *gin.Context)

DeleteServerHandler removes a server configuration.

func GetJailFilterConfigHandler

func GetJailFilterConfigHandler(c *gin.Context)

GetJailFilterConfigHandler returns both the filter config and jail config for a given jail

func GetSettingsHandler

func GetSettingsHandler(c *gin.Context)

GetSettingsHandler returns the entire AppSettings struct as JSON

func HandleBanNotification

func HandleBanNotification(ctx context.Context, server config.Fail2banServer, ip, jail, hostname, failures, whois, logs string) error

HandleBanNotification processes Fail2Ban notifications, checks geo-location, stores the event, and sends alerts.

func HandleUnbanNotification added in v1.2.7

func HandleUnbanNotification(ctx context.Context, server config.Fail2banServer, ip, jail, hostname, whois, country string) error

HandleUnbanNotification processes Fail2Ban unban notifications, stores the event, and sends alerts.

func IndexHandler

func IndexHandler(c *gin.Context)

IndexHandler serves the HTML page

func ListBanEventsHandler added in v1.2.7

func ListBanEventsHandler(c *gin.Context)

ListBanEventsHandler returns stored ban events from the internal database.

func ListFiltersHandler

func ListFiltersHandler(c *gin.Context)

ListFiltersHandler returns a JSON array of filter names found as *.conf in /etc/fail2ban/filter.d

func ListPermanentBlocksHandler added in v1.2.7

func ListPermanentBlocksHandler(c *gin.Context)

ListPermanentBlocksHandler exposes the permanent block log.

func ListSSHKeysHandler added in v1.2.7

func ListSSHKeysHandler(c *gin.Context)

ListSSHKeysHandler returns SSH keys available on the UI host.

func ListServersHandler added in v1.2.7

func ListServersHandler(c *gin.Context)

ListServersHandler returns configured Fail2ban servers.

func LoginAuth

func LoginAuth(username, password string) smtp.Auth

func ManageJailsHandler added in v1.2.7

func ManageJailsHandler(c *gin.Context)

ManageJailsHandler returns a list of all jails (from jail.local and jail.d) including their enabled status.

func RegisterRoutes

func RegisterRoutes(r *gin.Engine, hub *Hub)

RegisterRoutes sets up the routes for the Fail2ban UI.

func RestartFail2banHandler added in v1.2.7

func RestartFail2banHandler(c *gin.Context)

RestartFail2banHandler reloads the Fail2ban service

func SetDefaultServerHandler added in v1.2.7

func SetDefaultServerHandler(c *gin.Context)

SetDefaultServerHandler marks a server as default.

func SetJailFilterConfigHandler

func SetJailFilterConfigHandler(c *gin.Context)

SetJailFilterConfigHandler overwrites both the filter config and jail config with new content

func SetWebSocketHub added in v1.2.7

func SetWebSocketHub(hub *Hub)

SetWebSocketHub sets the global WebSocket hub instance

func SummaryHandler

func SummaryHandler(c *gin.Context)

SummaryHandler returns a JSON summary of all jails, including number of banned IPs, how many are new in the last hour, etc.

func TestEmailHandler

func TestEmailHandler(c *gin.Context)

******************************************************************* * TestEmailHandler to send test-mail : * *******************************************************************

func TestFilterHandler

func TestFilterHandler(c *gin.Context)

func TestLogpathHandler added in v1.2.7

func TestLogpathHandler(c *gin.Context)

TestLogpathHandler tests a logpath and returns matching files Resolves Fail2Ban variables before testing Accepts optional logpath in request body, otherwise reads from saved jail config

func TestServerHandler added in v1.2.7

func TestServerHandler(c *gin.Context)

TestServerHandler verifies connectivity to a configured Fail2ban server.

func UnbanIPHandler

func UnbanIPHandler(c *gin.Context)

UnbanIPHandler unbans a given IP in a specific jail.

func UnbanNotificationHandler added in v1.2.7

func UnbanNotificationHandler(c *gin.Context)

UnbanNotificationHandler processes incoming unban notifications from Fail2Ban.

func UpdateJailManagementHandler added in v1.2.7

func UpdateJailManagementHandler(c *gin.Context)

After updating, fail2ban is reloaded to apply the changes.

func UpdateSettingsHandler

func UpdateSettingsHandler(c *gin.Context)

UpdateSettingsHandler updates the AppSettings from a JSON body

func UpsertServerHandler added in v1.2.7

func UpsertServerHandler(c *gin.Context)

UpsertServerHandler creates or updates a Fail2ban server configuration.

func WebSocketHandler added in v1.2.7

func WebSocketHandler(hub *Hub) gin.HandlerFunc

WebSocketHandler is the Gin handler for WebSocket connections

Types

type Client added in v1.2.7

type Client struct {
	// contains filtered or unexported fields
}

Client represents a WebSocket connection

type Hub added in v1.2.7

type Hub struct {
	// contains filtered or unexported fields
}

Hub maintains the set of active clients and broadcasts messages to them

func NewHub added in v1.2.7

func NewHub() *Hub

NewHub creates a new WebSocket hub

func (*Hub) BroadcastBanEvent added in v1.2.7

func (h *Hub) BroadcastBanEvent(event storage.BanEventRecord)

BroadcastBanEvent broadcasts a ban event to all connected clients

func (*Hub) BroadcastUnbanEvent added in v1.2.7

func (h *Hub) BroadcastUnbanEvent(event storage.BanEventRecord)

BroadcastUnbanEvent broadcasts an unban event to all connected clients

func (*Hub) Run added in v1.2.7

func (h *Hub) Run()

Run starts the hub's main loop

type SummaryResponse

type SummaryResponse struct {
	Jails []fail2ban.JailInfo `json:"jails"`
}

SummaryResponse is what we return from /api/summary

Jump to

Keyboard shortcuts

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