mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-27 17:26:03 +08:00
feat: 网站 WAF 增加 user-agent 过滤 (#2796)
This commit is contained in:
parent
a55d571bc9
commit
dc420256e2
8 changed files with 20 additions and 14 deletions
|
|
@ -94,7 +94,7 @@ type FileDownload struct {
|
||||||
Paths []string `json:"paths" validate:"required"`
|
Paths []string `json:"paths" validate:"required"`
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Compress bool `json:"compress" validate:"required"`
|
Compress bool `json:"compress"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileChunkDownload struct {
|
type FileChunkDownload struct {
|
||||||
|
|
@ -114,7 +114,7 @@ type FileRoleUpdate struct {
|
||||||
Path string `json:"path" validate:"required"`
|
Path string `json:"path" validate:"required"`
|
||||||
User string `json:"user" validate:"required"`
|
User string `json:"user" validate:"required"`
|
||||||
Group string `json:"group" validate:"required"`
|
Group string `json:"group" validate:"required"`
|
||||||
Sub bool `json:"sub" validate:"required"`
|
Sub bool `json:"sub"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileReadByLineReq struct {
|
type FileReadByLineReq struct {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import "github.com/1Panel-dev/1Panel/backend/app/dto"
|
||||||
|
|
||||||
type NginxConfigFileUpdate struct {
|
type NginxConfigFileUpdate struct {
|
||||||
Content string `json:"content" validate:"required"`
|
Content string `json:"content" validate:"required"`
|
||||||
Backup bool `json:"backup" validate:"required"`
|
Backup bool `json:"backup"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NginxScopeReq struct {
|
type NginxScopeReq struct {
|
||||||
|
|
@ -56,7 +56,7 @@ type NginxAntiLeechUpdate struct {
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
WebsiteID uint `json:"websiteID" validate:"required"`
|
||||||
Extends string `json:"extends" validate:"required"`
|
Extends string `json:"extends" validate:"required"`
|
||||||
Return string `json:"return" validate:"required"`
|
Return string `json:"return" validate:"required"`
|
||||||
Enable bool `json:"enable" validate:"required"`
|
Enable bool `json:"enable" `
|
||||||
ServerNames []string `json:"serverNames"`
|
ServerNames []string `json:"serverNames"`
|
||||||
Cache bool `json:"cache"`
|
Cache bool `json:"cache"`
|
||||||
CacheTime int `json:"cacheTime"`
|
CacheTime int `json:"cacheTime"`
|
||||||
|
|
@ -70,8 +70,8 @@ type NginxRedirectReq struct {
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
WebsiteID uint `json:"websiteID" validate:"required"`
|
||||||
Domains []string `json:"domains"`
|
Domains []string `json:"domains"`
|
||||||
KeepPath bool `json:"keepPath" validate:"required"`
|
KeepPath bool `json:"keepPath"`
|
||||||
Enable bool `json:"enable" validate:"required"`
|
Enable bool `json:"enable"`
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
Redirect string `json:"redirect" validate:"required"`
|
Redirect string `json:"redirect" validate:"required"`
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
|
|
|
||||||
|
|
@ -78,13 +78,13 @@ type WebsiteWafReq struct {
|
||||||
type WebsiteRedirectUpdate struct {
|
type WebsiteRedirectUpdate struct {
|
||||||
WebsiteID uint `json:"websiteId" validate:"required"`
|
WebsiteID uint `json:"websiteId" validate:"required"`
|
||||||
Key string `json:"key" validate:"required"`
|
Key string `json:"key" validate:"required"`
|
||||||
Enable bool `json:"enable" validate:"required"`
|
Enable bool `json:"enable"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteWafUpdate struct {
|
type WebsiteWafUpdate struct {
|
||||||
WebsiteID uint `json:"websiteId" validate:"required"`
|
WebsiteID uint `json:"websiteId" validate:"required"`
|
||||||
Key string `json:"key" validate:"required"`
|
Key string `json:"key" validate:"required"`
|
||||||
Enable bool `json:"enable" validate:"required"`
|
Enable bool `json:"enable"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteRecover struct {
|
type WebsiteRecover struct {
|
||||||
|
|
@ -121,7 +121,7 @@ type WebsiteDomainDelete struct {
|
||||||
|
|
||||||
type WebsiteHTTPSOp struct {
|
type WebsiteHTTPSOp struct {
|
||||||
WebsiteID uint `json:"websiteId" validate:"required"`
|
WebsiteID uint `json:"websiteId" validate:"required"`
|
||||||
Enable bool `json:"enable" validate:"required"`
|
Enable bool `json:"enable"`
|
||||||
WebsiteSSLID uint `json:"websiteSSLId"`
|
WebsiteSSLID uint `json:"websiteSSLId"`
|
||||||
Type string `json:"type" validate:"oneof=existed auto manual"`
|
Type string `json:"type" validate:"oneof=existed auto manual"`
|
||||||
PrivateKey string `json:"privateKey"`
|
PrivateKey string `json:"privateKey"`
|
||||||
|
|
@ -168,7 +168,7 @@ type WebsitePHPFileUpdate struct {
|
||||||
type WebsitePHPVersionReq struct {
|
type WebsitePHPVersionReq struct {
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
WebsiteID uint `json:"websiteID" validate:"required"`
|
||||||
RuntimeID uint `json:"runtimeID" validate:"required"`
|
RuntimeID uint `json:"runtimeID" validate:"required"`
|
||||||
RetainConfig bool `json:"retainConfig" validate:"required"`
|
RetainConfig bool `json:"retainConfig" `
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteUpdateDir struct {
|
type WebsiteUpdateDir struct {
|
||||||
|
|
@ -185,8 +185,8 @@ type WebsiteUpdateDirPermission struct {
|
||||||
type WebsiteProxyConfig struct {
|
type WebsiteProxyConfig struct {
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
Operate string `json:"operate" validate:"required"`
|
Operate string `json:"operate" validate:"required"`
|
||||||
Enable bool `json:"enable" validate:"required"`
|
Enable bool `json:"enable" `
|
||||||
Cache bool `json:"cache" validate:"required"`
|
Cache bool `json:"cache" `
|
||||||
CacheTime int `json:"cacheTime" validate:"required"`
|
CacheTime int `json:"cacheTime" validate:"required"`
|
||||||
CacheUnit string `json:"cacheUnit" validate:"required"`
|
CacheUnit string `json:"cacheUnit" validate:"required"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ type WebsiteSSLCreate struct {
|
||||||
Provider string `json:"provider" validate:"required"`
|
Provider string `json:"provider" validate:"required"`
|
||||||
AcmeAccountID uint `json:"acmeAccountId" validate:"required"`
|
AcmeAccountID uint `json:"acmeAccountId" validate:"required"`
|
||||||
DnsAccountID uint `json:"dnsAccountId"`
|
DnsAccountID uint `json:"dnsAccountId"`
|
||||||
AutoRenew bool `json:"autoRenew" validate:"required"`
|
AutoRenew bool `json:"autoRenew"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteDNSReq struct {
|
type WebsiteDNSReq struct {
|
||||||
|
|
@ -48,7 +48,7 @@ type WebsiteResourceReq struct {
|
||||||
|
|
||||||
type WebsiteSSLUpdate struct {
|
type WebsiteSSLUpdate struct {
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
AutoRenew bool `json:"autoRenew" validate:"required"`
|
AutoRenew bool `json:"autoRenew"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteSSLUpload struct {
|
type WebsiteSSLUpload struct {
|
||||||
|
|
|
||||||
|
|
@ -1788,6 +1788,7 @@ const message = {
|
||||||
allIP: 'All IP',
|
allIP: 'All IP',
|
||||||
portRule: 'Port rule',
|
portRule: 'Port rule',
|
||||||
ipRule: 'IP rule',
|
ipRule: 'IP rule',
|
||||||
|
userAgent: 'User-Agent filter',
|
||||||
},
|
},
|
||||||
runtime: {
|
runtime: {
|
||||||
runtime: 'Runtime',
|
runtime: 'Runtime',
|
||||||
|
|
|
||||||
|
|
@ -1688,6 +1688,7 @@ const message = {
|
||||||
allIP: '所有 IP',
|
allIP: '所有 IP',
|
||||||
portRule: '端口規則',
|
portRule: '端口規則',
|
||||||
ipRule: 'IP 規則',
|
ipRule: 'IP 規則',
|
||||||
|
userAgent: 'User-Agent 過濾',
|
||||||
},
|
},
|
||||||
runtime: {
|
runtime: {
|
||||||
runtime: '運行環境',
|
runtime: '運行環境',
|
||||||
|
|
|
||||||
|
|
@ -1688,6 +1688,7 @@ const message = {
|
||||||
allIP: '所有 IP',
|
allIP: '所有 IP',
|
||||||
portRule: '端口规则',
|
portRule: '端口规则',
|
||||||
ipRule: 'IP 规则',
|
ipRule: 'IP 规则',
|
||||||
|
userAgent: 'User-Agent 过滤',
|
||||||
},
|
},
|
||||||
runtime: {
|
runtime: {
|
||||||
runtime: '运行环境',
|
runtime: '运行环境',
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@
|
||||||
<el-tab-pane :label="$t('firewall.postCheck')" name="post">
|
<el-tab-pane :label="$t('firewall.postCheck')" name="post">
|
||||||
<ValueList :id="id" :rule="'post_check'" :param-key="'$postDeny'" v-if="index == 'post'"></ValueList>
|
<ValueList :id="id" :rule="'post_check'" :param-key="'$postDeny'" v-if="index == 'post'"></ValueList>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
<el-tab-pane :label="$t('firewall.userAgent')" name="ua">
|
||||||
|
<ValueList :id="id" :rule="'user_agent'" :param-key="'$userAgent'" v-if="index == 'ua'"></ValueList>
|
||||||
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('firewall.fileExtBlockList')" name="fileExtBlockList">
|
<el-tab-pane :label="$t('firewall.fileExtBlockList')" name="fileExtBlockList">
|
||||||
<FileBlockList :id="id" v-if="index == 'fileExtBlockList'"></FileBlockList>
|
<FileBlockList :id="id" v-if="index == 'fileExtBlockList'"></FileBlockList>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue