2020-11-18 19:35:32 +08:00
|
|
|
|
// 通用Header长度
|
|
|
|
|
|
let defaultGeneralHeaders = ["Cache-Control", "Connection", "Date", "Pragma", "Trailer", "Transfer-Encoding", "Upgrade", "Via", "Warning"]
|
|
|
|
|
|
Vue.component("http-cond-general-header-length", {
|
|
|
|
|
|
props: ["v-checkpoint"],
|
|
|
|
|
|
data: function () {
|
|
|
|
|
|
let headers = null
|
|
|
|
|
|
let length = null
|
|
|
|
|
|
|
|
|
|
|
|
if (window.parent.UPDATING_RULE != null) {
|
|
|
|
|
|
let options = window.parent.UPDATING_RULE.checkpointOptions
|
|
|
|
|
|
if (options.headers != null && Array.$isArray(options.headers)) {
|
|
|
|
|
|
headers = options.headers
|
|
|
|
|
|
}
|
|
|
|
|
|
if (options.length != null) {
|
|
|
|
|
|
length = options.length
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (headers == null) {
|
|
|
|
|
|
headers = defaultGeneralHeaders
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (length == null) {
|
|
|
|
|
|
length = 128
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
that.change()
|
|
|
|
|
|
}, 100)
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
headers: headers,
|
|
|
|
|
|
length: length
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
length: function (v) {
|
|
|
|
|
|
let len = parseInt(v)
|
|
|
|
|
|
if (isNaN(len)) {
|
|
|
|
|
|
len = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
if (len < 0) {
|
|
|
|
|
|
len = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
this.length = len
|
|
|
|
|
|
this.change()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
change: function () {
|
|
|
|
|
|
this.vCheckpoint.options = [
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "headers",
|
|
|
|
|
|
value: this.headers
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "length",
|
|
|
|
|
|
value: this.length
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
template: `<div>
|
|
|
|
|
|
<table class="ui table">
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td class="title">通用Header列表</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<values-box :values="headers" :placeholder="'Header'" @change="change"></values-box>
|
|
|
|
|
|
<p class="comment">需要检查的Header列表。</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td>Header值超出长度</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<div class="ui input right labeled">
|
|
|
|
|
|
<input type="text" name="" style="width: 5em" v-model="length" maxlength="6"/>
|
|
|
|
|
|
<span class="ui label">字节</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<p class="comment">超出此长度认为匹配成功,0表示不限制。</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
</div>`
|
2021-07-19 10:48:53 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// CC
|
|
|
|
|
|
Vue.component("http-firewall-checkpoint-cc", {
|
|
|
|
|
|
props: ["v-checkpoint"],
|
|
|
|
|
|
data: function () {
|
|
|
|
|
|
let keys = []
|
|
|
|
|
|
let period = 60
|
|
|
|
|
|
let threshold = 1000
|
2022-07-15 12:04:24 +08:00
|
|
|
|
let ignoreCommonFiles = false
|
2023-03-10 10:34:50 +08:00
|
|
|
|
let enableFingerprint = true
|
2021-07-19 10:48:53 +08:00
|
|
|
|
|
|
|
|
|
|
let options = {}
|
|
|
|
|
|
if (window.parent.UPDATING_RULE != null) {
|
|
|
|
|
|
options = window.parent.UPDATING_RULE.checkpointOptions
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (options == null) {
|
|
|
|
|
|
options = {}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (options.keys != null) {
|
|
|
|
|
|
keys = options.keys
|
|
|
|
|
|
}
|
|
|
|
|
|
if (keys.length == 0) {
|
|
|
|
|
|
keys = ["${remoteAddr}", "${requestPath}"]
|
|
|
|
|
|
}
|
|
|
|
|
|
if (options.period != null) {
|
|
|
|
|
|
period = options.period
|
|
|
|
|
|
}
|
|
|
|
|
|
if (options.threshold != null) {
|
|
|
|
|
|
threshold = options.threshold
|
|
|
|
|
|
}
|
2022-07-15 12:04:24 +08:00
|
|
|
|
if (options.ignoreCommonFiles != null && typeof (options.ignoreCommonFiles) == "boolean") {
|
|
|
|
|
|
ignoreCommonFiles = options.ignoreCommonFiles
|
|
|
|
|
|
}
|
2023-03-10 10:34:50 +08:00
|
|
|
|
if (options.enableFingerprint != null && typeof (options.enableFingerprint) == "boolean") {
|
|
|
|
|
|
enableFingerprint = options.enableFingerprint
|
|
|
|
|
|
}
|
2021-07-19 10:48:53 +08:00
|
|
|
|
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
that.change()
|
|
|
|
|
|
}, 100)
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
keys: keys,
|
|
|
|
|
|
period: period,
|
|
|
|
|
|
threshold: threshold,
|
2022-07-15 12:04:24 +08:00
|
|
|
|
ignoreCommonFiles: ignoreCommonFiles,
|
2023-03-10 10:34:50 +08:00
|
|
|
|
enableFingerprint: enableFingerprint,
|
2021-07-19 10:48:53 +08:00
|
|
|
|
options: {},
|
|
|
|
|
|
value: threshold
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
period: function () {
|
|
|
|
|
|
this.change()
|
|
|
|
|
|
},
|
|
|
|
|
|
threshold: function () {
|
|
|
|
|
|
this.change()
|
2022-07-15 12:04:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
ignoreCommonFiles: function () {
|
|
|
|
|
|
this.change()
|
2023-03-10 10:34:50 +08:00
|
|
|
|
},
|
|
|
|
|
|
enableFingerprint: function () {
|
|
|
|
|
|
this.change()
|
2021-07-19 10:48:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
changeKeys: function (keys) {
|
|
|
|
|
|
this.keys = keys
|
|
|
|
|
|
this.change()
|
|
|
|
|
|
},
|
|
|
|
|
|
change: function () {
|
|
|
|
|
|
let period = parseInt(this.period.toString())
|
|
|
|
|
|
if (isNaN(period) || period <= 0) {
|
|
|
|
|
|
period = 60
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let threshold = parseInt(this.threshold.toString())
|
|
|
|
|
|
if (isNaN(threshold) || threshold <= 0) {
|
|
|
|
|
|
threshold = 1000
|
|
|
|
|
|
}
|
|
|
|
|
|
this.value = threshold
|
|
|
|
|
|
|
2022-07-15 12:04:24 +08:00
|
|
|
|
let ignoreCommonFiles = this.ignoreCommonFiles
|
|
|
|
|
|
if (typeof ignoreCommonFiles != "boolean") {
|
|
|
|
|
|
ignoreCommonFiles = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-10 10:34:50 +08:00
|
|
|
|
let enableFingerprint = this.enableFingerprint
|
|
|
|
|
|
if (typeof enableFingerprint != "boolean") {
|
|
|
|
|
|
enableFingerprint = true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-07-19 10:48:53 +08:00
|
|
|
|
this.vCheckpoint.options = [
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "keys",
|
|
|
|
|
|
value: this.keys
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "period",
|
|
|
|
|
|
value: period,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "threshold",
|
|
|
|
|
|
value: threshold
|
2022-07-15 12:04:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "ignoreCommonFiles",
|
|
|
|
|
|
value: ignoreCommonFiles
|
2023-03-10 10:34:50 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "enableFingerprint",
|
|
|
|
|
|
value: enableFingerprint
|
2021-07-19 10:48:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
2022-08-25 09:26:06 +08:00
|
|
|
|
},
|
|
|
|
|
|
thresholdTooLow: function () {
|
|
|
|
|
|
let threshold = parseInt(this.threshold.toString())
|
|
|
|
|
|
if (isNaN(threshold) || threshold <= 0) {
|
|
|
|
|
|
threshold = 1000
|
|
|
|
|
|
}
|
|
|
|
|
|
return threshold > 0 && threshold < 5
|
2021-07-19 10:48:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
template: `<div>
|
2021-07-19 15:23:20 +08:00
|
|
|
|
<input type="hidden" name="operator" value="gt"/>
|
2021-07-19 10:48:53 +08:00
|
|
|
|
<input type="hidden" name="value" :value="value"/>
|
|
|
|
|
|
<table class="ui table">
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td class="title">统计对象组合 *</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<metric-keys-config-box :v-keys="keys" @change="changeKeys"></metric-keys-config-box>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td>统计周期 *</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<div class="ui input right labeled">
|
|
|
|
|
|
<input type="text" v-model="period" style="width: 6em" maxlength="8"/>
|
|
|
|
|
|
<span class="ui label">秒</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td>阈值 *</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<input type="text" v-model="threshold" style="width: 6em" maxlength="8"/>
|
2022-08-25 09:26:06 +08:00
|
|
|
|
<p class="comment" v-if="thresholdTooLow()"><span class="red">对于网站类应用来说,当前阈值设置的太低,有可能会影响用户正常访问。</span></p>
|
2021-07-19 10:48:53 +08:00
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
2023-03-10 10:34:50 +08:00
|
|
|
|
<tr>
|
|
|
|
|
|
<td>检查请求来源指纹</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<checkbox v-model="enableFingerprint"></checkbox>
|
|
|
|
|
|
<p class="comment">在接收到HTTPS请求时尝试检查请求来源的指纹,用来检测代理服务和爬虫攻击。</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
2022-07-15 12:04:24 +08:00
|
|
|
|
<tr>
|
|
|
|
|
|
<td>忽略常见文件</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<checkbox v-model="ignoreCommonFiles"></checkbox>
|
2022-07-26 08:00:42 +08:00
|
|
|
|
<p class="comment">忽略js、css、jpg等常见在网页里被引用的文件名。</p>
|
2022-07-15 12:04:24 +08:00
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
2021-07-19 10:48:53 +08:00
|
|
|
|
</table>
|
|
|
|
|
|
</div>`
|
2021-10-19 11:38:56 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 防盗链
|
|
|
|
|
|
Vue.component("http-firewall-checkpoint-referer-block", {
|
|
|
|
|
|
props: ["v-checkpoint"],
|
|
|
|
|
|
data: function () {
|
|
|
|
|
|
let allowEmpty = true
|
|
|
|
|
|
let allowSameDomain = true
|
|
|
|
|
|
let allowDomains = []
|
2022-10-24 10:20:44 +08:00
|
|
|
|
let denyDomains = []
|
2021-10-19 11:38:56 +08:00
|
|
|
|
|
|
|
|
|
|
let options = {}
|
|
|
|
|
|
if (window.parent.UPDATING_RULE != null) {
|
|
|
|
|
|
options = window.parent.UPDATING_RULE.checkpointOptions
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (options == null) {
|
|
|
|
|
|
options = {}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (typeof (options.allowEmpty) == "boolean") {
|
|
|
|
|
|
allowEmpty = options.allowEmpty
|
|
|
|
|
|
}
|
|
|
|
|
|
if (typeof (options.allowSameDomain) == "boolean") {
|
|
|
|
|
|
allowSameDomain = options.allowSameDomain
|
|
|
|
|
|
}
|
|
|
|
|
|
if (options.allowDomains != null && typeof (options.allowDomains) == "object") {
|
|
|
|
|
|
allowDomains = options.allowDomains
|
|
|
|
|
|
}
|
2022-10-24 10:20:44 +08:00
|
|
|
|
if (options.denyDomains != null && typeof (options.denyDomains) == "object") {
|
|
|
|
|
|
denyDomains = options.denyDomains
|
|
|
|
|
|
}
|
2021-10-19 11:38:56 +08:00
|
|
|
|
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
that.change()
|
|
|
|
|
|
}, 100)
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
allowEmpty: allowEmpty,
|
|
|
|
|
|
allowSameDomain: allowSameDomain,
|
|
|
|
|
|
allowDomains: allowDomains,
|
2022-10-24 10:20:44 +08:00
|
|
|
|
denyDomains: denyDomains,
|
2021-10-19 11:38:56 +08:00
|
|
|
|
options: {},
|
|
|
|
|
|
value: 0
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
allowEmpty: function () {
|
|
|
|
|
|
this.change()
|
|
|
|
|
|
},
|
|
|
|
|
|
allowSameDomain: function () {
|
|
|
|
|
|
this.change()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
changeAllowDomains: function (values) {
|
|
|
|
|
|
this.allowDomains = values
|
|
|
|
|
|
this.change()
|
|
|
|
|
|
},
|
2022-10-24 10:20:44 +08:00
|
|
|
|
changeDenyDomains: function (values) {
|
|
|
|
|
|
this.denyDomains = values
|
|
|
|
|
|
this.change()
|
|
|
|
|
|
},
|
2021-10-19 11:38:56 +08:00
|
|
|
|
change: function () {
|
|
|
|
|
|
this.vCheckpoint.options = [
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "allowEmpty",
|
|
|
|
|
|
value: this.allowEmpty
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "allowSameDomain",
|
|
|
|
|
|
value: this.allowSameDomain,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "allowDomains",
|
|
|
|
|
|
value: this.allowDomains
|
2022-10-24 10:20:44 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
code: "denyDomains",
|
|
|
|
|
|
value: this.denyDomains
|
|
|
|
|
|
},
|
2021-10-19 11:38:56 +08:00
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
template: `<div>
|
|
|
|
|
|
<input type="hidden" name="operator" value="eq"/>
|
|
|
|
|
|
<input type="hidden" name="value" :value="value"/>
|
|
|
|
|
|
<table class="ui table">
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td class="title">来源域名允许为空</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<checkbox v-model="allowEmpty"></checkbox>
|
|
|
|
|
|
<p class="comment">允许不带来源的访问。</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td>来源域名允许一致</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<checkbox v-model="allowSameDomain"></checkbox>
|
|
|
|
|
|
<p class="comment">允许来源域名和当前访问的域名一致,相当于在站内访问。</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td>允许的来源域名</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<values-box :values="allowDomains" @change="changeAllowDomains"></values-box>
|
2021-10-25 19:01:56 +08:00
|
|
|
|
<p class="comment">允许的来源域名列表,比如<code-label>example.com</code-label>、<code-label>*.example.com</code-label>。单个星号<code-label>*</code-label>表示允许所有域名。</p>
|
2021-10-19 11:38:56 +08:00
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
2022-10-24 10:20:44 +08:00
|
|
|
|
<tr>
|
|
|
|
|
|
<td>禁止的来源域名</td>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
<values-box :values="denyDomains" @change="changeDenyDomains"></values-box>
|
|
|
|
|
|
<p class="comment">禁止的来源域名列表,比如<code-label>example.org</code-label>、<code-label>*.example.org</code-label>;除了这些禁止的来源域名外,其他域名都会被允许,除非限定了允许的来源域名。</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
2021-10-19 11:38:56 +08:00
|
|
|
|
</table>
|
|
|
|
|
|
</div>`
|
2020-11-18 19:35:32 +08:00
|
|
|
|
})
|