-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
646 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package fail2ban | ||
|
||
import ( | ||
"github.com/go-chi/chi/v5" | ||
|
||
"github.com/TheTNB/panel/pkg/pluginloader" | ||
"github.com/TheTNB/panel/pkg/types" | ||
) | ||
|
||
func init() { | ||
pluginloader.Register(&types.Plugin{ | ||
Slug: "fail2ban", | ||
Name: "Fail2ban", | ||
Description: "Fail2ban 扫描系统日志文件并从中找出多次尝试失败的IP地址,将该IP地址加入防火墙的拒绝访问列表中", | ||
Version: "1.0.2", | ||
Requires: []string{}, | ||
Excludes: []string{}, | ||
Install: `bash /www/panel/scripts/fail2ban/install.sh`, | ||
Uninstall: `bash /www/panel/scripts/fail2ban/uninstall.sh`, | ||
Update: `bash /www/panel/scripts/fail2ban/update.sh`, | ||
Route: func(r chi.Router) { | ||
service := NewService() | ||
r.Get("/jails", service.List) | ||
r.Post("/jails", service.Add) | ||
r.Delete("/jails", service.Delete) | ||
r.Get("/jails/{name}", service.BanList) | ||
r.Post("/unban", service.Unban) | ||
r.Post("/whiteList", service.SetWhiteList) | ||
r.Get("/whiteList", service.GetWhiteList) | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package fail2ban | ||
|
||
type Add struct { | ||
Name string `json:"name"` | ||
Type string `json:"type"` | ||
MaxRetry string `json:"maxretry"` | ||
FindTime string `json:"findtime"` | ||
BanTime string `json:"bantime"` | ||
WebsiteName string `json:"website_name"` | ||
WebsiteMode string `json:"website_mode"` | ||
WebsitePath string `json:"website_path"` | ||
} | ||
|
||
type Delete struct { | ||
Name string `json:"name"` | ||
} | ||
|
||
type BanList struct { | ||
Name string `json:"name"` | ||
} | ||
|
||
type Unban struct { | ||
Name string `json:"name"` | ||
IP string `json:"ip"` | ||
} | ||
|
||
type SetWhiteList struct { | ||
IP string `json:"ip"` | ||
} |
Oops, something went wrong.