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

This commit is contained in:
ssongliu 2024-01-25 18:18:47 +08:00 committed by GitHub
parent e85ed7427a
commit bbe1161dc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -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 {

View File

@ -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)
}
}