mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: 解决 UFW 防火墙列表解析错误的问题 (#5724)
This commit is contained in:
parent
02e7c2e974
commit
d01e34aa40
@ -223,7 +223,7 @@ func (f *Ufw) RichRules(rule FireInfo, operation string) error {
|
|||||||
|
|
||||||
stdout, err := cmd.Exec(ruleStr)
|
stdout, err := cmd.Exec(ruleStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(stdout, "ERROR: Invalid position") {
|
if strings.Contains(stdout, "ERROR: Invalid position") || strings.Contains(stdout, "ERROR: 无效位置") {
|
||||||
stdout, err := cmd.Exec(strings.ReplaceAll(ruleStr, "insert 1 ", ""))
|
stdout, err := cmd.Exec(strings.ReplaceAll(ruleStr, "insert 1 ", ""))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%s rich rules (%s), failed, err: %s", operation, ruleStr, stdout)
|
return fmt.Errorf("%s rich rules (%s), failed, err: %s", operation, ruleStr, stdout)
|
||||||
@ -270,6 +270,9 @@ func (f *Ufw) loadInfo(line string, fireType string) FireInfo {
|
|||||||
itemInfo.Strategy = "accept"
|
itemInfo.Strategy = "accept"
|
||||||
}
|
}
|
||||||
if fields[1] == "(v6)" {
|
if fields[1] == "(v6)" {
|
||||||
|
if fields[2] == "ALLOW" {
|
||||||
|
itemInfo.Strategy = "accept"
|
||||||
|
}
|
||||||
itemInfo.Address = fields[4]
|
itemInfo.Address = fields[4]
|
||||||
} else {
|
} else {
|
||||||
itemInfo.Address = fields[3]
|
itemInfo.Address = fields[3]
|
||||||
|
@ -29,12 +29,7 @@
|
|||||||
|
|
||||||
<template #main>
|
<template #main>
|
||||||
<div>
|
<div>
|
||||||
<el-select
|
<el-select v-if="!canUpdate()" style="width: 20%" @change="search()" v-model.number="tail">
|
||||||
v-if="!canUpdate()"
|
|
||||||
style="width: 20%"
|
|
||||||
@change="search(activeName)"
|
|
||||||
v-model.number="tail"
|
|
||||||
>
|
|
||||||
<template #prefix>{{ $t('toolbox.clam.tail') }}</template>
|
<template #prefix>{{ $t('toolbox.clam.tail') }}</template>
|
||||||
<el-option :value="0" :label="$t('commons.table.all')" />
|
<el-option :value="0" :label="$t('commons.table.all')" />
|
||||||
<el-option :value="10" :label="10" />
|
<el-option :value="10" :label="10" />
|
||||||
@ -89,7 +84,7 @@ const handleReady = (payload) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const activeName = ref('clamd');
|
const activeName = ref('clamd');
|
||||||
const tail = ref(0);
|
const tail = ref(200);
|
||||||
const content = ref();
|
const content = ref();
|
||||||
const confirmRef = ref();
|
const confirmRef = ref();
|
||||||
|
|
||||||
@ -105,9 +100,12 @@ const canUpdate = () => {
|
|||||||
return activeName.value.indexOf('-log') === -1;
|
return activeName.value.indexOf('-log') === -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
const search = async (itemName: string) => {
|
const search = async (itemName?: string) => {
|
||||||
|
if (itemName) {
|
||||||
|
tail.value = itemName.indexOf('-log') === -1 ? 0 : 200;
|
||||||
|
activeName.value = itemName;
|
||||||
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
activeName.value = itemName;
|
|
||||||
await searchClamFile(activeName.value, tail.value + '')
|
await searchClamFile(activeName.value, tail.value + '')
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@ -140,7 +138,7 @@ const onSubmit = async () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
search(activeName.value);
|
search();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user