diff --git a/backend/app/service/fail2ban.go b/backend/app/service/fail2ban.go index 6f1fa6096..59684ccc0 100644 --- a/backend/app/service/fail2ban.go +++ b/backend/app/service/fail2ban.go @@ -39,12 +39,16 @@ func (u *Fail2BanService) LoadBaseInfo() (dto.Fail2BanBaseInfo, error) { baseInfo.IsEnable, baseInfo.IsActive, baseInfo.IsExist = client.Status() if !baseInfo.IsActive { baseInfo.Version = "-" - return baseInfo, nil + } else { + baseInfo.Version = client.Version() } - baseInfo.Version = client.Version() conf, err := os.ReadFile(defaultFail2BanPath) 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") diff --git a/frontend/src/views/toolbox/fail2ban/index.vue b/frontend/src/views/toolbox/fail2ban/index.vue index 222246cb1..877bf3aaf 100644 --- a/frontend/src/views/toolbox/fail2ban/index.vue +++ b/frontend/src/views/toolbox/fail2ban/index.vue @@ -40,17 +40,14 @@
- - {{ $t('toolbox.fail2ban.unActive') }} - - +