Archived
Block动作增加默认时间60秒
This commit is contained in:
@@ -57,10 +57,12 @@ func (this *BlockAction) WillChange() bool {
|
||||
}
|
||||
|
||||
func (this *BlockAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, request requests.Request, writer http.ResponseWriter) (allow bool) {
|
||||
if this.Timeout > 0 {
|
||||
// 加入到黑名单
|
||||
SharedIPBlackLIst.Add(IPTypeAll, request.WAFRemoteIP(), time.Now().Unix()+int64(this.Timeout))
|
||||
// 加入到黑名单
|
||||
var timeout = this.Timeout
|
||||
if timeout <= 0 {
|
||||
timeout = 60 // 默认封锁60秒
|
||||
}
|
||||
SharedIPBlackList.Add(IPTypeAll, request.WAFRemoteIP(), time.Now().Unix()+int64(timeout))
|
||||
|
||||
if writer != nil {
|
||||
// close the connection
|
||||
|
||||
@@ -92,7 +92,7 @@ func (this *RecordIPAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, re
|
||||
if this.Type == "black" {
|
||||
_ = this.CloseConn(writer)
|
||||
|
||||
SharedIPBlackLIst.Add(IPTypeAll, request.WAFRemoteIP(), expiredAt)
|
||||
SharedIPBlackList.Add(IPTypeAll, request.WAFRemoteIP(), expiredAt)
|
||||
} else {
|
||||
// 加入本地白名单
|
||||
timeout := this.Timeout
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
var SharedIPWhiteList = NewIPList()
|
||||
var SharedIPBlackLIst = NewIPList()
|
||||
var SharedIPBlackList = NewIPList()
|
||||
|
||||
const IPTypeAll = "*"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user