web

package
v0.0.0-...-75b5a06 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFail2banSettings

func ApplyFail2banSettings(jailLocalPath string) error

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

func BanNotificationHandler

func BanNotificationHandler(c *gin.Context)

BanNotificationHandler processes incoming ban notifications from Fail2Ban.

func GetJailFilterConfigHandler

func GetJailFilterConfigHandler(c *gin.Context)

GetJailFilterConfigHandler returns the raw filter config for a given jail

func GetSettingsHandler

func GetSettingsHandler(c *gin.Context)

GetSettingsHandler returns the entire AppSettings struct as JSON

func HandleBanNotification

func HandleBanNotification(ip, jail, hostname, failures, whois, logs string) error

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

func IndexHandler

func IndexHandler(c *gin.Context)

IndexHandler serves the HTML page

func ListFiltersHandler

func ListFiltersHandler(c *gin.Context)

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

func LoginAuth

func LoginAuth(username, password string) smtp.Auth

func ManageJailsHandler

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)

RegisterRoutes sets up the routes for the Fail2ban UI.

func RestartFail2banHandler

func RestartFail2banHandler(c *gin.Context)

RestartFail2banHandler reloads the Fail2ban service

func SetJailFilterConfigHandler

func SetJailFilterConfigHandler(c *gin.Context)

SetJailFilterConfigHandler overwrites the current filter config with new content

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. and the last 5 overall ban events from the log.

func TestEmailHandler

func TestEmailHandler(c *gin.Context)

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

func TestFilterHandler

func TestFilterHandler(c *gin.Context)

func UnbanIPHandler

func UnbanIPHandler(c *gin.Context)

UnbanIPHandler unbans a given IP in a specific jail.

func UpdateJailManagementHandler

func UpdateJailManagementHandler(c *gin.Context)

UpdateJailManagementHandler updates the enabled state for each jail. Expected JSON format: { "JailName1": true, "JailName2": false, ... } After updating, the Fail2ban service is restarted.

func UpdateSettingsHandler

func UpdateSettingsHandler(c *gin.Context)

UpdateSettingsHandler updates the AppSettings from a JSON body

Types

type SummaryResponse

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

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