(oldPort, newPort string)
| 30 | } |
| 31 | |
| 32 | func firewallUpdatePort(oldPort, newPort string) error { |
| 33 | stdout, err := cmd.NewCommandMgr().RunWithStdout("firewall-cmd", "--zone=public", "--add-port="+newPort+"/tcp", "--permanent") |
| 34 | if err != nil { |
| 35 | return fmt.Errorf("add (port: %s/tcp) failed, err: %s", newPort, stdout) |
| 36 | } |
| 37 | |
| 38 | _, _ = cmd.NewCommandMgr().RunWithStdout("firewall-cmd", "--zone=public", "--remove-port="+oldPort+"/tcp", "--permanent") |
| 39 | _, _ = cmd.NewCommandMgr().RunWithStdout("firewall-cmd", "--reload") |
| 40 | return nil |
| 41 | } |
| 42 | |
| 43 | func ufwUpdatePort(oldPort, newPort string) error { |
| 44 | stdout, err := cmd.NewCommandMgr().RunWithStdout("ufw", "allow", newPort) |
no test coverage detected