fix: 修改 UFW IP 规则优先级 (#2508)

pull/2509/head
ssongliu 1 year ago committed by GitHub
parent f9e22166c1
commit faf4174adf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -233,13 +233,13 @@ func (u *FirewallService) OperatePortRule(req dto.PortRuleOperate, reload bool)
}
return nil
}
if req.Protocol == "tcp/udp" {
req.Protocol = ""
}
for _, addr := range itemAddress {
if len(addr) == 0 {
addr = "Anywhere"
}
if req.Protocol == "tcp/udp" {
req.Protocol = ""
}
req.Address = addr
if err := u.operatePort(client, req); err != nil {
global.LOG.Errorf("%s port %s/%s failed (strategy: %s, address: %s), err: %v", req.Operation, req.Port, req.Protocol, req.Strategy, req.Address, err)

@ -165,7 +165,7 @@ func (f *Ufw) RichRules(rule FireInfo, operation string) error {
return buserr.New(constant.ErrCmdIllegal)
}
ruleStr := fmt.Sprintf("%s %s ", f.CmdStr, rule.Strategy)
ruleStr := fmt.Sprintf("%s insert 1 %s ", f.CmdStr, rule.Strategy)
if operation == "remove" {
ruleStr = fmt.Sprintf("%s delete %s ", f.CmdStr, rule.Strategy)
}

Loading…
Cancel
Save