1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 22:18:07 +08:00

feat: 修改 nginx waf

This commit is contained in:
zhengkunwang223 2022-12-20 16:47:43 +08:00 committed by zhengkunwang223
parent 582bb0b4f3
commit 67aaa3b2bd
7 changed files with 31 additions and 20 deletions

View File

@ -1,4 +1,4 @@
#user nginx; user root;
worker_processes auto; worker_processes auto;
error_log /var/log/nginx/error.log notice; error_log /var/log/nginx/error.log notice;

View File

@ -905,4 +905,15 @@ export default {
manualCreate: '手动创建', manualCreate: '手动创建',
acmeAccount: 'Acme 账号', acmeAccount: 'Acme 账号',
}, },
firewall: {
ccDeny: 'CC 防护',
ipWhiteList: 'IP 白名单',
ipBlockList: 'IP 黑名单',
fileExtBlockList: '文件扩展名黑名单',
urlWhiteList: 'URL 白名单',
urlBlockList: 'URL 黑名单',
argsCheck: 'GET 参数校验',
postCheck: 'POST 参数校验',
cookieBlockList: 'Cookie 黑名单',
},
}; };

View File

@ -67,7 +67,7 @@ let form = reactive({
let req = ref<Website.WafReq>({ let req = ref<Website.WafReq>({
websiteId: 0, websiteId: 0,
key: '$CCDeny', key: '$CCDeny',
rule: 'ccrate', rule: 'ccRate',
}); });
let enableUpdate = ref<Website.WafUpdate>({ let enableUpdate = ref<Website.WafUpdate>({
websiteId: 0, websiteId: 0,

View File

@ -1,18 +1,15 @@
<template> <template>
<el-tabs tab-position="left" type="border-card" v-model="index"> <el-tabs tab-position="left" type="border-card" v-model="index">
<el-tab-pane :label="'CC 防护'" name="cc"> <el-tab-pane :label="$t('firewall.ccDeny')" name="cc">
<CCDeny :id="id" v-if="index == 'cc'"></CCDeny> <CCDeny :id="id" v-if="index == 'cc'"></CCDeny>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="'IP 白名单'" name="ipWhiteList"> <el-tab-pane :label="$t('firewall.ipWhiteList')" name="ipWhiteList">
<IpList :id="id" :rule="'ipWhitelist'" :param-key="'$ipWhiteAllow'" v-if="index == 'ipWhiteList'"></IpList> <IpList :id="id" :rule="'ipWhiteList'" :param-key="'$ipWhiteAllow'" v-if="index == 'ipWhiteList'"></IpList>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="'IP 黑名单'" name="ipBlockList"> <el-tab-pane :label="$t('firewall.ipBlockList')" name="ipBlockList">
<IpList :id="id" :rule="'ipBlockList'" :param-key="'$ipBlockDeny'" v-if="index == 'ipBlockList'"></IpList> <IpList :id="id" :rule="'ipBlockList'" :param-key="'$ipBlockDeny'" v-if="index == 'ipBlockList'"></IpList>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="'文件扩展名黑名单'" name="fileExtBlockList"> <el-tab-pane :label="$t('firewall.urlWhiteList')" name="urlWhiteList">
<FileBlockList :id="id" v-if="index == 'fileExtBlockList'"></FileBlockList>
</el-tab-pane>
<el-tab-pane :label="'URL白名单'" name="urlWhiteList">
<ValueList <ValueList
:id="id" :id="id"
:rule="'urlWhiteList'" :rule="'urlWhiteList'"
@ -20,7 +17,7 @@
v-if="index == 'urlWhiteList'" v-if="index == 'urlWhiteList'"
></ValueList> ></ValueList>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="'URL黑名单'" name="urlBlockList"> <el-tab-pane :label="$t('firewall.urlBlockList')" name="urlBlockList">
<ValueList <ValueList
:id="id" :id="id"
:rule="'urlBlockList'" :rule="'urlBlockList'"
@ -28,13 +25,7 @@
v-if="index == 'urlBlockList'" v-if="index == 'urlBlockList'"
></ValueList> ></ValueList>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="'GET参数(args)校验'" name="args"> <el-tab-pane :label="$t('firewall.cookieBlockList')" name="cookie">
<ValueList :id="id" :rule="'argsCheckList'" :param-key="'$argsDeny'" v-if="index == 'args'"></ValueList>
</el-tab-pane>
<el-tab-pane :label="'POST参数校验'" name="post">
<ValueList :id="id" :rule="'postCheckList'" :param-key="'$postDeny'" v-if="index == 'post'"></ValueList>
</el-tab-pane>
<el-tab-pane :label="'Cookie黑名单'" name="cookie">
<ValueList <ValueList
:id="id" :id="id"
:rule="'cookieBlockList'" :rule="'cookieBlockList'"
@ -42,6 +33,15 @@
v-if="index == 'cookie'" v-if="index == 'cookie'"
></ValueList> ></ValueList>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('firewall.argsCheck')" name="args">
<ValueList :id="id" :rule="'argsCheckList'" :param-key="'$argsDeny'" v-if="index == 'args'"></ValueList>
</el-tab-pane>
<el-tab-pane :label="$t('firewall.postCheck')" name="post">
<ValueList :id="id" :rule="'postCheckList'" :param-key="'$postDeny'" v-if="index == 'post'"></ValueList>
</el-tab-pane>
<el-tab-pane :label="$t('firewall.fileExtBlockList')" name="fileExtBlockList">
<FileBlockList :id="id" v-if="index == 'fileExtBlockList'"></FileBlockList>
</el-tab-pane>
</el-tabs> </el-tabs>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>

View File

@ -53,7 +53,7 @@ const props = defineProps({
}, },
rule: { rule: {
type: String, type: String,
default: 'ipWhitelist', default: 'ipWhiteList',
}, },
paramKey: { paramKey: {
type: String, type: String,
@ -75,7 +75,7 @@ let data = ref([]);
let req = ref<Website.WafReq>({ let req = ref<Website.WafReq>({
websiteId: 0, websiteId: 0,
key: '$ipWhiteAllow', key: '$ipWhiteAllow',
rule: 'ipWhitelist', rule: 'ipWhiteList',
}); });
let fileUpdate = reactive({ let fileUpdate = reactive({
path: '', path: '',