mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: Fail2ban 名称修改 (#3071)
This commit is contained in:
parent
fdb6242d03
commit
1df4a870a0
@ -9,9 +9,9 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Tags Fail2Ban
|
// @Tags Fail2ban
|
||||||
// @Summary Load fail2ban base info
|
// @Summary Load fail2ban base info
|
||||||
// @Description 获取 Fail2Ban 基础信息
|
// @Description 获取 Fail2ban 基础信息
|
||||||
// @Success 200 {object} dto.Fail2BanBaseInfo
|
// @Success 200 {object} dto.Fail2BanBaseInfo
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Router /toolbox/fail2ban/base [get]
|
// @Router /toolbox/fail2ban/base [get]
|
||||||
@ -25,9 +25,9 @@ func (b *BaseApi) LoadFail2BanBaseInfo(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, data)
|
helper.SuccessWithData(c, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Fail2Ban
|
// @Tags Fail2ban
|
||||||
// @Summary Page fail2ban ip list
|
// @Summary Page fail2ban ip list
|
||||||
// @Description 获取 Fail2Ban ip
|
// @Description 获取 Fail2ban ip
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.Fail2BanSearch true "request"
|
// @Param request body dto.Fail2BanSearch true "request"
|
||||||
// @Success 200 {Array} string
|
// @Success 200 {Array} string
|
||||||
@ -48,14 +48,14 @@ func (b *BaseApi) SearchFail2Ban(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, list)
|
helper.SuccessWithData(c, list)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Fail2Ban
|
// @Tags Fail2ban
|
||||||
// @Summary Operate fail2ban
|
// @Summary Operate fail2ban
|
||||||
// @Description 修改 Fail2Ban 状态
|
// @Description 修改 Fail2ban 状态
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.Operate true "request"
|
// @Param request body dto.Operate true "request"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Router /toolbox/fail2ban/operate [post]
|
// @Router /toolbox/fail2ban/operate [post]
|
||||||
// @x-panel-log {"bodyKeys":["operation"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operation] Fail2Ban","formatEN":"[operation] Fail2Ban"}
|
// @x-panel-log {"bodyKeys":["operation"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operation] Fail2ban","formatEN":"[operation] Fail2ban"}
|
||||||
func (b *BaseApi) OperateFail2Ban(c *gin.Context) {
|
func (b *BaseApi) OperateFail2Ban(c *gin.Context) {
|
||||||
var req dto.Operate
|
var req dto.Operate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@ -70,7 +70,7 @@ func (b *BaseApi) OperateFail2Ban(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, nil)
|
helper.SuccessWithData(c, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Fail2Ban
|
// @Tags Fail2ban
|
||||||
// @Summary Operate sshd of fail2ban
|
// @Summary Operate sshd of fail2ban
|
||||||
// @Description 配置 sshd
|
// @Description 配置 sshd
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@ -91,15 +91,15 @@ func (b *BaseApi) OperateSSHD(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, nil)
|
helper.SuccessWithData(c, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Fail2Ban
|
// @Tags Fail2ban
|
||||||
// @Summary Update fail2ban conf
|
// @Summary Update fail2ban conf
|
||||||
// @Description 修改 Fail2Ban 配置
|
// @Description 修改 Fail2ban 配置
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.Fail2BanUpdate true "request"
|
// @Param request body dto.Fail2BanUpdate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Router /toolbox/fail2ban/update [post]
|
// @Router /toolbox/fail2ban/update [post]
|
||||||
// @x-panel-log {"bodyKeys":["key","value"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改 Fail2Ban 配置 [key] => [value]","formatEN":"update fail2ban conf [key] => [value]"}
|
// @x-panel-log {"bodyKeys":["key","value"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改 Fail2ban 配置 [key] => [value]","formatEN":"update fail2ban conf [key] => [value]"}
|
||||||
func (b *BaseApi) UpdateFail2BanConf(c *gin.Context) {
|
func (b *BaseApi) UpdateFail2BanConf(c *gin.Context) {
|
||||||
var req dto.Fail2BanUpdate
|
var req dto.Fail2BanUpdate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@ -113,7 +113,7 @@ func (b *BaseApi) UpdateFail2BanConf(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, nil)
|
helper.SuccessWithData(c, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Fail2Ban
|
// @Tags Fail2ban
|
||||||
// @Summary Load fail2ban conf
|
// @Summary Load fail2ban conf
|
||||||
// @Description 获取 fail2ban 配置文件
|
// @Description 获取 fail2ban 配置文件
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@ -131,7 +131,7 @@ func (b *BaseApi) LoadFail2BanConf(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, string(file))
|
helper.SuccessWithData(c, string(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Fail2Ban
|
// @Tags Fail2ban
|
||||||
// @Summary Update fail2ban conf by file
|
// @Summary Update fail2ban conf by file
|
||||||
// @Description 通过文件修改 fail2ban 配置
|
// @Description 通过文件修改 fail2ban 配置
|
||||||
// @Accept json
|
// @Accept json
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/1Panel-dev/1Panel/backend/utils/systemctl"
|
"github.com/1Panel-dev/1Panel/backend/utils/systemctl"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Fail2Ban struct{}
|
type Fail2ban struct{}
|
||||||
|
|
||||||
const defaultPath = "/etc/fail2ban/jail.local"
|
const defaultPath = "/etc/fail2ban/jail.local"
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ type FirewallClient interface {
|
|||||||
OperateSSHD(operate, ip string) error
|
OperateSSHD(operate, ip string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFail2Ban() (*Fail2Ban, error) {
|
func NewFail2Ban() (*Fail2ban, error) {
|
||||||
isExist, _ := systemctl.IsExist("fail2ban.service")
|
isExist, _ := systemctl.IsExist("fail2ban.service")
|
||||||
if isExist {
|
if isExist {
|
||||||
if _, err := os.Stat(defaultPath); err != nil {
|
if _, err := os.Stat(defaultPath); err != nil {
|
||||||
@ -36,10 +36,10 @@ func NewFail2Ban() (*Fail2Ban, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &Fail2Ban{}, nil
|
return &Fail2ban{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Fail2Ban) Status() (bool, bool, bool) {
|
func (f *Fail2ban) Status() (bool, bool, bool) {
|
||||||
isEnable, _ := systemctl.IsEnable("fail2ban.service")
|
isEnable, _ := systemctl.IsEnable("fail2ban.service")
|
||||||
isActive, _ := systemctl.IsActive("fail2ban.service")
|
isActive, _ := systemctl.IsActive("fail2ban.service")
|
||||||
isExist, _ := systemctl.IsExist("fail2ban.service")
|
isExist, _ := systemctl.IsExist("fail2ban.service")
|
||||||
@ -47,7 +47,7 @@ func (f *Fail2Ban) Status() (bool, bool, bool) {
|
|||||||
return isEnable, isActive, isExist
|
return isEnable, isActive, isExist
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Fail2Ban) Version() string {
|
func (f *Fail2ban) Version() string {
|
||||||
stdout, err := cmd.Exec("fail2ban-client version")
|
stdout, err := cmd.Exec("fail2ban-client version")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
global.LOG.Errorf("load the fail2ban version failed, err: %s", stdout)
|
global.LOG.Errorf("load the fail2ban version failed, err: %s", stdout)
|
||||||
@ -56,7 +56,7 @@ func (f *Fail2Ban) Version() string {
|
|||||||
return strings.ReplaceAll(stdout, "\n", "")
|
return strings.ReplaceAll(stdout, "\n", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Fail2Ban) Operate(operate string) error {
|
func (f *Fail2ban) Operate(operate string) error {
|
||||||
switch operate {
|
switch operate {
|
||||||
case "start", "restart", "stop", "enable", "disable":
|
case "start", "restart", "stop", "enable", "disable":
|
||||||
stdout, err := cmd.Execf("systemctl %s fail2ban.service", operate)
|
stdout, err := cmd.Execf("systemctl %s fail2ban.service", operate)
|
||||||
@ -75,7 +75,7 @@ func (f *Fail2Ban) Operate(operate string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Fail2Ban) ReBanIPs(ips []string) error {
|
func (f *Fail2ban) ReBanIPs(ips []string) error {
|
||||||
ipItems, _ := f.ListBanned()
|
ipItems, _ := f.ListBanned()
|
||||||
stdout, err := cmd.Execf("fail2ban-client unban --all")
|
stdout, err := cmd.Execf("fail2ban-client unban --all")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -92,7 +92,7 @@ func (f *Fail2Ban) ReBanIPs(ips []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Fail2Ban) ListBanned() ([]string, error) {
|
func (f *Fail2ban) ListBanned() ([]string, error) {
|
||||||
var lists []string
|
var lists []string
|
||||||
stdout, err := cmd.Exec("fail2ban-client get sshd banned")
|
stdout, err := cmd.Exec("fail2ban-client get sshd banned")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -106,7 +106,7 @@ func (f *Fail2Ban) ListBanned() ([]string, error) {
|
|||||||
return lists, nil
|
return lists, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Fail2Ban) ListIgnore() ([]string, error) {
|
func (f *Fail2ban) ListIgnore() ([]string, error) {
|
||||||
var lists []string
|
var lists []string
|
||||||
stdout, err := cmd.Exec("fail2ban-client get sshd ignoreip")
|
stdout, err := cmd.Exec("fail2ban-client get sshd ignoreip")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Package docs GENERATED BY SWAG; DO NOT EDIT
|
// Code generated by swaggo/swag. DO NOT EDIT.
|
||||||
// This file was generated by swaggo/swag
|
|
||||||
package docs
|
package docs
|
||||||
|
|
||||||
import "github.com/swaggo/swag"
|
import "github.com/swaggo/swag"
|
||||||
@ -10406,9 +10406,9 @@ const docTemplate = `{
|
|||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "获取 Fail2Ban 基础信息",
|
"description": "获取 Fail2ban 基础信息",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Load fail2ban base info",
|
"summary": "Load fail2ban base info",
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -10433,7 +10433,7 @@ const docTemplate = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Load fail2ban conf",
|
"summary": "Load fail2ban conf",
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -10450,12 +10450,12 @@ const docTemplate = `{
|
|||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "修改 Fail2Ban 状态",
|
"description": "修改 Fail2ban 状态",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Operate fail2ban",
|
"summary": "Operate fail2ban",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@ -10475,8 +10475,8 @@ const docTemplate = `{
|
|||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"operation"
|
"operation"
|
||||||
],
|
],
|
||||||
"formatEN": "[operation] Fail2Ban",
|
"formatEN": "[operation] Fail2ban",
|
||||||
"formatZH": "[operation] Fail2Ban",
|
"formatZH": "[operation] Fail2ban",
|
||||||
"paramKeys": []
|
"paramKeys": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10493,7 +10493,7 @@ const docTemplate = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Operate sshd of fail2ban",
|
"summary": "Operate sshd of fail2ban",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@ -10517,12 +10517,12 @@ const docTemplate = `{
|
|||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "获取 Fail2Ban ip",
|
"description": "获取 Fail2ban ip",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Page fail2ban ip list",
|
"summary": "Page fail2ban ip list",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@ -10553,12 +10553,12 @@ const docTemplate = `{
|
|||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "修改 Fail2Ban 配置",
|
"description": "修改 Fail2ban 配置",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Update fail2ban conf",
|
"summary": "Update fail2ban conf",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@ -10584,7 +10584,7 @@ const docTemplate = `{
|
|||||||
"value"
|
"value"
|
||||||
],
|
],
|
||||||
"formatEN": "update fail2ban conf [key] =\u003e [value]",
|
"formatEN": "update fail2ban conf [key] =\u003e [value]",
|
||||||
"formatZH": "修改 Fail2Ban 配置 [key] =\u003e [value]",
|
"formatZH": "修改 Fail2ban 配置 [key] =\u003e [value]",
|
||||||
"paramKeys": []
|
"paramKeys": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10601,7 +10601,7 @@ const docTemplate = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Update fail2ban conf by file",
|
"summary": "Update fail2ban conf by file",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
@ -10399,9 +10399,9 @@
|
|||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "获取 Fail2Ban 基础信息",
|
"description": "获取 Fail2ban 基础信息",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Load fail2ban base info",
|
"summary": "Load fail2ban base info",
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -10426,7 +10426,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Load fail2ban conf",
|
"summary": "Load fail2ban conf",
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -10443,12 +10443,12 @@
|
|||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "修改 Fail2Ban 状态",
|
"description": "修改 Fail2ban 状态",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Operate fail2ban",
|
"summary": "Operate fail2ban",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@ -10468,8 +10468,8 @@
|
|||||||
"bodyKeys": [
|
"bodyKeys": [
|
||||||
"operation"
|
"operation"
|
||||||
],
|
],
|
||||||
"formatEN": "[operation] Fail2Ban",
|
"formatEN": "[operation] Fail2ban",
|
||||||
"formatZH": "[operation] Fail2Ban",
|
"formatZH": "[operation] Fail2ban",
|
||||||
"paramKeys": []
|
"paramKeys": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10486,7 +10486,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Operate sshd of fail2ban",
|
"summary": "Operate sshd of fail2ban",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@ -10510,12 +10510,12 @@
|
|||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "获取 Fail2Ban ip",
|
"description": "获取 Fail2ban ip",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Page fail2ban ip list",
|
"summary": "Page fail2ban ip list",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@ -10546,12 +10546,12 @@
|
|||||||
"ApiKeyAuth": []
|
"ApiKeyAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "修改 Fail2Ban 配置",
|
"description": "修改 Fail2ban 配置",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Update fail2ban conf",
|
"summary": "Update fail2ban conf",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@ -10577,7 +10577,7 @@
|
|||||||
"value"
|
"value"
|
||||||
],
|
],
|
||||||
"formatEN": "update fail2ban conf [key] =\u003e [value]",
|
"formatEN": "update fail2ban conf [key] =\u003e [value]",
|
||||||
"formatZH": "修改 Fail2Ban 配置 [key] =\u003e [value]",
|
"formatZH": "修改 Fail2ban 配置 [key] =\u003e [value]",
|
||||||
"paramKeys": []
|
"paramKeys": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10594,7 +10594,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Fail2Ban"
|
"Fail2ban"
|
||||||
],
|
],
|
||||||
"summary": "Update fail2ban conf by file",
|
"summary": "Update fail2ban conf by file",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
@ -11292,7 +11292,7 @@ paths:
|
|||||||
- Device
|
- Device
|
||||||
/toolbox/fail2ban/base:
|
/toolbox/fail2ban/base:
|
||||||
get:
|
get:
|
||||||
description: 获取 Fail2Ban 基础信息
|
description: 获取 Fail2ban 基础信息
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
@ -11302,7 +11302,7 @@ paths:
|
|||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Load fail2ban base info
|
summary: Load fail2ban base info
|
||||||
tags:
|
tags:
|
||||||
- Fail2Ban
|
- Fail2ban
|
||||||
/toolbox/fail2ban/load/conf:
|
/toolbox/fail2ban/load/conf:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
@ -11315,12 +11315,12 @@ paths:
|
|||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Load fail2ban conf
|
summary: Load fail2ban conf
|
||||||
tags:
|
tags:
|
||||||
- Fail2Ban
|
- Fail2ban
|
||||||
/toolbox/fail2ban/operate:
|
/toolbox/fail2ban/operate:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: 修改 Fail2Ban 状态
|
description: 修改 Fail2ban 状态
|
||||||
parameters:
|
parameters:
|
||||||
- description: request
|
- description: request
|
||||||
in: body
|
in: body
|
||||||
@ -11333,13 +11333,13 @@ paths:
|
|||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Operate fail2ban
|
summary: Operate fail2ban
|
||||||
tags:
|
tags:
|
||||||
- Fail2Ban
|
- Fail2ban
|
||||||
x-panel-log:
|
x-panel-log:
|
||||||
BeforeFunctions: []
|
BeforeFunctions: []
|
||||||
bodyKeys:
|
bodyKeys:
|
||||||
- operation
|
- operation
|
||||||
formatEN: '[operation] Fail2Ban'
|
formatEN: '[operation] Fail2ban'
|
||||||
formatZH: '[operation] Fail2Ban'
|
formatZH: '[operation] Fail2ban'
|
||||||
paramKeys: []
|
paramKeys: []
|
||||||
/toolbox/fail2ban/operate/sshd:
|
/toolbox/fail2ban/operate/sshd:
|
||||||
post:
|
post:
|
||||||
@ -11358,12 +11358,12 @@ paths:
|
|||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Operate sshd of fail2ban
|
summary: Operate sshd of fail2ban
|
||||||
tags:
|
tags:
|
||||||
- Fail2Ban
|
- Fail2ban
|
||||||
/toolbox/fail2ban/search:
|
/toolbox/fail2ban/search:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: 获取 Fail2Ban ip
|
description: 获取 Fail2ban ip
|
||||||
parameters:
|
parameters:
|
||||||
- description: request
|
- description: request
|
||||||
in: body
|
in: body
|
||||||
@ -11380,12 +11380,12 @@ paths:
|
|||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Page fail2ban ip list
|
summary: Page fail2ban ip list
|
||||||
tags:
|
tags:
|
||||||
- Fail2Ban
|
- Fail2ban
|
||||||
/toolbox/fail2ban/update:
|
/toolbox/fail2ban/update:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: 修改 Fail2Ban 配置
|
description: 修改 Fail2ban 配置
|
||||||
parameters:
|
parameters:
|
||||||
- description: request
|
- description: request
|
||||||
in: body
|
in: body
|
||||||
@ -11400,14 +11400,14 @@ paths:
|
|||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Update fail2ban conf
|
summary: Update fail2ban conf
|
||||||
tags:
|
tags:
|
||||||
- Fail2Ban
|
- Fail2ban
|
||||||
x-panel-log:
|
x-panel-log:
|
||||||
BeforeFunctions: []
|
BeforeFunctions: []
|
||||||
bodyKeys:
|
bodyKeys:
|
||||||
- key
|
- key
|
||||||
- value
|
- value
|
||||||
formatEN: update fail2ban conf [key] => [value]
|
formatEN: update fail2ban conf [key] => [value]
|
||||||
formatZH: 修改 Fail2Ban 配置 [key] => [value]
|
formatZH: 修改 Fail2ban 配置 [key] => [value]
|
||||||
paramKeys: []
|
paramKeys: []
|
||||||
/toolbox/fail2ban/update/byconf:
|
/toolbox/fail2ban/update/byconf:
|
||||||
post:
|
post:
|
||||||
@ -11428,7 +11428,7 @@ paths:
|
|||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
summary: Update fail2ban conf by file
|
summary: Update fail2ban conf by file
|
||||||
tags:
|
tags:
|
||||||
- Fail2Ban
|
- Fail2ban
|
||||||
/websites:
|
/websites:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
|
@ -933,10 +933,10 @@ const message = {
|
|||||||
dnsTestFailed: 'DNS configuration information is not available. Please modify and try again!',
|
dnsTestFailed: 'DNS configuration information is not available. Please modify and try again!',
|
||||||
},
|
},
|
||||||
fail2ban: {
|
fail2ban: {
|
||||||
noFail2ban: 'Fail2Ban service not detected, please refer to the official documentation for installation',
|
noFail2ban: 'Fail2ban service not detected, please refer to the official documentation for installation',
|
||||||
unActive: 'The Fail2Ban service is not enabled at present, please enable it first!',
|
unActive: 'The Fail2ban service is not enabled at present, please enable it first!',
|
||||||
operation: 'Perform [{0}] operation on Fail2Ban service, continue?',
|
operation: 'Perform [{0}] operation on Fail2ban service, continue?',
|
||||||
fail2banChange: 'Fail2Ban Configuration Modification',
|
fail2banChange: 'Fail2ban Configuration Modification',
|
||||||
ignoreHelper: 'The IP list in the whitelist will be ignored for blocking, continue?',
|
ignoreHelper: 'The IP list in the whitelist will be ignored for blocking, continue?',
|
||||||
bannedHelper: 'The IP list in the blacklist will be blocked by the server, continue?',
|
bannedHelper: 'The IP list in the blacklist will be blocked by the server, continue?',
|
||||||
maxRetry: 'Maximum Retry Attempts',
|
maxRetry: 'Maximum Retry Attempts',
|
||||||
|
@ -886,10 +886,10 @@ const message = {
|
|||||||
dnsTestFailed: 'DNS 配置信息不可用,請修改後重試!',
|
dnsTestFailed: 'DNS 配置信息不可用,請修改後重試!',
|
||||||
},
|
},
|
||||||
fail2ban: {
|
fail2ban: {
|
||||||
noFail2ban: '未檢測到 Fail2Ban 服務,請參考官方文檔進行安裝',
|
noFail2ban: '未檢測到 Fail2ban 服務,請參考官方文檔進行安裝',
|
||||||
unActive: '當前未開啟 Fail2Ban 服務,請先開啟!',
|
unActive: '當前未開啟 Fail2ban 服務,請先開啟!',
|
||||||
operation: '對 Fail2Ban 服務進行 [{0}] 操作,是否繼續?',
|
operation: '對 Fail2ban 服務進行 [{0}] 操作,是否繼續?',
|
||||||
fail2banChange: 'Fail2Ban 配置修改',
|
fail2banChange: 'Fail2ban 配置修改',
|
||||||
ignoreHelper: '白名單中的 IP 列表將被忽略屏蔽,是否繼續?',
|
ignoreHelper: '白名單中的 IP 列表將被忽略屏蔽,是否繼續?',
|
||||||
bannedHelper: '黑名單中的 IP 列表將被伺服器屏蔽,是否繼續?',
|
bannedHelper: '黑名單中的 IP 列表將被伺服器屏蔽,是否繼續?',
|
||||||
maxRetry: '最大重試次數',
|
maxRetry: '最大重試次數',
|
||||||
|
@ -887,10 +887,10 @@ const message = {
|
|||||||
dnsTestFailed: 'DNS 配置信息不可用,请修改后重试!',
|
dnsTestFailed: 'DNS 配置信息不可用,请修改后重试!',
|
||||||
},
|
},
|
||||||
fail2ban: {
|
fail2ban: {
|
||||||
noFail2ban: '未检测到 Fail2Ban 服务,请参考官方文档进行安装',
|
noFail2ban: '未检测到 Fail2ban 服务,请参考官方文档进行安装',
|
||||||
unActive: '当前未开启 Fail2Ban 服务,请先开启!',
|
unActive: '当前未开启 Fail2ban 服务,请先开启!',
|
||||||
operation: '对 Fail2Ban 服务进行 [{0}] 操作,是否继续?',
|
operation: '对 Fail2ban 服务进行 [{0}] 操作,是否继续?',
|
||||||
fail2banChange: 'Fail2Ban 配置修改',
|
fail2banChange: 'Fail2ban 配置修改',
|
||||||
ignoreHelper: '白名单中的 IP 列表将被忽略屏蔽,是否继续?',
|
ignoreHelper: '白名单中的 IP 列表将被忽略屏蔽,是否继续?',
|
||||||
bannedHelper: '黑名单中的 IP 列表将被服务器屏蔽,是否继续?',
|
bannedHelper: '黑名单中的 IP 列表将被服务器屏蔽,是否继续?',
|
||||||
maxRetry: '最大重试次数',
|
maxRetry: '最大重试次数',
|
||||||
|
@ -39,7 +39,7 @@ const toolboxRouter = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'fail2Ban',
|
path: 'fail2Ban',
|
||||||
name: 'Fail2Ban',
|
name: 'Fail2ban',
|
||||||
component: () => import('@/views/toolbox/fail2ban/index.vue'),
|
component: () => import('@/views/toolbox/fail2ban/index.vue'),
|
||||||
hidden: true,
|
hidden: true,
|
||||||
meta: {
|
meta: {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="app-status" style="margin-top: 20px">
|
<div class="app-status" style="margin-top: 20px">
|
||||||
<el-card v-if="form.isExist">
|
<el-card v-if="form.isExist">
|
||||||
<div>
|
<div>
|
||||||
<el-tag effect="dark" type="success">Fail2Ban</el-tag>
|
<el-tag effect="dark" type="success">Fail2ban</el-tag>
|
||||||
<el-tag round class="status-content" v-if="form.isActive" type="success">
|
<el-tag round class="status-content" v-if="form.isActive" type="success">
|
||||||
{{ $t('commons.status.running') }}
|
{{ $t('commons.status.running') }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<el-card v-if="!form.isActive" class="mask-prompt">
|
<el-card v-if="!form.isActive" class="mask-prompt">
|
||||||
<span>{{ $t('toolbox.fail2ban.unActive') }}</span>
|
<span>{{ $t('toolbox.fail2ban.unActive') }}</span>
|
||||||
</el-card>
|
</el-card>
|
||||||
<LayoutContent title="Fail2Ban" :divider="true" :class="{ mask: !form.isActive }">
|
<LayoutContent title="Fail2ban" :divider="true" :class="{ mask: !form.isActive }">
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
@ -109,7 +109,7 @@
|
|||||||
<div v-if="confShowType === 'all'">
|
<div v-if="confShowType === 'all'">
|
||||||
<codemirror
|
<codemirror
|
||||||
:autofocus="true"
|
:autofocus="true"
|
||||||
placeholder="# The Fail2Ban configuration file does not exist or is empty (/etc/ssh/sshd_config)"
|
placeholder="# The Fail2ban configuration file does not exist or is empty (/etc/ssh/sshd_config)"
|
||||||
:indent-with-tab="true"
|
:indent-with-tab="true"
|
||||||
:tabSize="4"
|
:tabSize="4"
|
||||||
style="margin-top: 10px; height: calc(100vh - 460px)"
|
style="margin-top: 10px; height: calc(100vh - 460px)"
|
||||||
@ -128,7 +128,7 @@
|
|||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<LayoutContent title="Fail2Ban" :divider="true">
|
<LayoutContent title="Fail2ban" :divider="true">
|
||||||
<template #main>
|
<template #main>
|
||||||
<div class="app-warn">
|
<div class="app-warn">
|
||||||
<div>
|
<div>
|
||||||
@ -245,7 +245,7 @@ const onChangeBanAction = () => {
|
|||||||
|
|
||||||
const onOperate = async (operation: string) => {
|
const onOperate = async (operation: string) => {
|
||||||
let msg = operation === 'enable' || operation === 'disable' ? 'ssh.' : 'commons.button.';
|
let msg = operation === 'enable' || operation === 'disable' ? 'ssh.' : 'commons.button.';
|
||||||
ElMessageBox.confirm(i18n.global.t('toolbox.fail2ban.operation', [i18n.global.t(msg + operation)]), 'Fail2Ban', {
|
ElMessageBox.confirm(i18n.global.t('toolbox.fail2ban.operation', [i18n.global.t(msg + operation)]), 'Fail2ban', {
|
||||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||||
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
@ -20,7 +20,7 @@ const buttons = [
|
|||||||
path: '/toolbox/supervisor',
|
path: '/toolbox/supervisor',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Fail2Ban',
|
label: 'Fail2ban',
|
||||||
path: '/toolbox/fail2ban',
|
path: '/toolbox/fail2ban',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user