diff --git a/backend/utils/firewall/client/ufw.go b/backend/utils/firewall/client/ufw.go index ac006e114..cbaca5ed8 100644 --- a/backend/utils/firewall/client/ufw.go +++ b/backend/utils/firewall/client/ufw.go @@ -65,9 +65,11 @@ func (f *Ufw) Stop() error { } func (f *Ufw) Restart() error { - stdout, err := cmd.Execf("%s systemctl restart ufw.service", cmd.SudoHandleCmd()) - if err != nil { - return fmt.Errorf("restart the firewall failed, err: %s", stdout) + if err := f.Stop(); err != nil { + return err + } + if err := f.Start(); err != nil { + return err } return nil }