WAF增加多个动作

This commit is contained in:
GoEdgeLab
2021-07-18 16:26:45 +08:00
parent 9291406262
commit 1812fe7b09
14 changed files with 326 additions and 123 deletions
@@ -5,5 +5,5 @@ type HTTPFirewallBlockAction struct {
StatusCode int `yaml:"statusCode" json:"statusCode"`
Body string `yaml:"body" json:"body"` // supports HTML
URL string `yaml:"url" json:"url"`
Life int64 `yaml:"life" json:"life"`
Timeout int32 `yaml:"timeout" json:"timeout"`
}
@@ -1,5 +1,6 @@
package firewallconfigs
type HTTPFirewallCaptchaAction struct {
Life int64 `yaml:"life" json:"life"`
Life int32 `yaml:"life" json:"life"`
Language string `yaml:"language" json:"language"` // 语言,zh-CN, en-US ... TODO 需要实现,目前是根据浏览器Accept-Language动态获取
}
@@ -3,5 +3,5 @@
package firewallconfigs
type HTTPFirewallGet302Action struct {
Life int64 `yaml:"life" json:"life"`
Life int32 `yaml:"life" json:"life"`
}
@@ -0,0 +1,6 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package firewallconfigs
type HTTPFirewallNotifyAction struct {
}
@@ -3,5 +3,5 @@
package firewallconfigs
type HTTPFirewallPost307Action struct {
Life int64 `yaml:"life" json:"life"`
Life int32 `yaml:"life" json:"life"`
}
@@ -6,5 +6,5 @@ type HTTPFirewallRecordIPAction struct {
Type string `yaml:"type" json:"type"`
IPListId int64 `yaml:"ipListId" json:"ipListId"`
Level string `yaml:"level" json:"level"`
Timeout int64 `yaml:"timeout" json:"timeout"`
Timeout int32 `yaml:"timeout" json:"timeout"`
}
@@ -32,19 +32,19 @@ var AllActions = []*HTTPFirewallActionDefinition{
{
Name: "告警",
Code: HTTPFirewallActionNotify,
Description: "发送消息通知。",
Description: "向集群的消息接收人发送消息通知(企业版)。",
Category: HTTPFirewallActionCategoryVerify,
},
{
Name: "GET 302",
Code: HTTPFirewallActionGet302,
Description: "通过302重定向GET请求验证客户端。",
Description: "通过302重定向GET请求验证客户端真实性。",
Category: HTTPFirewallActionCategoryVerify,
},
{
Name: "POST 307",
Code: HTTPFirewallActionPost307,
Description: "通过307重定向POST请求验证客户端。",
Description: "通过307重定向POST请求验证客户端真实性。",
Category: HTTPFirewallActionCategoryVerify,
},
{
@@ -24,7 +24,7 @@ var AllCheckpoints = []*HTTPFirewallCheckpointDefinition{
{
Name: "客户端地址(IP",
Prefix: "remoteAddr",
Description: "试图通过分析X-Forwarded-For等Header获取的客户端地址,比如192.168.1.100",
Description: "试图通过分析X-Forwarded-For等Header获取的客户端地址,比如192.168.1.100,存在伪造的可能",
IsRequest: true,
},
{