mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-30 23:49:10 +08:00
fix: 修改 UFW IP 规则优先级 (#2508)
This commit is contained in:
parent
f9e22166c1
commit
faf4174adf
@ -233,13 +233,13 @@ func (u *FirewallService) OperatePortRule(req dto.PortRuleOperate, reload bool)
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if req.Protocol == "tcp/udp" {
|
|
||||||
req.Protocol = ""
|
|
||||||
}
|
|
||||||
for _, addr := range itemAddress {
|
for _, addr := range itemAddress {
|
||||||
if len(addr) == 0 {
|
if len(addr) == 0 {
|
||||||
addr = "Anywhere"
|
addr = "Anywhere"
|
||||||
}
|
}
|
||||||
|
if req.Protocol == "tcp/udp" {
|
||||||
|
req.Protocol = ""
|
||||||
|
}
|
||||||
req.Address = addr
|
req.Address = addr
|
||||||
if err := u.operatePort(client, req); err != nil {
|
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)
|
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)
|
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" {
|
if operation == "remove" {
|
||||||
ruleStr = fmt.Sprintf("%s delete %s ", f.CmdStr, rule.Strategy)
|
ruleStr = fmt.Sprintf("%s delete %s ", f.CmdStr, rule.Strategy)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user