mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 23:17:21 +08:00
parent
cd5658adab
commit
262ddb5f12
1 changed files with 7 additions and 0 deletions
|
@ -183,6 +183,13 @@ func (f *Ufw) RichRules(rule FireInfo, operation string) error {
|
||||||
|
|
||||||
stdout, err := cmd.Exec(ruleStr)
|
stdout, err := cmd.Exec(ruleStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if strings.Contains(stdout, "ERROR: Invalid position") {
|
||||||
|
stdout, err := cmd.Exec(strings.ReplaceAll(ruleStr, "insert 1 ", ""))
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("%s rich rules (%s), failed, err: %s", operation, ruleStr, stdout)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return fmt.Errorf("%s rich rules (%s), failed, err: %s", operation, ruleStr, stdout)
|
return fmt.Errorf("%s rich rules (%s), failed, err: %s", operation, ruleStr, stdout)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue