From 2ffbb618f44e31fe6a0a9be66e6ecec96d6705fc Mon Sep 17 00:00:00 2001 From: konsthol Date: Thu, 7 Sep 2023 08:31:05 +0300 Subject: [PATCH] this should fix it --- harden | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/harden b/harden index abfd15a..dc7f83c 100755 --- a/harden +++ b/harden @@ -587,11 +587,8 @@ if [[ -n "$OLD_PORTS" ]]; then for port in "${OLD_PORTS[@]}"; do # Deny the port in the firewall case "$currentFirewall" in - ufw) - PORT_RULE_NUMS="$(sudo ufw status numbered | grep -i "$port" | grep -oP '\[.*?\]' | grep -o '[0-9]')" - for PORT_RULE_NUM in ${PORT_RULE_NUMS[@]}; do - yes | sudo ufw delete "$PORT_RULE_NUM" - done + ufw) # There are two rules by default for ipv4 and ipv6 + yes | sudo ufw delete allow "$port"/tcp ;; firewalld) sudo firewall-cmd --permanent --remove-port="$port"/tcp