WAF拦截动作可以设置最大封禁时间,从而实现封禁时间随机

This commit is contained in:
GoEdgeLab
2023-03-01 18:59:42 +08:00
parent 796ca4ca5e
commit f767f567aa
5 changed files with 32 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ Vue.component("http-firewall-block-options", {
blockOptions: this.vBlockOptions,
statusCode: this.vBlockOptions.statusCode,
timeout: this.vBlockOptions.timeout,
timeoutMax: this.vBlockOptions.timeoutMax,
isEditing: false
}
},
@@ -24,6 +25,14 @@ Vue.component("http-firewall-block-options", {
} else {
this.blockOptions.timeout = timeout
}
},
timeoutMax: function (v) {
let timeoutMax = parseInt(v)
if (isNaN(timeoutMax)) {
this.blockOptions.timeoutMax = 0
} else {
this.blockOptions.timeoutMax = timeoutMax
}
}
},
methods: {
@@ -33,7 +42,9 @@ Vue.component("http-firewall-block-options", {
},
template: `<div>
<input type="hidden" name="blockOptionsJSON" :value="JSON.stringify(blockOptions)"/>
<a href="" @click.prevent="edit">状态码:{{statusCode}} / 提示内容:<span v-if="blockOptions.body != null && blockOptions.body.length > 0">[{{blockOptions.body.length}}字符]</span><span v-else class="disabled">[无]</span> / 超时时间:{{timeout}}秒 <i class="icon angle" :class="{up: isEditing, down: !isEditing}"></i></a>
<a href="" @click.prevent="edit">状态码:{{statusCode}} / 提示内容:<span v-if="blockOptions.body != null && blockOptions.body.length > 0">[{{blockOptions.body.length}}字符]</span><span v-else class="disabled">[无]</span> <span v-if="timeout > 0"> / 封禁时长:{{timeout}}秒</span>
<span v-if="timeoutMax > timeout"> / 最大封禁时长:{{timeoutMax}}秒</span>
<i class="icon angle" :class="{up: isEditing, down: !isEditing}"></i></a>
<table class="ui table" v-show="isEditing">
<tr>
<td class="title">状态码</td>
@@ -48,13 +59,23 @@ Vue.component("http-firewall-block-options", {
</td>
</tr>
<tr>
<td>超时时间</td>
<td>封禁时长</td>
<td>
<div class="ui input right labeled">
<input type="text" v-model="timeout" style="width: 5em" maxlength="6"/>
<span class="ui label">秒</span>
</div>
<p class="comment">触发阻止动作时,封客户端IP的时间。</p>
<p class="comment">触发阻止动作时,封客户端IP的时间。</p>
</td>
</tr>
<tr>
<td>最大封禁时长</td>
<td>
<div class="ui input right labeled">
<input type="text" v-model="timeoutMax" style="width: 5em" maxlength="6"/>
<span class="ui label">秒</span>
</div>
<p class="comment">如果最大封禁时长大于封禁时长({{timeout}}秒),那么表示每次封禁的时候,将会在这两个时长数字之间随机选取一个数字作为最终的封禁时长。</p>
</td>
</tr>
</table>