新创建WAF时增加默认选项
This commit is contained in:
@@ -2,7 +2,7 @@ package firewallconfigs
|
||||
|
||||
import "github.com/iwind/TeaGo/maps"
|
||||
|
||||
// 防火墙动作配置
|
||||
// FirewallActionConfig 防火墙动作配置
|
||||
type FirewallActionConfig struct {
|
||||
Id int64 `yaml:"id" json:"id"` // Id
|
||||
Type string `yaml:"type" json:"type"` // 类型
|
||||
@@ -10,7 +10,7 @@ type FirewallActionConfig struct {
|
||||
EventLevel string `yaml:"eventLevel" json:"eventLevel"` // 事件级别
|
||||
}
|
||||
|
||||
// 初始化
|
||||
// Init 初始化
|
||||
func (this *FirewallActionConfig) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package firewallconfigs
|
||||
|
||||
import "net/http"
|
||||
|
||||
// HTTPFirewallBlockAction url client configure
|
||||
type HTTPFirewallBlockAction struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
@@ -10,3 +12,11 @@ type HTTPFirewallBlockAction struct {
|
||||
Timeout int32 `yaml:"timeout" json:"timeout"`
|
||||
Scope FirewallScope `yaml:"scope" json:"scope"`
|
||||
}
|
||||
|
||||
func DefaultHTTPFirewallBlockAction() *HTTPFirewallBlockAction {
|
||||
return &HTTPFirewallBlockAction{
|
||||
StatusCode: http.StatusForbidden,
|
||||
Body: "Blocked By WAF",
|
||||
Timeout: 60,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,3 +23,12 @@ type HTTPFirewallCaptchaAction struct {
|
||||
|
||||
Lang string `yaml:"lang" json:"lang"` // 语言,zh-CN, en-US ... TODO 需要实现,目前是根据浏览器Accept-Language动态获取
|
||||
}
|
||||
|
||||
func DefaultHTTPFirewallCaptchaAction() *HTTPFirewallCaptchaAction {
|
||||
return &HTTPFirewallCaptchaAction{
|
||||
Life: 600,
|
||||
MaxFails: 100,
|
||||
FailBlockTimeout: 3600,
|
||||
FailBlockScopeAll: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ var DefaultHTTPFirewallPolicyLogConfig = &HTTPFirewallPolicyLogConfig{
|
||||
}
|
||||
|
||||
type HTTPFirewallPolicyLogConfig struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
RequestBody bool `yaml:"requestBody" json:"requestBody"`
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package firewallconfigs
|
||||
|
||||
// SYNFloodConfig Syn flood防护设置
|
||||
type SYNFloodConfig struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
MinAttempts int32 `yaml:"minAttempts" json:"minAttempts"` // 最小尝试次数/分钟
|
||||
TimeoutSeconds int32 `yaml:"timeoutSeconds" json:"timeoutSeconds"` // 拦截超时时间
|
||||
|
||||
Reference in New Issue
Block a user