Skip to content

Commit c75d251

Browse files
committed
fixing removeUFWRule
the command to remove a rule from UFW must either specify the rule number or repeat the entire text of the rule including "allow"
1 parent df1bd3a commit c75d251

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

firewall/ufw.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func removeUFWRule(ip string) error {
6969
}
7070
port, proto := parts[0], parts[1]
7171

72-
cmd := fmt.Sprintf("sudo ufw delete proto %s from %s to any port %s", proto, ip, port)
72+
cmd := fmt.Sprintf("sudo ufw delete allow proto %s from %s to any port %s", proto, ip, port)
7373
output, err := utils.RunCommand(cmd)
7474
if err != nil {
7575
return fmt.Errorf("❌ failed to delete rule for port %s: %v\n%s", port, err, output)

0 commit comments

Comments
 (0)