this should fix it

This commit is contained in:
2023-09-07 08:31:05 +03:00
parent 095adb09cd
commit 2ffbb618f4

7
harden
View File

@@ -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