Browse Source

fix: 解决 Fail2ban 禁用方式切换失败的问题 (#3704)

pull/3707/head
ssongliu 10 months ago committed by GitHub
parent
commit
bbe1161dc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      backend/app/service/fail2ban.go
  2. 1
      backend/utils/firewall/client/firewalld.go

2
backend/app/service/fail2ban.go

@ -107,7 +107,7 @@ func (u *Fail2BanService) UpdateConf(req dto.Fail2BanUpdate) error {
if req.Value == "firewallcmd-ipset" || req.Value == "ufw" {
itemName := "ufw"
if req.Value == "firewallcmd-ipset" {
itemName = "firewallcmd"
itemName = "firewalld"
}
client, err := firewall.NewFirewallClient()
if err != nil {

1
backend/utils/firewall/client/firewalld.go

@ -106,6 +106,7 @@ func (f *Firewall) ListPort() ([]FireInfo, error) {
}
itemRule := f.loadInfo(rule)
if len(itemRule.Port) != 0 && itemRule.Family == "ipv4" {
itemRule.Family = ""
datas = append(datas, itemRule)
}
}

Loading…
Cancel
Save