feat: 网站 WAF 增加 user-agent 过滤 (#2796)

pull/2799/head
zhengkunwang 1 year ago committed by GitHub
parent a55d571bc9
commit dc420256e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -94,7 +94,7 @@ type FileDownload struct {
Paths []string `json:"paths" validate:"required"`
Type string `json:"type" validate:"required"`
Name string `json:"name" validate:"required"`
Compress bool `json:"compress" validate:"required"`
Compress bool `json:"compress"`
}
type FileChunkDownload struct {
@ -114,7 +114,7 @@ type FileRoleUpdate struct {
Path string `json:"path" validate:"required"`
User string `json:"user" validate:"required"`
Group string `json:"group" validate:"required"`
Sub bool `json:"sub" validate:"required"`
Sub bool `json:"sub"`
}
type FileReadByLineReq struct {

@ -4,7 +4,7 @@ import "github.com/1Panel-dev/1Panel/backend/app/dto"
type NginxConfigFileUpdate struct {
Content string `json:"content" validate:"required"`
Backup bool `json:"backup" validate:"required"`
Backup bool `json:"backup"`
}
type NginxScopeReq struct {
@ -56,7 +56,7 @@ type NginxAntiLeechUpdate struct {
WebsiteID uint `json:"websiteID" validate:"required"`
Extends string `json:"extends" validate:"required"`
Return string `json:"return" validate:"required"`
Enable bool `json:"enable" validate:"required"`
Enable bool `json:"enable" `
ServerNames []string `json:"serverNames"`
Cache bool `json:"cache"`
CacheTime int `json:"cacheTime"`
@ -70,8 +70,8 @@ type NginxRedirectReq struct {
Name string `json:"name" validate:"required"`
WebsiteID uint `json:"websiteID" validate:"required"`
Domains []string `json:"domains"`
KeepPath bool `json:"keepPath" validate:"required"`
Enable bool `json:"enable" validate:"required"`
KeepPath bool `json:"keepPath"`
Enable bool `json:"enable"`
Type string `json:"type" validate:"required"`
Redirect string `json:"redirect" validate:"required"`
Path string `json:"path"`

@ -78,13 +78,13 @@ type WebsiteWafReq struct {
type WebsiteRedirectUpdate struct {
WebsiteID uint `json:"websiteId" validate:"required"`
Key string `json:"key" validate:"required"`
Enable bool `json:"enable" validate:"required"`
Enable bool `json:"enable"`
}
type WebsiteWafUpdate struct {
WebsiteID uint `json:"websiteId" validate:"required"`
Key string `json:"key" validate:"required"`
Enable bool `json:"enable" validate:"required"`
Enable bool `json:"enable"`
}
type WebsiteRecover struct {
@ -121,7 +121,7 @@ type WebsiteDomainDelete struct {
type WebsiteHTTPSOp struct {
WebsiteID uint `json:"websiteId" validate:"required"`
Enable bool `json:"enable" validate:"required"`
Enable bool `json:"enable"`
WebsiteSSLID uint `json:"websiteSSLId"`
Type string `json:"type" validate:"oneof=existed auto manual"`
PrivateKey string `json:"privateKey"`
@ -168,7 +168,7 @@ type WebsitePHPFileUpdate struct {
type WebsitePHPVersionReq struct {
WebsiteID uint `json:"websiteID" validate:"required"`
RuntimeID uint `json:"runtimeID" validate:"required"`
RetainConfig bool `json:"retainConfig" validate:"required"`
RetainConfig bool `json:"retainConfig" `
}
type WebsiteUpdateDir struct {
@ -185,8 +185,8 @@ type WebsiteUpdateDirPermission struct {
type WebsiteProxyConfig struct {
ID uint `json:"id" validate:"required"`
Operate string `json:"operate" validate:"required"`
Enable bool `json:"enable" validate:"required"`
Cache bool `json:"cache" validate:"required"`
Enable bool `json:"enable" `
Cache bool `json:"cache" `
CacheTime int `json:"cacheTime" validate:"required"`
CacheUnit string `json:"cacheUnit" validate:"required"`
Name string `json:"name" validate:"required"`

@ -13,7 +13,7 @@ type WebsiteSSLCreate struct {
Provider string `json:"provider" validate:"required"`
AcmeAccountID uint `json:"acmeAccountId" validate:"required"`
DnsAccountID uint `json:"dnsAccountId"`
AutoRenew bool `json:"autoRenew" validate:"required"`
AutoRenew bool `json:"autoRenew"`
}
type WebsiteDNSReq struct {
@ -48,7 +48,7 @@ type WebsiteResourceReq struct {
type WebsiteSSLUpdate struct {
ID uint `json:"id" validate:"required"`
AutoRenew bool `json:"autoRenew" validate:"required"`
AutoRenew bool `json:"autoRenew"`
}
type WebsiteSSLUpload struct {

@ -1788,6 +1788,7 @@ const message = {
allIP: 'All IP',
portRule: 'Port rule',
ipRule: 'IP rule',
userAgent: 'User-Agent filter',
},
runtime: {
runtime: 'Runtime',

@ -1688,6 +1688,7 @@ const message = {
allIP: ' IP',
portRule: '',
ipRule: 'IP ',
userAgent: 'User-Agent ',
},
runtime: {
runtime: '',

@ -1688,6 +1688,7 @@ const message = {
allIP: ' IP',
portRule: '',
ipRule: 'IP ',
userAgent: 'User-Agent ',
},
runtime: {
runtime: '',

@ -44,6 +44,9 @@
<el-tab-pane :label="$t('firewall.postCheck')" name="post">
<ValueList :id="id" :rule="'post_check'" :param-key="'$postDeny'" v-if="index == 'post'"></ValueList>
</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">
<FileBlockList :id="id" v-if="index == 'fileExtBlockList'"></FileBlockList>
</el-tab-pane>

Loading…
Cancel
Save