mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 23:17:21 +08:00
feat: 支持编辑失败状态下的 Fail2ban 配置 (#3322)
This commit is contained in:
parent
e8d3b5fe93
commit
18cbcb7f13
2 changed files with 10 additions and 9 deletions
|
@ -39,12 +39,16 @@ func (u *Fail2BanService) LoadBaseInfo() (dto.Fail2BanBaseInfo, error) {
|
||||||
baseInfo.IsEnable, baseInfo.IsActive, baseInfo.IsExist = client.Status()
|
baseInfo.IsEnable, baseInfo.IsActive, baseInfo.IsExist = client.Status()
|
||||||
if !baseInfo.IsActive {
|
if !baseInfo.IsActive {
|
||||||
baseInfo.Version = "-"
|
baseInfo.Version = "-"
|
||||||
return baseInfo, nil
|
} else {
|
||||||
|
baseInfo.Version = client.Version()
|
||||||
}
|
}
|
||||||
baseInfo.Version = client.Version()
|
|
||||||
conf, err := os.ReadFile(defaultFail2BanPath)
|
conf, err := os.ReadFile(defaultFail2BanPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return baseInfo, fmt.Errorf("read fail2ban conf of %s failed, err: %v", defaultFail2BanPath, err)
|
if baseInfo.IsActive {
|
||||||
|
return baseInfo, fmt.Errorf("read fail2ban conf of %s failed, err: %v", defaultFail2BanPath, err)
|
||||||
|
} else {
|
||||||
|
return baseInfo, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lines := strings.Split(string(conf), "\n")
|
lines := strings.Split(string(conf), "\n")
|
||||||
|
|
||||||
|
|
|
@ -40,17 +40,14 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="form.isExist">
|
<div v-if="form.isExist">
|
||||||
<el-card v-if="!form.isActive" class="mask-prompt">
|
<LayoutContent title="Fail2ban" :divider="true">
|
||||||
<span>{{ $t('toolbox.fail2ban.unActive') }}</span>
|
|
||||||
</el-card>
|
|
||||||
<LayoutContent title="Fail2ban" :divider="true" :class="{ mask: !form.isActive }">
|
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<el-button type="primary" plain @click="onLoadList('ignore')">
|
<el-button :disabled="!form.isActive" type="primary" plain @click="onLoadList('ignore')">
|
||||||
{{ $t('toolbox.fail2ban.ignoreIP') }}
|
{{ $t('toolbox.fail2ban.ignoreIP') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" plain @click="onLoadList('banned')">
|
<el-button :disabled="!form.isActive" type="primary" plain @click="onLoadList('banned')">
|
||||||
{{ $t('toolbox.fail2ban.bannedIP') }}
|
{{ $t('toolbox.fail2ban.bannedIP') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
Loading…
Add table
Reference in a new issue